-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (145 loc) · 4.75 KB
/
Copy pathci.yml
File metadata and controls
173 lines (145 loc) · 4.75 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
backend:
name: Backend (Kotlin/Spring Boot)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x backend/gradlew
- name: Build and test
run: cd backend && ./gradlew build --no-daemon
env:
JWT_SECRET: ci-test-jwt-secret-not-used-in-production-placeholder
ENCRYPTION_KEY: ci-test-encryption-key-placeholder
- name: Upload test reports
uses: actions/upload-artifact@v4
if: always()
with:
name: backend-test-report
path: backend/build/reports/tests/test/
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: backend-coverage-report
path: backend/build/reports/jacoco/test/
frontend:
name: Frontend (Vue 3/TypeScript)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: cd frontend && npm ci
- name: Lint
run: cd frontend && npm run lint
- name: Build
run: cd frontend && npm run build
- name: Test
run: cd frontend && npm test -- --run
cli:
name: CLI (Go)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: cli/go.mod
cache-dependency-path: cli/go.sum
- name: Build
run: cd cli && go build ./...
- name: Test
run: cd cli && go test ./...
- name: Vet
run: cd cli && go vet ./...
# ── Docker build & push ────────────────────────────────────────────────────
# Runs only on push to main (not on PRs). Depends on all three test jobs
# so images are never pushed when tests are failing.
docker:
name: Docker – Build & Push Images
runs-on: ubuntu-latest
needs: [ backend, frontend, cli ]
if: github.event_name == 'push'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata for backend
id: meta-backend
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/backend
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push backend image
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ${{ steps.meta-backend.outputs.tags }}
labels: ${{ steps.meta-backend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract metadata for frontend
id: meta-frontend
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/frontend
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push frontend image
uses: docker/build-push-action@v5
with:
context: ./frontend
push: true
tags: ${{ steps.meta-frontend.outputs.tags }}
labels: ${{ steps.meta-frontend.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Extract metadata for CLI
id: meta-cli
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/cli
tags: |
type=sha,prefix=
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push CLI image
uses: docker/build-push-action@v5
with:
context: ./cli
push: true
tags: ${{ steps.meta-cli.outputs.tags }}
labels: ${{ steps.meta-cli.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max