Skip to content

Commit

Permalink
Runnng matrix strategy to test all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisDyallo committed Apr 30, 2024
1 parent 1c2b9dd commit 2fcfe60
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions .github/workflows/test-and-cover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ on:
push:
branches:
- main
- develop
paths:
- '**.h'
- '**.c'
Expand All @@ -40,7 +41,11 @@ on:

jobs:
test:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
Expand All @@ -50,16 +55,34 @@ jobs:
- name: Add local NuGet repository
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"

- name: Install OpenSSL and link for macOS
if: matrix.os == 'macos-latest'
run: |
brew install openssl
sudo mkdir /usr/local/lib
sudo ln -s $(brew --prefix)/opt/openssl@3/lib/libcrypto.3.dylib /usr/local/lib/libcrypto.3.dylib
sudo ln -s $(brew --prefix)/opt/openssl@3/lib/libssl.3.dylib /usr/local/lib/libssl.3.dylib
- name: Install PCSC and link libUdev for Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update && sudo apt-get install pcscd -yq
sudo ln -s /usr/lib/x86_64-linux-gnu/libudev.so.1 /usr/lib/libudev.so
- name: Restore dotnet dependencies
run: |
dotnet restore
- name: Test Yubico.YubiKey
run: dotnet test --configuration Release --nologo --logger trx --collect:"XPlat Code Coverage" Yubico.YubiKey/tests/unit/Yubico.YubiKey.UnitTests.csproj --settings coverlet.runsettings.xml
run: dotnet test --no-restore --nologo --logger trx --collect:"XPlat Code Coverage" Yubico.YubiKey/tests/unit/Yubico.YubiKey.UnitTests.csproj --settings coverlet.runsettings.xml

- name: Test Yubico.Core
run: dotnet test --configuration Release --nologo --logger trx --collect:"XPlat Code Coverage" Yubico.Core/tests/Yubico.Core.UnitTests.csproj --settings coverlet.runsettings.xml
run: dotnet test --no-restore --nologo --logger trx --collect:"XPlat Code Coverage" Yubico.Core/tests/Yubico.Core.UnitTests.csproj --settings coverlet.runsettings.xml

- name: Upload Test Result Files
uses: actions/upload-artifact@v4
with:
name: TestResults
name: TestResults-${{ matrix.os }}
if-no-files-found: error
path: '**/TestResults/*'

Expand All @@ -68,9 +91,6 @@ jobs:
needs: test
steps:
- uses: actions/download-artifact@v4
with:
name: TestResults
path: ${{ github.workspace }}

- name: Combine Coverage Reports # This is because one report is produced per project, and we want one result for all of them.
uses: danielpalme/[email protected]
Expand Down Expand Up @@ -110,6 +130,7 @@ jobs:
contents: read
checks: write
needs: coverage
if: github.event_name == 'pull_request'
steps:
- name: Download coverage results
uses: actions/download-artifact@v4
Expand All @@ -121,7 +142,6 @@ jobs:

- name: Add Coverage PR Comment
uses: marocchino/[email protected]
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
Expand All @@ -133,12 +153,14 @@ jobs:
contents: read
checks: write
needs: test
if: github.event_name == 'pull_request'
steps:
- uses: actions/download-artifact@v4

- name: run ls recursively
run: ls -R

- name: Add Test Results PR Comment
uses: EnricoMi/[email protected]
if: always()
with:
trx_files: "${{ github.workspace }}/**/*.trx"

0 comments on commit 2fcfe60

Please sign in to comment.