diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0d13810 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,80 @@ +name: Test + +on: + [pull_request, push] + +jobs: + + build_test: + name: test-${{ matrix.os }}-${{ matrix.test-framework }} + runs-on: ${{ matrix.os }} + env: + configuration: Release + artifacts: ${{ github.workspace }}/artifacts + DOTNET_NOLOGO : 1 + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + test-framework: [netcoreapp3.1, net5.0] + include: + - os: ubuntu-latest + test-framework: netcoreapp3.1 + installSnap7: true + dotnet-sdk: '3.1.x' + - os: ubuntu-latest + test-framework: net5.0 + installSnap7: true + dotnet-sdk: '5.0.x' + - os: macos-latest + test-framework: netcoreapp3.1 + installSnap7: true + dotnet-sdk: '3.1.x' + - os: macos-latest + test-framework: net5.0 + installSnap7: true + dotnet-sdk: '5.0.x' + - os: windows-latest + test-framework: netcoreapp3.1 + dotnet-sdk: '3.1.x' + - os: windows-latest + test-framework: net5.0 + dotnet-sdk: '5.0.x' + - os: windows-latest + test-framework: net452 + dotnet-sdk: '5.0.x' + fail-fast: false + + steps: + - uses: actions/checkout@v2 + + - name: Install Snap7 Linux + if: ${{ matrix.installSnap7 && matrix.os == 'ubuntu-latest' }} + run: | + sudo add-apt-repository ppa:gijzelaar/snap7 + sudo apt-get update + sudo apt-get install libsnap7-1 libsnap7-dev + + - name: Install Snap7 MacOs + if: ${{ matrix.installSnap7 && matrix.os == 'macos-latest' }} + run: | + brew install snap7 + + - name: Setup Dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ matrix.dotnet-sdk }} + + - name: Nuget Cache + uses: actions/cache@v2 + with: + path: ~/.nuget/packages + # Look to see if there is a cache hit for the corresponding requirements file + key: ${{ runner.os }}-${{ matrix.test-framework }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.test-framework }}-nuget + + - name: Restore + run: dotnet restore S7.Net.UnitTest + + - name: Test + run: dotnet test --no-restore --nologo --verbosity normal --logger GitHubActions --framework ${{ matrix.test-framework }} diff --git a/S7.Net.UnitTest/S7.Net.UnitTest.csproj b/S7.Net.UnitTest/S7.Net.UnitTest.csproj index e836b62..eb63e48 100644 --- a/S7.Net.UnitTest/S7.Net.UnitTest.csproj +++ b/S7.Net.UnitTest/S7.Net.UnitTest.csproj @@ -1,7 +1,7 @@  - net452;netcoreapp3.1 + net452;netcoreapp3.1;net5.0 true Properties\S7.Net.snk diff --git a/S7.sln b/S7.sln index 2ae0e52..dbfaf5c 100644 --- a/S7.sln +++ b/S7.sln @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject appveyor.yml = appveyor.yml README.md = README.md + .github\workflows\test.yml = .github\workflows\test.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "S7.Net.UnitTest", "S7.Net.UnitTest\S7.Net.UnitTest.csproj", "{303CCED6-9ABC-4899-A509-743341AAA804}"