From fc049a962298a6fa004a89b1e99a3ab06ccd4eef Mon Sep 17 00:00:00 2001 From: Jordan Fiset Date: Sat, 23 Nov 2024 16:50:50 -0500 Subject: [PATCH] Combined build and test since with need to build before testing --- .github/workflows/dotnet.yml | 9 +- .github/workflows/release.yml | 10 +- .../workflows/workflow-build-and-tests.yml | 93 +++++++++++++++++++ 3 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/workflow-build-and-tests.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 064b77b..7de5a54 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -10,11 +10,6 @@ on: branches: [ "master" ] jobs: - build: - uses: ./.github/workflows/workflow-build.yml - - tests: - uses: ./.github/workflows/workflow-tests.yml + build-and-test: + uses: ./.github/workflows/workflow-build-and-test.yml - e2e-tests: - uses: ./.github/workflows/workflow-e2e-tests.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c07c5c..da2c24a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,14 +11,8 @@ permissions: contents: write jobs: - build: - uses: ./.github/workflows/workflow-build.yml - - tests: - uses: ./.github/workflows/workflow-tests.yml - - e2e-tests: - uses: ./.github/workflows/workflow-e2e-tests.yml + build-and-test: + uses: ./.github/workflows/workflow-build-and-test.yml publish: name: Publish and package diff --git a/.github/workflows/workflow-build-and-tests.yml b/.github/workflows/workflow-build-and-tests.yml new file mode 100644 index 0000000..3e2cca7 --- /dev/null +++ b/.github/workflows/workflow-build-and-tests.yml @@ -0,0 +1,93 @@ +name: .Build and Tests + +on: + workflow_call: + +jobs: + build: + name: .Build the entire solution + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - name: Restore .NET dependencies + working-directory: ./src + run: dotnet restore + + - name: Build + working-directory: ./src + run: dotnet build --no-restore + + - name: Upload Build Artifact + uses: actions/upload-artifact@v4 + with: + name: buildArtifact + path: ./src + retention-days: 7 + + tests: + name: .Run Unit Tests + runs-on: ubuntu-latest + needs: build + + steps: + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - uses: actions/download-artifact@v4 + with: + name: buildArtifact + path: ./src + + - name: Test + working-directory: ./src/NodeDev.Tests + run: dotnet test --no-build --verbosity normal + + e2e-tests: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 9.0.x + + - uses: actions/download-artifact@master + with: + name: buildArtifact + path: ./src + + - name: Build Necessary for Playwright + working-directory: ./src/NodeDev.EndToEndTests + run: dotnet build + + - name: Allow run + run: chmod -R +x ./src/NodeDev.Blazor.Server/bin + + - name: Ensure browsers are installed + run: pwsh ./src/NodeDev.EndToEndTests/bin/Debug/net9.0/playwright.ps1 install --with-deps + + - name: Test + env: + HEADLESS: true + working-directory: ./src/NodeDev.EndToEndTests + run: dotnet test --no-build --verbosity normal + + - name: Upload std Artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: logServer + path: ./src/NodeDev.Blazor.Server/logs + retention-days: 7 \ No newline at end of file