-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (186 loc) · 8.46 KB
/
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: CI
on:
push:
branches: "**"
pull_request:
tags:
- "**"
jobs:
build-docker:
name: Build with Docker
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Docker metadata - scheduled queues
id: meta-scheduled-queues
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-scheduled-queues
tags: |
type=ref,event=tag
type=sha,format=long
type=semver,pattern={{version}}
- name: Docker metadata - queues
id: meta-queues
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-queues
tags: |
type=ref,event=tag
type=sha,format=long
type=semver,pattern={{version}}
- name: Docker metadata - release
id: meta-release
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-release
tags: |
type=ref,event=tag
type=sha,format=long
type=semver,pattern={{version}}
- name: Docker metadata - web
id: meta-web
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=sha,format=long
type=semver,pattern={{version}}
- name: Build and push Docker image - web
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
target: web
tags: ${{ steps.meta-web.outputs.tags }}
labels: ${{ steps.meta-web.outputs.labels }}
- name: Build and push Docker image - release
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
target: release
tags: ${{ steps.meta-release.outputs.tags }}
labels: ${{ steps.meta-release.outputs.labels }}
- name: Build and push Docker image - queues
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
target: queues
tags: ${{ steps.meta-queues.outputs.tags }}
labels: ${{ steps.meta-queues.outputs.labels }}
- name: Build and push Docker image - scheduled queues
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
target: scheduled-queues
tags: ${{ steps.meta-scheduled-queues.outputs.tags }}
labels: ${{ steps.meta-scheduled-queues.outputs.labels }}
build-mac:
name: Build on Mac
runs-on: macos-12
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: "5.9"
- run: swift --version
- uses: actions/checkout@v3
- run: swift build -c release
test-linux:
name: Test on Ubuntu
runs-on: ubuntu-latest
services:
redis:
image: redis:latest
ports:
- 6379:6379
postgres:
image: postgres:latest
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: "postgresql://postgres:postgres@localhost/postgres"
DB_SYMMETRIC_KEY: "9/Vk5Rlzctc5tyX0SCmIJaRzEg+QgwWjlTzD0LMPqNY="
REDIS_URL: "red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jMm1XUjdBOVRUa0tkdWMrWVlaeFN2ZWdPMWpMeC9QbG1TUHdHcGF3c2NiYWxHYTgwbkRTNTU2SXUKR1l0S2ZnbkJGSXBFcU1FQkdBQ2MrUys2cTNBNU10emM4bHhzamRlYVlSWDdIbnJNejlVdzRROGNUUmkzUXVJNwpKdi93OEJnZFhRNnVMdGdSMTZLTzJQcVg2azRSSDdmY3BSL20vUEU1OEE9PQotLS0tLUVORCBFQyBQUklWQVRFIEtFWS0tLS0tCg=="
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: "5.9.1"
- run: swift --version
- uses: actions/checkout@v3
- run: swift run FQAuthServer migrate -y --env test
- run: swift test
test-mac:
name: Test on Mac
runs-on: macos-12
steps:
- run: |
brew services start postgresql
echo "Check PostgreSQL service is running"
i=10
COMMAND='pg_isready'
while [ $i -gt 0 ]; do
echo "Check PostgreSQL service status"
eval $COMMAND && break
((i--))
if [ $i == 0 ]; then
echo "PostgreSQL service not ready, all attempts exhausted"
exit 1
fi
echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i"
sleep 10
done
- run: |
psql --command="CREATE USER myuser PASSWORD 'mypassword'" --command="\du" postgres
- run: |
createdb --owner=myuser mydatabase
PGPASSWORD=mypassword psql --username=myuser --host=localhost --list mydatabase
- run: psql $DATABASE_URL -c "select version()"
- uses: swift-actions/setup-swift@v1
with:
swift-version: "5.9"
- run: swift --version
- uses: shogo82148/actions-setup-redis@v1
- uses: actions/checkout@v3
- run: swift run FQAuthServer migrate -y --env test
- run: swift test
env:
DATABASE_URL: "postgresql://myuser:mypassword@localhost/mydatabase"
DB_SYMMETRIC_KEY: "9/Vk5Rlzctc5tyX0SCmIJaRzEg+QgwWjlTzD0LMPqNY="
REDIS_URL: "redis://127.0.0.1:6379"
APPLE_SERVICES_KEY: "LS0tLS1CRUdJTiBFQyBQQVJBTUVURVJTLS0tLS0KQmdVcmdRUUFJdz09Ci0tLS0tRU5EIEVDIFBBUkFNRVRFUlMtLS0tLQotLS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