Repository navigation
105 lines (85 loc) · 2.99 KB
/
Copy pathci.yml
File metadata and controls
105 lines (85 loc) · 2.99 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI
on:
push:
branches: [main, develop]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore src/Taskist.sln
- name: Build
run: dotnet build src/Taskist.sln --configuration Release --no-restore
- name: Test
run: dotnet test src/Taskist.sln --configuration Release --no-build --logger "trx;LogFileName=results.trx"
- name: Check the generated dark theme is up to date
run: |
python3 tools/theme/generate-dark-css.py
git diff --exit-code -- src/Presentation/Taskist.Web/wwwroot/css/theme-dark.generated.css || { echo "::error::theme-dark.generated.css is stale. Run 'python tools/theme/generate-dark-css.py' and commit the result."; exit 1; }
- name: Check for missing migrations
run: |
dotnet tool install --global dotnet-ef --version 10.*
dotnet ef migrations has-pending-model-changes \
--project src/Libraries/Taskist.Data \
--startup-project src/Libraries/Taskist.Data \
--configuration Release \
--no-build
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: "**/TestResults/*.trx"
if-no-files-found: ignore
docker:
name: Docker stack smoke test
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v7
- name: Create .env
run: |
cp .env.example .env
sed -i "s/^MSSQL_SA_PASSWORD=.*/MSSQL_SA_PASSWORD=Ci_$(openssl rand -hex 12)Aa1!/" .env
- name: Build and start
run: docker compose up -d --build
- name: Wait for the web container to become healthy
run: |
for attempt in $(seq 1 120); do
migrate="$(docker compose ps -a --format '{{.State}} {{.ExitCode}}' migrate)"
case "$migrate" in
exited\ 0|"") ;;
exited*) echo "migrate failed: $migrate"; exit 1 ;;
esac
web="$(docker compose ps -q web)"
if [ -n "$web" ] && [ "$(docker inspect -f '{{.State.Health.Status}}' "$web")" = "healthy" ]; then
echo "web is healthy"; exit 0
fi
sleep 5
done
echo "timed out waiting for web"; exit 1
- name: Sign-in page responds
run: curl -fsS http://localhost:8080/login -o /dev/null
- name: Seeding is repeatable
run: docker compose run --rm migrate
- name: Logs
if: failure()
run: docker compose logs
- name: Tear down
if: always()
run: docker compose down -v