-
Notifications
You must be signed in to change notification settings - Fork 4
245 lines (207 loc) · 7.26 KB
/
Copy pathtest.yml
File metadata and controls
245 lines (207 loc) · 7.26 KB
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
name: Test
on:
pull_request:
push:
branches: [main, develop, issue-*]
workflow_dispatch:
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
run: yarn install
- name: Test
run: yarn test-unit
e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
run: yarn install
- name: Build
run: yarn build
- name: Test
run: yarn test-e2e
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up git committer identity
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Install dependencies and build
run: yarn install && yarn build && yarn package
- name: Create a temp git dir
run: |
mkdir ${{ runner.temp }}/temp_git_dir
cd ${{ runner.temp }}/temp_git_dir
git config --global init.defaultBranch main
git init
git status
- name: Create new job
id: create-job
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'create-job'
job_payload: '{"field": "value", "state": "pending"}'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Mark job as started
id: start-job
if: ${{ steps.create-job.outputs.job_created == 'true' }}
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'start-job'
job_payload: '{"field": "value", "state": "started"}'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Mutual exclusion code
if: ${{ steps.create-job.outputs.job_created == 'true' }}
run: echo "Running the job that requires mutual exclusion"
- name: Get next job
id: get-next-job
if: ${{ steps.create-job.outputs.job_created == 'true' }}
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'next-job'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Mark job as finished
id: finish-job
if: ${{ steps.create-job.outputs.job_created == 'true' }}
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'finish-job'
job_payload: '{"field": "value", "state": "finished"}'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Show new commits
run: |
cd ${{ runner.temp }}/temp_git_dir
git show --pretty="fuller" --show-signature ${{ steps.create-job.outputs.job_commit }}
git show --pretty="fuller" --show-signature ${{ steps.start-job.outputs.job_commit }}
git show --pretty="fuller" --show-signature ${{ steps.finish-job.outputs.job_commit }}
- name: Upload test git dir
uses: actions/upload-artifact@v3
with:
name: Integration test git dir
path: ${{ runner.temp }}/temp_git_dir
integration-tests-with-commit-signature:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git config
run: |
# Import test GPG key
# secretlint-disable
{
# nosemgrep
echo -e "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
cat __tests__/fixtures/test-key-committer.pgp
echo -e "\n-----END PGP PRIVATE KEY BLOCK-----\n"
} | gpg --import --batch --yes -
# secretlint-enable
# Set Git config
git config --global user.name 'A Committer'
git config --global user.email 'committer@example.com'
git config --global user.signingkey 'BD98B3F42545FF93EFF55F7F3F39AA1432CA6AD7'
git config --global commit.gpgsign true
- name: Install dependencies and build
run: yarn install && yarn build && yarn package
- name: Create a temp git dir
run: |
mkdir ${{ runner.temp }}/temp_git_dir
cd ${{ runner.temp }}/temp_git_dir
git config --global init.defaultBranch main
git init
git status
- name: Create new job
id: create-job
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'create-job'
job_payload: '{"field": "value", "state": "pending"}'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Mark job as started
id: start-job
if: ${{ steps.create-job.outputs.job_created == 'true' }}
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'start-job'
job_payload: '{"field": "value", "state": "started"}'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Mutual exclusion code
if: ${{ steps.create-job.outputs.job_created == 'true' }}
run: echo "Running the job that requires mutual exclusion"
- name: Get next job
id: get-next-job
if: ${{ steps.create-job.outputs.job_created == 'true' }}
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'next-job'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Mark job as finished
id: finish-job
if: ${{ steps.create-job.outputs.job_created == 'true' }}
uses: ./
with:
git_repo_dir: ${{ runner.temp }}/temp_git_dir
queue_name: 'library update - library-aaa'
action: 'finish-job'
job_payload: '{"field": "value", "state": "finished"}'
- name: Debug
run: |
cd ${{ runner.temp }}/temp_git_dir
git log --show-signature
- name: Show new commits
run: |
cd ${{ runner.temp }}/temp_git_dir
git show --pretty="fuller" --show-signature ${{ steps.create-job.outputs.job_commit }}
git show --pretty="fuller" --show-signature ${{ steps.start-job.outputs.job_commit }}
git show --pretty="fuller" --show-signature ${{ steps.finish-job.outputs.job_commit }}
- name: Upload test git dir
uses: actions/upload-artifact@v3
with:
name: Integration test git dir
path: ${{ runner.temp }}/temp_git_dir