Add package caching to avoid double-build. #2424
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: postgres | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| db: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tag: [14, 15, 16, 17, 18, latest] | |
| services: | |
| postgres: | |
| image: postgres:${{ matrix.tag }} | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: nuget-${{ runner.os }}-${{ hashFiles('src/Directory.Packages.props') }} | |
| restore-keys: nuget-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: dotnet restore | |
| working-directory: src/SJP.Schematic.PostgreSql.Tests | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| working-directory: src/SJP.Schematic.PostgreSql.Tests | |
| - name: Test | |
| run: dotnet test --configuration Release --no-build --no-restore --verbosity normal -- --coverage --coverage-settings ${{ github.workspace }}/src/coverage.settings.xml --coverage-output-format cobertura --coverage-output coverage.cobertura.xml | |
| working-directory: src/SJP.Schematic.PostgreSql.Tests | |
| env: | |
| ConnectionStrings__PostgreSql_TestDb: Server=localhost; Port=5432; Database=postgres; User Id=postgres; Password=postgres; Timeout=2 | |
| - name: Coverage | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} |