Skip to content

Commit

Permalink
Merge pull request #493 from S7NetPlus/testing
Browse files Browse the repository at this point in the history
GitHub actions test improvements
  • Loading branch information
mycroes authored Jul 25, 2023
2 parents 670fb70 + 8126018 commit b3077b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 35 deletions.
41 changes: 7 additions & 34 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,76 +64,49 @@ jobs:
${{ env.NuGetDirectory }}/*.snupkg
run_test:
name: test-${{ matrix.os }}-${{ matrix.test-framework }}
name: test-${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
configuration: Release
artifacts: ${{ github.workspace }}/artifacts
strategy:
matrix:
os: [windows-latest, ubuntu-20.04, macos-latest]
test-framework: [net6.0, net7.0]
include:
- os: ubuntu-20.04
test-framework: net6.0
installSnap7: true
dotnet-sdk: '6.x'
- os: ubuntu-20.04
test-framework: net7.0
installSnap7: true
dotnet-sdk: '7.x'
- os: macos-latest
test-framework: net6.0
installSnap7: true
dotnet-sdk: '6.x'
- os: macos-latest
test-framework: net7.0
installSnap7: true
dotnet-sdk: '7.x'
- os: windows-latest
test-framework: net6.0
dotnet-sdk: '6.x'
- os: windows-latest
test-framework: net7.0
dotnet-sdk: '7.x'
- os: windows-latest
test-framework: net462
dotnet-sdk: '7.x'
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: Install Snap7 Linux
if: ${{ matrix.installSnap7 && matrix.os == 'ubuntu-20.04' }}
if: ${{ matrix.os == 'ubuntu-20.04' }}
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' }}
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install snap7
- name: Setup Dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
${{ matrix.dotnet-sdk }}
6.x
7.x
- 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') }}
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-${{ matrix.test-framework }}-nuget
${{ runner.os }}-nuget
- name: Test
run: dotnet test --nologo --verbosity normal --logger GitHubActions --framework ${{ matrix.test-framework }}
run: dotnet test --nologo --verbosity normal --logger GitHubActions

deploy:
# Publish only when creating a GitHub Release
Expand Down
7 changes: 6 additions & 1 deletion S7.Net.UnitTest/S7.Net.UnitTest.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>net462;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>Properties\S7.Net.snk</AssemblyOriginatorKeyFile>
<IsPackable>false</IsPackable>
Expand Down

0 comments on commit b3077b2

Please sign in to comment.