build(deps): Bump Npgsql.EntityFrameworkCore.PostgreSQL from 8.0.10 to 9.0.1 #791
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: Dotnet | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- v* | |
pull_request: | |
branches: [ main ] | |
env: | |
IMAGE_NAME: personalwebapi | |
ConnectionStrings__Default: "Host=localhost;Database=personalwebapi_test;Username=postgres;Password=testpass123" | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
services: | |
psql: | |
image: postgres:15-alpine | |
env: | |
POSTGRES_PASSWORD: testpass123 | |
POSTGRES_DB: personalwebapi_test | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "8.0.x" | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Migrate DB | |
run: | | |
dotnet tool install --global dotnet-ef | |
dotnet tool restore | |
dotnet ef database update --project PersonalWebApi | |
- name: Test | |
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal --collect:"XPlat Code Coverage" | |
- name: Report Codecov | |
uses: codecov/codecov-action@v5 | |
build-docker-test: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'pull_request' | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Image | |
run: docker build . -t $IMAGE_NAME | |
build-push-docker: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
bervproject/${{ env.IMAGE_NAME }} | |
ghcr.io/${{ github.repository }} | |
env: | |
IMAGE_NAME: 'PersonalWebApi' | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |