name: libplctag CI

on:
  push:
    branches: [ release, prerelease ]
  pull_request:
    branches: [ release, prerelease ]

jobs:
  ubuntu_x64:

    runs-on: ubuntu-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_ubuntu_x64"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - name: "Checkout library source."
      uses: actions/checkout@v2

    - name: Set up build environment
      run: sudo apt update; sudo apt install build-essential cmake

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_32_BIT=0 ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Test Basic Functions
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --debug --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] --delay=50 &
        sleep 2
        echo "test simple get/set tag."
        ${{ env.DIST }}/simple
        echo "test callback use."
        ${{ env.DIST }}/test_callback
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Micro800
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=Micro800 --tag=TestDINTArray:DINT[10] &
        sleep 2
        echo "test getting a tag on a Micro800."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab_eip&gateway=127.0.0.1&cpu=micro800&elem_size=4&elem_count=1&name=TestDINTArray[0]'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Omron NJ/NX
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=Omron --tag=TestDINTArray:DINT[10] &
        sleep 2
        echo "test getting a tag on an Omron NJ/NX."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=18,127.0.0.1&plc=omron-njnx&name=TestDINTArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test PLC/5
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=PLC/5 --tag=N7[10] &
        sleep 2
        echo "test getting a tag on a PLC/5."
        ${{ env.DIST }}/tag_rw -t sint16 -p 'protocol=ab_eip&gateway=127.0.0.1&plc=plc5&elem_size=2&elem_count=10&name=N7:0'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test SLC 500
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=SLC500 --tag=N7[10] &
        sleep 2
        echo "test getting a tag on a SLC 500."
        ${{ env.DIST }}/tag_rw -t sint16 -p 'protocol=ab_eip&gateway=127.0.0.1&plc=slc&elem_size=2&elem_count=10&name=N7:0'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Duplicate Connection ID
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=ControlLogix --path=1,0 --tag=TestDINTArray:DINT[10] --reject-fo=5 &
        sleep 2
        echo "test getting a tag with connection failures."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&name=TestDINTArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Large Tags
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] &
        sleep 2
        echo "test getting a large tag."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&elem_count=2000&name=TestBigArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null


    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

  ubuntu_x86:

    runs-on: ubuntu-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_ubuntu_x86"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - name: Checkout library source
      uses: actions/checkout@v2

    - name: Set up build environment
      run: sudo apt update; sudo apt-get -y --force-yes install gcc-multilib g++-multilib

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_32_BIT=1 ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Test Basic Functions
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --debug --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] --delay=50 &
        sleep 2
        echo "test simple get/set tag."
        ${{ env.DIST }}/simple
        echo "test callback use."
        ${{ env.DIST }}/test_callback
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Micro800
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=Micro800 --tag=TestDINTArray:DINT[10] &
        sleep 2
        echo "test getting a tag on a Micro800."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab_eip&gateway=127.0.0.1&cpu=micro800&elem_size=4&elem_count=1&name=TestDINTArray[0]'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Omron NJ/NX
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=Omron --tag=TestDINTArray:DINT[10] &
        sleep 2
        echo "test getting a tag on an Omron NJ/NX."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=18,127.0.0.1&plc=omron-njnx&name=TestDINTArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test PLC/5
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=PLC/5 --tag=N7[10] &
        sleep 2
        echo "test getting a tag on a PLC/5."
        ${{ env.DIST }}/tag_rw -t sint16 -p 'protocol=ab_eip&gateway=127.0.0.1&plc=plc5&elem_size=2&elem_count=10&name=N7:0'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test SLC 500
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=SLC500 --tag=N7[10] &
        sleep 2
        echo "test getting a tag on a SLC 500."
        ${{ env.DIST }}/tag_rw -t sint16 -p 'protocol=ab_eip&gateway=127.0.0.1&plc=slc&elem_size=2&elem_count=10&name=N7:0'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Duplicate Connection ID
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=ControlLogix --path=1,0 --tag=TestDINTArray:DINT[10] --reject-fo=5 &
        sleep 2
        echo "test getting a tag with connection failures."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&name=TestDINTArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Large Tags
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] &
        sleep 2
        echo "test getting a large tag."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&elem_count=2000&name=TestBigArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

  macos_x64:

    runs-on: macos-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_macos_x64"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - uses: actions/checkout@v2

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Test Basic Functions
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --debug --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] --delay=50 &
        sleep 2
        echo "test simple get/set tag."
        ${{ env.DIST }}/simple
        echo "test callback use."
        ${{ env.DIST }}/test_callback
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Micro800
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=Micro800 --tag=TestDINTArray:DINT[10] &
        sleep 2
        echo "test getting a tag on a Micro800."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab_eip&gateway=127.0.0.1&cpu=micro800&elem_size=4&elem_count=1&name=TestDINTArray[0]'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Omron NJ/NX
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=Omron --tag=TestDINTArray:DINT[10] &
        sleep 2
        echo "test getting a tag on an Omron NJ/NX."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=18,127.0.0.1&plc=omron-njnx&name=TestDINTArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test PLC/5
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=PLC/5 --tag=N7[10] &
        sleep 2
        echo "test getting a tag on a PLC/5."
        ${{ env.DIST }}/tag_rw -t sint16 -p 'protocol=ab_eip&gateway=127.0.0.1&plc=plc5&elem_size=2&elem_count=10&name=N7:0'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test SLC 500
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=SLC500 --tag=N7[10] &
        sleep 2
        echo "test getting a tag on a SLC 500."
        ${{ env.DIST }}/tag_rw -t sint16 -p 'protocol=ab_eip&gateway=127.0.0.1&plc=slc&elem_size=2&elem_count=10&name=N7:0'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Duplicate Connection ID
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=ControlLogix --path=1,0 --tag=TestDINTArray:DINT[10] --reject-fo=5 &
        sleep 2
        echo "test getting a tag with connection failures."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&name=TestDINTArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Test Large Tags
      run: |
        cd ${{ env.DIST }}
        echo "start up simulator..."
        ${{ env.DIST }}/ab_server --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] &
        sleep 2
        echo "test getting a large tag."
        ${{ env.DIST }}/tag_rw -t sint32 -p 'protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&elem_count=2000&name=TestBigArray'
        echo "shut down server."
        killall ab_server -INT &> /dev/null

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

  macos_ARM64:

    runs-on: macos-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_macos_aarch64_EXPERIMENTAL"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - uses: actions/checkout@v2

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

  windows_x64:

    runs-on: windows-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_windows_x64"
      BUILD: "${{ github.workspace }}\\build"
      DIST: "${{ github.workspace }}\\build\\bin_dist"

    steps:
    - uses: actions/checkout@v2

    - name: Create build directory
      run: mkdir ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake .. -G "Visual Studio 16 2019" -A x64

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build . --config Release

    - name: Test Basic Functions
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --debug --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] --delay=50
        timeout /T 5
        echo "test simple get/set tag."
        .\simple
        echo "test callback use."
        .\test_callback
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Micro800
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=Micro800 --tag=TestDINTArray:DINT[10]
        timeout /T 5
        echo "test getting a tag on a Micro800."
        .\tag_rw.exe -t sint32 -p "protocol=ab_eip&gateway=127.0.0.1&cpu=micro800&elem_size=4&elem_count=1&name=TestDINTArray[0]"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Omron NJ/NX
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=Omron --tag=TestDINTArray:DINT[10]
        timeout /T 5
        echo "test getting a tag on an Omron NJ/NX."
        .\tag_rw.exe -t sint32 -p "protocol=ab-eip&gateway=127.0.0.1&path=18,127.0.0.1&plc=omron-njnx&name=TestDINTArray"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test PLC/5
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=PLC/5 --tag=N7[10]
        timeout /T 5
        echo "test getting a tag on a PLC/5."
        .\tag_rw.exe -t sint16 -p "protocol=ab_eip&gateway=127.0.0.1&plc=plc5&elem_size=2&elem_count=10&name=N7:0"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test SLC 500
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=SLC500 --tag=N7[10]
        timeout /T 5
        echo "test getting a tag on a SLC 500."
        .\tag_rw.exe -t sint16 -p "protocol=ab_eip&gateway=127.0.0.1&plc=slc&elem_size=2&elem_count=10&name=N7:0"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Duplicate Connection ID
      run: |
        cd ${{ env.DIST }}\Release
        dir
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=ControlLogix --path=1,0 --tag=TestDINTArray:DINT[10] --reject-fo=5
        timeout /T 5
        echo "test getting a tag with connection failures."
        .\tag_rw.exe -t sint32 -p "protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&name=TestDINTArray"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Large Tags
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000]
        timeout /T 5
        echo "test getting a large tag."
        .\tag_rw.exe -t sint32 -p "protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&elem_count=2000&name=TestBigArray"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

  windows_x86:

    runs-on: windows-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_windows_x86"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - uses: actions/checkout@v2

    - name: Create build directory
      run: mkdir ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake .. -G "Visual Studio 16 2019" -A Win32

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build . --config Release

    - name: Test Basic Functions
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --debug --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000] --delay=50
        timeout /T 5
        echo "test simple get/set tag."
        .\simple
        echo "test callback use."
        .\test_callback
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Micro800
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=Micro800 --tag=TestDINTArray:DINT[10]
        timeout /T 5
        echo "test getting a tag on a Micro800."
        .\tag_rw.exe -t sint32 -p "protocol=ab_eip&gateway=127.0.0.1&cpu=micro800&elem_size=4&elem_count=1&name=TestDINTArray[0]"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Omron NJ/NX
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=Omron --tag=TestDINTArray:DINT[10]
        timeout /T 5
        echo "test getting a tag on an Omron NJ/NX."
        .\tag_rw.exe -t sint32 -p "protocol=ab-eip&gateway=127.0.0.1&path=18,127.0.0.1&plc=omron-njnx&name=TestDINTArray"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test PLC/5
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=PLC/5 --tag=N7[10]
        timeout /T 5
        echo "test getting a tag on a PLC/5."
        .\tag_rw.exe -t sint16 -p "protocol=ab_eip&gateway=127.0.0.1&plc=plc5&elem_size=2&elem_count=10&name=N7:0"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test SLC 500
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=SLC500 --tag=N7[10]
        timeout /T 5
        echo "test getting a tag on a SLC 500."
        .\tag_rw.exe -t sint16 -p "protocol=ab_eip&gateway=127.0.0.1&plc=slc&elem_size=2&elem_count=10&name=N7:0"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Duplicate Connection ID
      run: |
        cd ${{ env.DIST }}\Release
        dir
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=ControlLogix --path=1,0 --tag=TestDINTArray:DINT[10] --reject-fo=5
        timeout /T 5
        echo "test getting a tag with connection failures."
        .\tag_rw.exe -t sint32 -p "protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&name=TestDINTArray"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Test Large Tags
      run: |
        cd ${{ env.DIST }}\Release
        echo "start up simulator..."
        start /b .\ab_server.exe --plc=ControlLogix --path=1,0 --tag=TestBigArray:DINT[2000]
        timeout /T 5
        echo "test getting a large tag."
        .\tag_rw.exe -t sint32 -p "protocol=ab-eip&gateway=127.0.0.1&path=1,0&plc=ControlLogix&elem_count=2000&name=TestBigArray"
        echo "shut down server."
        taskkill /F /IM ab_server.exe
      shell: cmd

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

  windows_ARM:

    runs-on: windows-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_windows_Arm"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - uses: actions/checkout@v2

    - name: Create build directory
      run: mkdir ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake .. -G "Visual Studio 16 2019" -A ARM

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build . --config Release

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}


  windows_ARM64:

    runs-on: windows-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_windows_Arm64"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - uses: actions/checkout@v2

    - name: Create build directory
      run: mkdir ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake .. -G "Visual Studio 16 2019" -A ARM64

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build . --config Release

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}


  ubuntu_cross_build_arm6:

    runs-on: ubuntu-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_linux_arm6hf"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - name: "Checkout library source."
      uses: actions/checkout@v2

    - name: Set up build environment
      run: sudo apt update; sudo apt install build-essential cmake crossbuild-essential-armhf

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_32_BIT=0 -DCROSS_BUILD_TYPE=Linux-Arm6 ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}


  ubuntu_cross_build_arm7:

    runs-on: ubuntu-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_linux_arm7l"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - name: "Checkout library source."
      uses: actions/checkout@v2

    - name: Set up build environment
      run: sudo apt update; sudo apt install build-essential cmake crossbuild-essential-armhf

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_32_BIT=0 -DCROSS_BUILD_TYPE=Linux-Arm7 ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}


  ubuntu_cross_build_aarch64:

    runs-on: ubuntu-latest

    env:
      VERSION: "2.5.0"
      ARTIFACT: "libplctag_2.5.0_linux_aarch64"
      BUILD: "${{ github.workspace }}/build"
      DIST: "${{ github.workspace }}/build/bin_dist"

    steps:
    - name: "Checkout library source."
      uses: actions/checkout@v2

    - name: Set up build environment
      run: sudo apt update; sudo apt install build-essential cmake crossbuild-essential-arm64

    - name: Create build directory
      run: rm -rf ${{ env.BUILD }}; mkdir -p ${{ env.BUILD }}

    - name: Configure CMake
      run: cd ${{ env.BUILD }}; cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_32_BIT=0 -DCROSS_BUILD_TYPE=Linux-Aarch64 ..

    - name: Build
      run: cd ${{ env.BUILD }}; cmake --build .

    - name: Upload ZIP artifact
      uses: actions/upload-artifact@v1
      with:
        name: ${{ env.ARTIFACT }}
        path: ${{ env.DIST }}

