-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
169 lines (148 loc) · 4.83 KB
/
.gitlab-ci.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
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
variables:
GIT_LFS_SKIP_SMUDGE: "1"
stages:
- setup
- check
- test
- build
- deploy
- notify
.setup:
npmci: nix-shell $CI_PROJECT_DIR/shell.nix --run "npm ci --cache $CI_PROJECT_DIR/.npm --prefer-offline"
npmcheck: nix-shell $CI_PROJECT_DIR/shell.nix --run "npm run check"
buninstall: nix-shell $CI_PROJECT_DIR/shell.nix --run "bun install"
buncheck: nix-shell $CI_PROJECT_DIR/shell.nix --run "bun run check"
buntest: nix-shell $CI_PROJECT_DIR/shell.nix --run "bun run test"
default:
image: nixos/nix:2.19.2
# ____ _ _ _____ ____ _ __
# / ___| | | | ____/ ___| |/ /
# | | | |_| | _|| | | ' /
# | |___| _ | |__| |___| . \
# \____|_| |_|_____\____|_|\_\
check-gateway:
stage: check
script:
- cd $CI_PROJECT_DIR/services/gateway
- !reference [.setup, buninstall]
- !reference [.setup, buncheck]
cache:
key:
files:
- $CI_PROJECT_DIR/services/gateway/package-lock.json
paths:
- $CI_PROJECT_DIR/.npm
check-web:
stage: check
script:
- cd $CI_PROJECT_DIR/apps/web
- !reference [.setup, npmci]
- !reference [.setup, npmcheck]
cache:
key:
files:
- $CI_PROJECT_DIR/apps/web/package-lock.json
paths:
- $CI_PROJECT_DIR/.npm
check-web-next:
stage: check
script:
- cd $CI_PROJECT_DIR/apps/web-next
- !reference [.setup, buninstall]
- !reference [.setup, buncheck]
cache:
key:
files:
- $CI_PROJECT_DIR/apps/web-next/package-lock.json
paths:
- $CI_PROJECT_DIR/.npm
check-scripts:
stage: check
script:
- cd $CI_PROJECT_DIR/scripts
- !reference [.setup, npmci]
- !reference [.setup, npmcheck]
cache:
key:
files:
- $CI_PROJECT_DIR/scripts/package-lock.json
paths:
- $CI_PROJECT_DIR/.npm
test-gateway:
stage: check
script:
- cd services/gateway
- !reference [.setup, buninstall]
- !reference [.setup, buntest]
cache: !reference [check-gateway, cache]
# ____ _ _ ___ _ ____
# | __ )| | | |_ _| | | _ \
# | _ \| | | || || | | | | |
# | |_) | |_| || || |___| |_| |
# |____/ \___/|___|_____|____/
.build-common: &build-common
image: docker:24.0.1
services:
- docker:24.0.1-dind
stage: build
only:
- kyrios
before_script:
- apk add --no-cache curl
- curl https://depot.dev/install-cli.sh | DEPOT_INSTALL_DIR=/usr/local/bin sh
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build-gateway:
<<: *build-common
script:
- cd services/gateway
- depot build --platform linux/amd64,linux/arm64 --target server -t registry.gitlab.com/letschurch/lets.church/gateway:${CI_COMMIT_SHORT_SHA} . --push
build-background-worker:
<<: *build-common
script:
- cd services/gateway
- depot build --platform linux/amd64,linux/arm64 --target background-worker -t registry.gitlab.com/letschurch/lets.church/background-worker:${CI_COMMIT_SHORT_SHA} . --push
build-probe-worker:
<<: *build-common
script:
- cd services/gateway
- depot build --platform linux/amd64,linux/arm64 --target probe-worker -t registry.gitlab.com/letschurch/lets.church/probe-worker:${CI_COMMIT_SHORT_SHA} . --push
build-import-worker:
<<: *build-common
script:
- cd services/gateway
- depot build --platform linux/amd64,linux/arm64 --target import-worker -t registry.gitlab.com/letschurch/lets.church/import-worker:${CI_COMMIT_SHORT_SHA} . --push
build-transcode-worker:
<<: *build-common
script:
- cd services/gateway
- depot build --platform linux/amd64,linux/arm64 --target transcode-worker -t registry.gitlab.com/letschurch/lets.church/transcode-worker:${CI_COMMIT_SHORT_SHA} . --push
build-transcribe-worker:
<<: *build-common
script:
- cd services/gateway
- depot build --platform linux/amd64,linux/arm64 --target transcribe-worker --build-arg WHISPER_MODEL=large-v2 -t registry.gitlab.com/letschurch/lets.church/transcribe-worker:${CI_COMMIT_SHORT_SHA} . --push
build-web:
<<: *build-common
script:
- cd apps/web
- depot build --platform linux/amd64,linux/arm64 -t registry.gitlab.com/letschurch/lets.church/web:${CI_COMMIT_SHORT_SHA} . --push
build-web-next:
<<: *build-common
script:
- cd apps/web-next
- depot build --platform linux/amd64,linux/arm64 -t registry.gitlab.com/letschurch/lets.church/web-next:${CI_COMMIT_SHORT_SHA} . --push
# ____ _
# | _ \ ___ _ __ | | ___ _ _
# | | | |/ _ \ '_ \| |/ _ \| | | |
# | |_| | __/ |_) | | (_) | |_| |
# |____/ \___| .__/|_|\___/ \__, |
# |_| |___/
deploy-k8s:
stage: deploy
only:
- kyrios
script:
- nix-shell shell.nix --run "transcrypt -F -y -c $TRANSCRYPT_CIPHER -p $TRANSCRYPT_PASSWORD"
- cd infra/k8s/prod
- nix-shell $CI_PROJECT_DIR/shell.nix --run "just deploy-set-images prod $CI_COMMIT_SHORT_SHA"
- nix-shell $CI_PROJECT_DIR/shell.nix --run 'kubectl apply -k .'