From accdd036e76b858e99201026361c5a3a198adaa2 Mon Sep 17 00:00:00 2001 From: Romfos Date: Sun, 8 Oct 2023 23:16:58 +0200 Subject: [PATCH] Update build_and_test.yml --- .github/workflows/build_and_test.yml | 47 +++++++++++++++++++++------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0f628f23..99d78aaa 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -3,6 +3,30 @@ name: Build and Test on: [push, pull_request] jobs: build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Save build to cache + - uses: actions/cache/save@v3 + id: cache + with: + path: ./tests/NSubstitute.Acceptance.Specs/bin + key: ${{github.run_number}} + + test: strategy: matrix: os: [windows-latest, ubuntu-latest, macOS-latest] @@ -12,21 +36,22 @@ jobs: tfm: net462 runs-on: ${{ matrix.os }} + needs: [build] steps: - - uses: actions/checkout@v3 - + - name: Checkout + uses: actions/checkout@v3 + - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: | - 6.0.x - 7.0.x - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore + dotnet-version: 6.0.x + + - uses: actions/cache/restore@v3 + id: cache + with: + path: ./tests/NSubstitute.Acceptance.Specs/bin + key: ${{github.run_number}} - name: Test run: dotnet test -f ${{ matrix.tfm }} --no-build --no-restore +