-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (95 loc) · 2.82 KB
/
Copy pathci.yml
File metadata and controls
112 lines (95 loc) · 2.82 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
106
107
108
109
110
111
112
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test-api:
name: Go tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
cache-dependency-path: api/go.sum
- name: Run tests
run: cd api && go test ./... -v -race
test-web:
name: Frontend tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install dependencies
run: cd web && npm ci
- name: Run tests
run: cd web && npm test
- name: Build
run: cd web && npm run build
test-e2e:
name: E2E tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run E2E tests
run: make test-e2e
- name: Upload report
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: e2e/playwright-report/
retention-days: 7
publish:
name: Publish Docker images
needs: [test-api, test-web, test-e2e]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images
run: touch .env && IMAGE_TAG=latest docker compose build --build-arg COMMIT_SHA=${{ github.sha }} api web worker && IMAGE_TAG=latest docker compose push api web worker
env:
POSTGRES_USER: build
POSTGRES_PASSWORD: build
JWT_SECRET: build
MINIO_ROOT_USER: build
MINIO_ROOT_PASSWORD: build
smoke-test:
name: Smoke test
needs: publish
runs-on: ubuntu-latest
steps:
- name: Wait for new version deployment
run: |
for i in $(seq 1 30); do
COMMIT=$(curl -sf ${{ secrets.STAGING_URL }}/healthz | jq -r '.commit // empty')
if [ "$COMMIT" = "${{ github.sha }}" ]; then
echo "New version deployed: $COMMIT"
# Verify readiness too
curl -sf ${{ secrets.STAGING_URL }}/readyz > /dev/null
echo "Readiness check passed"
exit 0
fi
echo "Attempt $i/30 - got '$COMMIT', waiting for ${{ github.sha }}..."
sleep 10
done
echo "New version not deployed after 300s"
exit 1