Skip to content

Commit

Permalink
Only run tests when the runner CPU architecture is the same as the ar…
Browse files Browse the repository at this point in the history
…tifact architecture, because you can't run ARM programs on x86_64 Linux.
  • Loading branch information
Aldaviva committed Jun 19, 2024
1 parent b7bee94 commit 118e0dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ jobs:
include:
- os: ubuntu-latest
targetPlatform: linux-x64
skipTests: false
- os: ubuntu-latest
targetPlatform: linux-arm
skipTests: true
- os: ubuntu-latest
targetPlatform: linux-arm64
skipTests: true
- os: windows-latest
targetPlatform: win-x64
skipTests: false

runs-on: ${{ matrix.os }}

Expand All @@ -30,6 +34,7 @@ jobs:

- name: Initialize test reporting
uses: testspace-com/setup-testspace@v1
if: ${{ !matrix.skipTests }}
with:
domain: ${{github.repository_owner}}

Expand All @@ -44,24 +49,28 @@ jobs:

- name: Test
shell: bash
if: ${{ !matrix.skipTests }}
run: |
testExitCode=0
dotnet test --runtime ${{ matrix.targetPlatform }} --verbosity normal --configuration Release --collect:"XPlat Code Coverage" --settings Tests/Tests.runsettings --logger "trx;LogFileName=TestResults.xml" || testExitCode=$?
dotnet test --runtime ${{ matrix.targetPlatform }} --configuration Release --collect:"XPlat Code Coverage" --settings Tests/Tests.runsettings --logger "trx;LogFileName=TestResults.xml" || testExitCode=$?
echo "TEST_EXIT_CODE=$testExitCode" >> $GITHUB_ENV
cp Tests/TestResults/*/coverage.info Tests/TestResults
exit 0
- name: Upload test report
if: ${{ !matrix.skipTests }}
run: testspace Tests/TestResults/TestResults.xml

- name: Upload coverage report
if: ${{ !matrix.skipTests }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: Tests/TestResults/coverage.info
format: lcov

- name: Stop if tests failed
if: ${{ !matrix.skipTests }}
run: exit ${{ env.TEST_EXIT_CODE }}

- name: Upload build artifacts
Expand Down

0 comments on commit 118e0dd

Please sign in to comment.