Bump actions/upload-pages-artifact from 3 to 4 #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build-and-test | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: "9.0.x" | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore -c Release | |
| - name: Test | |
| run: dotnet test --no-build -c Release --collect:"XPlat Code Coverage" --logger "trx;LogFileName=test-results.trx" | |
| env: | |
| ALLURE_RESULTS_DIRECTORY: tests/PlcLab.Web.Tests/allure-results | |
| - name: Collect coverage artifacts | |
| shell: bash | |
| run: | | |
| mkdir -p coverage | |
| find . -path "*TestResults*" -name "coverage.cobertura.xml" -print -exec cp {} coverage/ \; || true | |
| if [ "$(ls -A coverage 2>/dev/null)" = "" ]; then | |
| echo "No coverage files found" > coverage/NO_COVERAGE.txt | |
| fi | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: coverage-cobertura | |
| path: coverage | |
| - name: Publish Web App | |
| run: dotnet publish src/PlcLab.Web -c Release -o out |