-
-
Notifications
You must be signed in to change notification settings - Fork 103
220 lines (186 loc) · 5.68 KB
/
update-integration-repositories.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
217
218
219
220
name: ' 🖇 Update Integration Test Repositories'
on:
workflow_dispatch:
inputs:
ref:
description: Branch or hash
required: false
schedule:
- cron: '0 8 * * 1' # Monday at 8 UTC
permissions:
contents: read
env:
NEW_BRANCH: 'update-integration-repositories'
REF_BRANCH_G: main
RUNS_ON: ubuntu-latest
NODE_VERSION: '18.x'
NPM_VERSION: '9'
jobs:
calc-ref:
runs-on: ubuntu-latest
outputs:
ref: ${{ github.event.inputs.ref || env.REF_BRANCH_G }}
steps:
- name: Ref Branch
run: |
echo Ref: "${{ env.REF_BRANCH_G }}"
echo Input: "${{ github.event.inputs.ref }}"
load-integrations:
needs:
- calc-ref
uses: ./.github/workflows/reuseable-load-integrations-repo-list.yml
with:
ref: ${{ needs.calc-ref.outputs.ref }}
dirty: true
build:
needs:
- calc-ref
uses: './.github/workflows/reuseable-build-dist-cache.yml'
with:
ref: ${{ needs.calc-ref.outputs.ref }}
integrations:
runs-on: ubuntu-latest
needs:
- load-integrations
- build
- calc-ref
env:
REF_BRANCH: ${{ needs.calc-ref.outputs.ref }}
strategy:
# the integration tests are independent, so we want to run them all.
fail-fast: false
matrix:
# List of repositories to check.
# Use `repo-list.sh` in `integration-tests` to generate.
repo: ${{ fromJSON(needs.load-integrations.outputs.repos) }}
# repo:
# # - prettier/prettier
# # - typescript-eslint/typescript-eslint
# - wireapp/wire-webapp
steps:
- name: Build Results
run: |
echo "key: ${{ needs.build.outputs.key }}"
echo "path: ${{ needs.build.outputs.path }}"
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.REF_BRANCH }}
- name: Enable Corepack
run: corepack enable
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- run: pnpm -v
- name: Cache Build
id: step-cache-build
uses: actions/[email protected]
with:
key: ${{ needs.build.outputs.key }}
path: ${{ needs.build.outputs.path }}
- name: Cached Results
run: |
echo Build Cache: ${{ steps.step-cache-build.outputs.cache-hit == 'true' && 'Hit' || 'Miss' }}
- name: pnpm CI
run: pnpm i
- name: Has pnpm has failed?
if: ${{ failure() }}
run: |
ls -alF /home/runner/.pnpm/_logs/*.log
cat /home/runner/.pnpm/_logs/*.log
- name: Check Build
if: ${{ steps.step-cache-build.outputs.cache-hit != 'true' }}
run: exit 1
- name: Run Integration Tests ${{ matrix.repo }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
cd integration-tests
&& pnpm i
&& pnpm run update-repositories -- ${{ matrix.repo }}
- name: Normalize Repo Name
id: step-normalize-repo-name
env:
REPO: ${{ matrix.repo }}
REPLACE: '/'
REPLACE_WITH: '__'
run: |
echo "REPO_NAME=${REPO//${REPLACE}/${REPLACE_WITH}}" >> $GITHUB_OUTPUT
- name: Store Repo Diff
id: step-repo-info
env:
REPO: ${{ steps.step-normalize-repo-name.outputs.REPO_NAME }}
run: |
mkdir temp
echo "${{ matrix.repo }} =>" $REPO
git diff > temp/$REPO.diff
- name: store diff
uses: actions/upload-artifact@v4
with:
name: diffs-repo-${{ steps.step-normalize-repo-name.outputs.REPO_NAME }}
path: temp/*.diff
retention-days: 1
pr-setup:
runs-on: ubuntu-latest
needs:
- integrations
- calc-ref
env:
REF_BRANCH: ${{ needs.calc-ref.outputs.ref }}
outputs:
base: ${{ env.REF_BRANCH }}
body: |
## Update Integration Repositories
commit-message: 'ci: Workflow Bot -- Update Integration Snapshots'
branch: ${{ env.NEW_BRANCH }}-${{ env.REF_BRANCH }}
title: 'ci: Workflow Bot -- Update Integration Snapshots (${{ env.REF_BRANCH }})'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.REF_BRANCH }}
- name: Enable Corepack
run: corepack enable
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: restore repos
uses: actions/download-artifact@v4
with:
pattern: diffs-*
merge-multiple: true
path: temp
- name: show downloaded
run: ls -alF temp
- name: apply diff
run: git apply --allow-empty temp/*.diff
- name: Update Integrations List
run: |
pnpm run update-integrations-list
- name: Build Patch
run: |
git --no-pager diff > temp/patch.diff
- name: Store Patch
uses: actions/upload-artifact@v4
with:
name: patch
path: temp/patch.diff
retention-days: 1
pr:
uses: ./.github/workflows/reuseable-pr-from-artifact.yml
needs:
- pr-setup
with:
patch_artifact: patch
base: ${{ needs.pr-setup.outputs.base }}
body: ${{ needs.pr-setup.outputs.body }}
commit-message: ${{ needs.pr-setup.outputs.commit-message }}
branch: ${{ needs.pr-setup.outputs.branch }}
title: ${{ needs.pr-setup.outputs.title }}
secrets:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}