Upgrade Umbraco to v13.5 and update remaining vulnerable packages. Cl… #221
This file contains 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: "Tests" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: | |
- main | |
jobs: | |
stoolball-web-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Restore npm dependencies | |
run: npm ci | |
- name: Restore NuGet dependencies | |
run: dotnet restore ./Stoolball.Web.UnitTests/Stoolball.Web.UnitTests.csproj | |
- name: Build unit tests | |
run: dotnet build --no-restore ./Stoolball.Web.UnitTests/Stoolball.Web.UnitTests.csproj | |
- name: Run Stoolball.Web.UnitTests | |
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Web.UnitTests/coverlet.runsettings ./Stoolball.Web.UnitTests/Stoolball.Web.UnitTests.csproj | |
- name: Move coverage to root | |
shell: pwsh | |
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./web-unit-tests.cobertura.xml } | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: stoolball-web-unit-tests | |
path: web-unit-tests.cobertura.xml | |
stoolball-web-js-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Restore npm dependencies | |
run: npm ci | |
- name: Run Jest | |
run: npx jest --collect-coverage | |
- name: Move coverage to root | |
shell: pwsh | |
run: Get-ChildItem -Recurse cobertura-coverage.xml | ForEach-Object { Move-Item $_.FullName ./web-js-tests.cobertura.xml } | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: stoolball-web-js-tests | |
path: web-js-tests.cobertura.xml | |
stoolball-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Restore dependencies | |
run: dotnet restore ./Stoolball.UnitTests/Stoolball.UnitTests.csproj | |
- name: Build unit tests | |
run: dotnet build --no-restore ./Stoolball.UnitTests/Stoolball.UnitTests.csproj | |
- name: Run Stoolball.UnitTests | |
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.UnitTests/coverlet.runsettings ./Stoolball.UnitTests/Stoolball.UnitTests.csproj | |
- name: Move coverage to root | |
shell: pwsh | |
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./unit-tests.cobertura.xml } | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: stoolball-unit-tests | |
path: unit-tests.cobertura.xml | |
stoolball-cache-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Restore dependencies | |
run: dotnet restore ./Stoolball.Data.MemoryCache.UnitTests/Stoolball.Data.MemoryCache.UnitTests.csproj | |
- name: Build unit tests | |
run: dotnet build --no-restore ./Stoolball.Data.MemoryCache.UnitTests/Stoolball.Data.MemoryCache.UnitTests.csproj | |
- name: Run Stoolball.Data.MemoryCache.UnitTests | |
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Data.MemoryCache.UnitTests/coverlet.runsettings ./Stoolball.Data.MemoryCache.UnitTests/Stoolball.Data.MemoryCache.UnitTests.csproj | |
- name: Move coverage to root | |
shell: pwsh | |
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./cache-unit-tests.cobertura.xml } | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: stoolball-cache-unit-tests | |
path: cache-unit-tests.cobertura.xml | |
stoolball-sql-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Restore dependencies | |
run: dotnet restore ./Stoolball.Data.SqlServer.UnitTests/Stoolball.Data.SqlServer.UnitTests.csproj | |
- name: Build unit tests | |
run: dotnet build --no-restore ./Stoolball.Data.SqlServer.UnitTests/Stoolball.Data.SqlServer.UnitTests.csproj | |
- name: Run Stoolball.Data.SqlServer.UnitTests | |
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Data.SqlServer.UnitTests/coverlet.runsettings ./Stoolball.Data.SqlServer.UnitTests/Stoolball.Data.SqlServer.UnitTests.csproj | |
- name: Move coverage to root | |
shell: pwsh | |
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./sql-unit-tests.cobertura.xml } | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: stoolball-sql-unit-tests | |
path: sql-unit-tests.cobertura.xml | |
stoolball-integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run SQL Server | |
env: | |
SA_PASSWORD: ${{ secrets.SQL_SERVER_PASSWORD }} | |
run: | | |
docker run --name "integration-tests-sql" -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=${{ env.SA_PASSWORD }}" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Restore dependencies | |
run: dotnet restore ./Stoolball.Data.SqlServer.IntegrationTests/Stoolball.Data.SqlServer.IntegrationTests.csproj | |
- name: Build integration tests | |
run: dotnet build --no-restore ./Stoolball.Data.SqlServer.IntegrationTests/Stoolball.Data.SqlServer.IntegrationTests.csproj | |
- name: Run integration tests | |
env: | |
SQL_SERVER_USERNAME: ${{ secrets.SQL_SERVER_USERNAME }} | |
SQL_SERVER_PASSWORD: ${{ secrets.SQL_SERVER_PASSWORD }} | |
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --settings ./Stoolball.Data.SqlServer.IntegrationTests/coverlet.runsettings ./Stoolball.Data.SqlServer.IntegrationTests/Stoolball.Data.SqlServer.IntegrationTests.csproj | |
- name: Move coverage to root | |
shell: pwsh | |
run: Get-ChildItem -Recurse coverage.cobertura.xml | ForEach-Object { Move-Item $_.FullName ./integration-tests.cobertura.xml } | |
- name: Upload test results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: stoolball-integration-tests | |
path: integration-tests.cobertura.xml | |
publish-to-codacy: | |
runs-on: ubuntu-latest | |
needs: [stoolball-web-unit-tests, stoolball-unit-tests, stoolball-integration-tests, stoolball-web-js-tests, stoolball-sql-unit-tests] | |
steps: | |
- name: Download Stoolball.Web.UnitTests results | |
uses: actions/download-artifact@v2 | |
with: | |
name: stoolball-web-unit-tests | |
- name: Download Stoolball.UnitTests results | |
uses: actions/download-artifact@v2 | |
with: | |
name: stoolball-unit-tests | |
- name: Download Stoolball.Data.SqlServer.UnitTests results | |
uses: actions/download-artifact@v2 | |
with: | |
name: stoolball-sql-unit-tests | |
- name: Download Stoolball.Data.MemoryCache.UnitTests results | |
uses: actions/download-artifact@v2 | |
with: | |
name: stoolball-cache-unit-tests | |
- name: Download Stoolball.Data.SqlServer.IntegrationTests results | |
uses: actions/download-artifact@v2 | |
with: | |
name: stoolball-integration-tests | |
- name: Download Jest results | |
uses: actions/download-artifact@v2 | |
with: | |
name: stoolball-web-js-tests | |
- name: Run codacy-coverage-reporter | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
with: | |
project-token: ${{ env.CODACY_PROJECT_TOKEN }} | |
coverage-reports: unit-tests.cobertura.xml,integration-tests.cobertura.xml,web-unit-tests.cobertura.xml,web-js-tests.cobertura.xml,sql-unit-tests.cobertura.xml,cache-unit-tests.cobertura.xml |