Merge pull request #493 from S7NetPlus/testing

GitHub actions test improvements
This commit is contained in:
Michael Croes
2023-07-25 23:24:43 +02:00
committed by GitHub
2 changed files with 13 additions and 35 deletions

View File

@@ -64,7 +64,7 @@ jobs:
${{ env.NuGetDirectory }}/*.snupkg
run_test:
name: test-${{ matrix.os }}-${{ matrix.test-framework }}
name: test-${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
configuration: Release
@@ -72,47 +72,20 @@ jobs:
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
@@ -120,7 +93,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
${{ matrix.dotnet-sdk }}
6.x
7.x
- name: Nuget Cache
@@ -128,12 +101,12 @@ jobs:
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

View File

@@ -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>