-
-
Notifications
You must be signed in to change notification settings - Fork 122
executable file
·216 lines (198 loc) · 6.26 KB
/
test.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
205
206
207
208
209
210
211
212
213
214
215
216
name: Test and Lint
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Load image url
id: load_image_url
run: |
IMAGE_URL=`make image-url`
echo "image-url=$IMAGE_URL" >> "$GITHUB_OUTPUT"
- name: Restore Cache
uses: actions/cache@v3
id: restore_cache
with:
path: image.tar
key: ${{ steps.load_image_url.outputs.image-url }}
- name: Build Docker image
id: build
if: steps.restore_cache.outputs.cache-hit != 'true'
run: |
mkdir -p .sentinel
IMAGE_URL=`make image-url`
echo "Building Docker image: $IMAGE_URL"
make image
docker save $IMAGE_URL > image.tar
- name: Cache docker image
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: image.tar
key: ${{ steps.load_image_url.outputs.image-url }}
nodejs_build:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Load image url
id: load_image_url
run: |
IMAGE_URL=`make image-url-nodejs`
echo "image-url-nodejs=$IMAGE_URL" >> "$GITHUB_OUTPUT"
- name: Restore Cache
uses: actions/cache@v3
id: restore_cache_nodejs
with:
path: image-nodejs.tar
key: ${{ steps.load_image_url.outputs.image-url-nodejs }}
- name: Build Docker image
id: build
if: steps.restore_cache_nodejs.outputs.cache-hit != 'true'
run: |
mkdir -p .sentinel
IMAGE_URL=`make image-url-nodejs`
echo "Building NodeJS Docker image: $IMAGE_URL"
make nodejs
docker save $IMAGE_URL > image-nodejs.tar
- name: Cache docker image
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: image-nodejs.tar
key: ${{ steps.load_image_url.outputs.image-url-nodejs }}
dev_setup:
needs: [nodejs_build, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load image url
id: load_image_url
shell: bash
run: |
IMAGE_URL_NODEJS=`make image-url-nodejs`
echo "image-url-nodejs=$IMAGE_URL_NODEJS" >> "$GITHUB_OUTPUT"
- name: setup
shell: bash
run: |
echo "Loading cached image: ${{ steps.load_image_url.outputs.image-url-nodejs }}"
- name: Restore Nodejs Image Cache
uses: actions/cache@v3
id: restore_cache_nodejs
with:
path: image-nodejs.tar
key: ${{ steps.load_image_url.outputs.image-url-nodejs }}
- name: load nodejs image
shell: bash
run: |
docker load --input image-nodejs.tar
docker tag ${{ steps.load_image_url.outputs.image-url-nodejs }} ghcr.io/kreneskyp/ix/nodejs:latest
- name: Test dev_setup
uses: ./.github/actions/run-docker
with:
command: make dev_setup
pytest:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run pytest
uses: ./.github/actions/run-docker
with:
command: make pytest
black:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run black
uses: ./.github/actions/run-docker
with:
command: make black-check
flake8:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run flake8
uses: ./.github/actions/run-docker
with:
command: make flake8
prettier:
needs: nodejs_build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load image url
id: load_image_url
shell: bash
run: |
IMAGE_URL_NODEJS=`make image-url-nodejs`
echo "image-url-nodejs=$IMAGE_URL_NODEJS" >> "$GITHUB_OUTPUT"
- name: setup
shell: bash
run: |
echo "Loading cached image: ${{ steps.load_image_url.outputs.image-url-nodejs }}"
- name: Restore Nodejs Image Cache
uses: actions/cache@v3
id: restore_cache_nodejs
with:
path: image-nodejs.tar
key: ${{ steps.load_image_url.outputs.image-url-nodejs }}
- name: load nodejs image
shell: bash
run: |
docker load --input image-nodejs.tar
docker tag ${{ steps.load_image_url.outputs.image-url-nodejs }} ghcr.io/kreneskyp/ix/nodejs:latest
- name: Run Prettier
uses: ./.github/actions/run-docker
with:
command: make prettier-check
# Disabling until a later date
#
# pyright:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Run Pyright
# uses: ./.github/actions/run-docker
# with:
# command: make pyright