From 2dd3d905b3f38c7c567c9e20b912066172d4f542 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 3 Jan 2024 15:18:40 -0800 Subject: [PATCH] Unit test matrix --- .github/actions/test/action.yml | 8 ++++---- .github/workflows/build.yml | 32 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 456911107..db738f7ac 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -4,6 +4,9 @@ name: Run test on DLLs matching the specified pattern description: Runs unit/integration tests inputs: + platform: + description: 'OS platform that the tests are running on' + required: true artifact: description: 'Test binary artifact' required: true @@ -26,11 +29,8 @@ runs: name: ${{ inputs.artifact }} path: _tests - - name: List all files - shell: bash - run: ls -la ./_tests - - name: Make executable + if: ${{ inputs.platform }} shell: bash run: chmod +x ./_tests/Sonarr.Test.Dummy && chmod +x ./_tests/ffprobe diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a876e8799..98aa99217 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: with: runtime: osx-x64 - # Build Artifacts + # Build Artifact (since GitHub limits the number of artifacts) - name: Publish Backend Artifact uses: actions/upload-artifact@v4 @@ -68,14 +68,6 @@ jobs: name: backend path: _artifacts/**/* - # Distribution Artifact - - # - name: Publish Distribution Artifact - # uses: actions/upload-artifact@v4 - # with: - # name: distribution - # path: distribution/**/* - frontend: runs-on: ubuntu-latest steps: @@ -103,9 +95,22 @@ jobs: name: ui path: _output/UI/**/* - unit_test_linux: + unit_test: needs: backend - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + artifact: tests-linux-x64 + filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest + - os: macos-latest + artifact: tests-osx-x64 + filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest + - os: windows-latest + artifact: tests-win-x64 + filter: TestCategory!=ManualTest&TestCategory!=LINUX&TestCategory!=IntegrationTest&TestCategory!=AutomationTest + runs-on: ${{ matrix.os }} steps: - name: Check out uses: actions/checkout@v3 @@ -113,6 +118,7 @@ jobs: - name: Test uses: ./.github/actions/test with: - artifact: tests-linux-x64 + platform: ${{ matrix.os }} + artifact: ${{ matrix.artifact }} pattern: Sonarr.*.Test.dll - filter: TestCategory!=ManualTest&TestCategory!=WINDOWS&TestCategory!=IntegrationTest&TestCategory!=AutomationTest + filter: ${{ matrix.filter }}