name: Testing on: [push, pull_request] jobs: tests: runs-on: ubuntu-latest if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository container: mcr.microsoft.com/dotnet/sdk:5.0 services: postgres: image: postgres env: POSTGRES_PASSWORD: postgres options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v2 - name: Restore dependencies run: dotnet restore - name: Build run: | dotnet build --no-restore '-p:SkipWebApp=true;SkipTranscoder=true' -p:CopyLocalLockFileAssemblies=true cp ./Kyoo.Abstractions/bin/Debug/net5.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll ./tests/Kyoo.Tests/bin/Debug/net5.0/ - name: Test run: dotnet test --no-build '-p:CollectCoverage=true;CoverletOutputFormat=opencover' env: POSTGRES_HOST: postgres POSTGRES_USERNAME: postgres POSTGRES_PASSWORD: postgres - name: Sanitize coverage output if: ${{ always() }} run: sed -i "s'$(pwd)'.'" tests/Kyoo.Tests/coverage.opencover.xml - name: Upload coverage report if: ${{ always() }} uses: actions/upload-artifact@v2 with: name: coverage.xml path: "**/coverage.opencover.xml"