-
Notifications
You must be signed in to change notification settings - Fork 59
168 lines (139 loc) · 4.61 KB
/
release.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
name: Release
on:
push:
branches:
- main
paths-ignore:
- '**.md'
jobs:
publish-docker:
name: Publish Docker
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 17
- name: Check .env drift
run: |
result=$(cmp --silent .env kube/base/faros/config/.env; echo $?)
if [[ $result -ne 0 ]]; then
echo "####"
echo "# Drift detected on configuration"
echo "# Ensure that 'kube/base/faros/config/.env' is identical to '.env'"
echo "# Execute 'cp -f .env kube/base/faros/config/.env' to sync the files"
echo "####"
exit $result
else
echo "No drift detected"
fi
- name: Build (init)
run: npm ci --unsafe-perm
working-directory: init
- name: Build (cli)
run: npm ci --unsafe-perm
working-directory: cli
- name: Run unit tests
run: npm run test:unit -- --coverage
working-directory: init
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
farosai/faros-ce-init
flavor: |
latest=auto
tags: |
type=sha,format=long,prefix=
type=raw,value=latest,enable=true
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Start services
run: [email protected] FAROS_INIT_IMAGE=farosai/faros-ce-init:${{ github.sha }} docker compose up --quiet-pull -d
- name: Show logs
run: docker compose logs --tail all
- name: Show services
run: docker compose ps -a
- name: Wait for init to complete
run: |
CONTAINER_EXIT_CODE=$(docker wait faros-community-edition-faros-init-1)
echo "Faros init container exit code was ${CONTAINER_EXIT_CODE}"
[[ $CONTAINER_EXIT_CODE -eq 0 ]]
- name: Get Hasura Admin Secret
run: |
echo $(cat .env | grep "^HASURA_GRAPHQL_ADMIN_SECRET") >> "$GITHUB_ENV"
- name: Run integration tests (init)
run: npm run test:integration -- --coverage
working-directory: init
- name: Run integration tests (cli)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run test:integration -- --coverage
working-directory: cli
- name: Stop services
run: docker compose down
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
publish-cli-docker:
name: Publish CLI Docker
runs-on: ubuntu-latest
timeout-minutes: 20
# Build and integration tests are run in the job above. So we just build and push if the above job is successful.
needs: publish-docker
steps:
- name: Check out
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
farosai/faros-ce-cli
flavor: |
latest=auto
tags: |
type=sha,format=long,prefix=
type=raw,value=latest,enable=true
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
file: cli/Dockerfile
context: cli
platforms: linux/amd64,linux/arm64
pull: true
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}