-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (144 loc) · 4.9 KB
/
cd.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
name: Push image to Docker hub and run e2e tests
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
check-prettify:
name: Check prettify
uses: ./.github/workflows/check-prettify.yml
run-docker-image-tests:
needs:
- check-prettify
name: Run docker image tests
uses: ./.github/workflows/ci.yml
push_to_registry:
needs:
- check-prettify
- run-docker-image-tests
name: Build & Push docker image to Docker Hub
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.JORE4_DOCKERHUB_USER }}
password: ${{ secrets.JORE4_DOCKERHUB_TOKEN }}
- name: Build and push dev builds to Docker Hub
run: |
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--target hasura-generic \
--cache-from type=registry,ref=$IMAGE_NAME:generic \
--tag $IMAGE_NAME:generic-$COMMIT_ID \
.
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--target hasura-hsl \
--cache-from type=registry,ref=$IMAGE_NAME:hsl \
--tag $IMAGE_NAME:hsl-$COMMIT_ID \
.
- name: Build and push :latest tag to Docker Hub
if: ${{ github.ref == 'refs/heads/main' }}
run: |
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--target hasura-generic \
--cache-to type=registry,ref=$IMAGE_NAME:generic,mode=max \
--tag $IMAGE_NAME:generic \
.
docker buildx build \
--push \
--platform linux/amd64,linux/arm64 \
--target hasura-hsl \
--cache-to type=registry,ref=$IMAGE_NAME:hsl,mode=max \
--tag $IMAGE_NAME:latest \
.
run_dump_tests:
needs:
- check-prettify
- run-docker-image-tests
- push_to_registry
uses: ./.github/workflows/check-dump.yml
run_migration_tests:
needs:
- check-prettify
- run-docker-image-tests
- push_to_registry
name: Run migration tests
runs-on: ubuntu-22.04
strategy:
matrix:
imagePrefix: ['generic-', 'hsl-']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
- name: start e2e env
uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@setup-e2e-environment-v6
with:
hasura_version: '${{ env.IMAGE_NAME }}:${{ matrix.imagePrefix }}${{ env.COMMIT_ID }}'
# Running the all migrations down and up to make sure that they all work as intended
- name: Run migration tests for both network and timetables databases
run: ./scripts/test-migrations.sh
run_integration_tests:
needs:
- check-prettify
- run-docker-image-tests
- push_to_registry
name: Run hasura integration tests
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- imagePrefix: 'generic-'
testCommand: 'yarn qa' # includes linter, prettier and ts:check as well
- imagePrefix: 'hsl-'
testCommand: 'yarn test-hsl' # only runs the tests
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
- name: start e2e env
uses: HSLdevcom/jore4-tools/github-actions/setup-e2e-environment@setup-e2e-environment-v6
with:
hasura_version: '${{ env.IMAGE_NAME }}:${{ matrix.imagePrefix }}${{ env.COMMIT_ID }}'
- name: Run integration tests
run: |
cd test/hasura
yarn --frozen-lockfile
${{ matrix.testCommand }}
run_e2e_tests:
needs:
- check-prettify
- run-docker-image-tests
- push_to_registry
- run_dump_tests
- run_migration_tests
- run_integration_tests
name: Run e2e tests
runs-on: ubuntu-22.04
steps:
- name: Extract metadata to env variables
uses: HSLdevcom/jore4-tools/github-actions/extract-metadata@extract-metadata-v1
- name: Run e2e tests
uses: HSLdevcom/jore4-tools/github-actions/run-ci@main
with:
hasura_version: '${{ env.IMAGE_NAME }}:hsl-${{ env.COMMIT_ID }}'