diff --git a/.github/workflows/gate.yml b/.github/workflows/gate.yml index d5200d63..1816acd9 100644 --- a/.github/workflows/gate.yml +++ b/.github/workflows/gate.yml @@ -8,216 +8,136 @@ on: branches: [ main ] jobs: - win: - - runs-on: windows-latest - - permissions: - checks: write - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 3.1.x - - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test (4.8) - run: dotnet test --no-restore --verbosity normal -f net48 --logger "trx;LogFileName=results4.trx" - - name: Upload test results (4.8) - uses: actions/upload-artifact@v4 # upload test results - if: success() || failure() # run this step even if previous step failed - with: - name: test-results-win48 - path: BitFaster.Caching.UnitTests/TestResults/results4.trx - - - name: Test (3.1) - run: dotnet test --no-restore --verbosity normal -f netcoreapp3.1 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results3.trx" - - name: Upload test results (3.1) - uses: actions/upload-artifact@v4 # upload test results - if: success() || failure() # run this step even if previous step failed - with: - name: test-results-win3 - path: BitFaster.Caching.UnitTests/TestResults/results3.trx - - name: Publish coverage report to coveralls.io (3.1) - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.netcoreapp3.1.info - flag-name: win3 - parallel: true - - - name: Publish NuGet artifacts - uses: actions/upload-artifact@v4 - with: - name: NuGet package - path: BitFaster.Caching/bin/Release/ - win2: - - runs-on: windows-latest - - permissions: - checks: write - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - 9.0.x - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore - - - name: Test (6.0) - run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results6.trx" - - name: Upload test results (6.0) - uses: actions/upload-artifact@v4 # upload test results - if: success() || failure() # run this step even if previous step failed - with: - name: test-results-win6 - path: BitFaster.Caching.UnitTests/TestResults/results6.trx - - name: Upload test results (6.0 .NET Std) - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test-results-win6-std - path: BitFaster.Caching.UnitTests.Std/TestResults/results6.trx - - - name: Publish coverage report to coveralls.io (6.0) - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info - flag-name: win6 - parallel: true - - - name: Test (9.0) - run: dotnet test --no-restore --verbosity normal -f net9.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results9.trx" - - name: Upload test results (9.0) - uses: actions/upload-artifact@v4 # upload test results - if: success() || failure() # run this step even if previous step failed - with: - name: test-results-win9 - path: BitFaster.Caching.UnitTests/TestResults/results9.trx - - name: Upload test results (9.0 .NET Std) - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test-results-win9-std - path: BitFaster.Caching.UnitTests.Std/TestResults/results9.trx - - - name: Publish coverage report to coveralls.io (9.0) - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net9.0.info - flag-name: win9 - parallel: true - - mac: - - runs-on: macos-latest - - permissions: - checks: write - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - 9.0.x - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore - - name: Test - run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results.trx" - - name: Publish coverage report to coveralls.io - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info - flag-name: mac - parallel: true - - name: Upload test results (6.0) - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test-results-mac - path: BitFaster.Caching.UnitTests/TestResults/results.trx - - name: Upload test results (6.0 .NET Std) - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test-results-mac-std - path: BitFaster.Caching.UnitTests.Std/TestResults/results.trx - - linux: - - runs-on: ubuntu-latest - + build: + name: ${{ matrix.framework }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} permissions: checks: write + continue-on-error: true + strategy: + matrix: + include: + # Windows + - os: windows-latest + framework: net48 + coverage: false + results: results4.trx + artifact: test-results-win48 + std: false + flag: net48 + publish_nuget: true + + - os: windows-latest + framework: netcoreapp3.1 + coverage: true + results: results3.trx + artifact: test-results-win3 + std: false + flag: win3 + publish_nuget: false + + - os: windows-latest + framework: net6.0 + coverage: true + results: results6.trx + artifact: test-results-win6 + std: true + flag: win6 + publish_nuget: false + + - os: windows-latest + framework: net9.0 + coverage: true + results: results9.trx + artifact: test-results-win9 + std: true + flag: win9 + publish_nuget: false + + # macOS + - os: macos-latest + framework: net6.0 + coverage: true + results: results.trx + artifact: test-results-mac + std: true + flag: mac + publish_nuget: false + + # Linux + - os: ubuntu-latest + framework: net6.0 + coverage: true + results: results.trx + artifact: test-results-linux + std: true + flag: linux + publish_nuget: false steps: - - uses: actions/checkout@v4 - - name: Setup .NET Core - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 6.0.x - 8.0.x - 9.0.x - - name: Install dependencies - run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore - - name: Test - run: dotnet test --no-restore --verbosity normal -f net6.0 /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov --logger "trx;LogFileName=results.trx" - - name: Publish coverage report to coveralls.io - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.net6.0.info - flag-name: linux - parallel: true - - name: Upload test results (6.0) - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test-results-linux - path: BitFaster.Caching.UnitTests/TestResults/results.trx - - name: Upload test results (6.0 .NET Std) - uses: actions/upload-artifact@v4 - if: success() || failure() - with: - name: test-results-linux-std - path: BitFaster.Caching.UnitTests.Std/TestResults/results.trx + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 3.1.x + 6.0.x + 8.0.x + 9.0.x + + - name: Install dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Test + run: | + dotnet test --no-restore --verbosity normal -f ${{ matrix.framework }} \ + ${{ matrix.coverage && '-p:CollectCoverage=true' || '' }} \ + ${{ matrix.coverage && '-p:CoverletOutput=TestResults/' || '' }} \ + ${{ matrix.coverage && '-p:CoverletOutputFormat=lcov' || '' }} \ + --logger "trx;LogFileName=${{ matrix.results }}" + shell: bash + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: success() || failure() + with: + name: ${{ matrix.artifact }} + path: BitFaster.Caching.UnitTests/TestResults/${{ matrix.results }} + + - name: Upload test results (.NET Std) + if: ${{ matrix.std }} + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact }}-std + path: BitFaster.Caching.UnitTests.Std/TestResults/${{ matrix.results }} + + - name: Publish coverage report to coveralls.io + if: ${{ matrix.coverage && matrix.flag != '' }} + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: BitFaster.Caching.UnitTests/TestResults/coverage.${{ matrix.framework }}.info + flag-name: ${{ matrix.flag }} + parallel: true + + - name: Publish NuGet artifacts + if: ${{ matrix.publish_nuget }} + uses: actions/upload-artifact@v4 + with: + name: NuGet package + path: BitFaster.Caching/bin/Release/ coverage: - - needs: [win, win2, mac, linux] - + name: Coveralls Finished + needs: build runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true \ No newline at end of file + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true \ No newline at end of file