-
Notifications
You must be signed in to change notification settings - Fork 7
55 lines (55 loc) · 1.7 KB
/
build-and-dockerize.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Build .NET
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
ConnectionStrings__BoilerplateConnectionString: "Host=localhost;Database=testdb;Username=postgres;Password=postgres"
jobs:
build:
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:17-alpine
ports:
- 5432:5432
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: testdb
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
azurite:
image: mcr.microsoft.com/azure-storage/azurite
ports:
- 10000:10000
- 10001:10001
- 10002:10002
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
dotnet-quality: 'preview'
- 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 --startup-project BervProject.WebApi.Boilerplate --project BervProject.WebApi.Boilerplate
- 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