@@ -43,10 +43,14 @@ workflows:
43
43
- build-modules :
44
44
requires :
45
45
- build-branch
46
+ - build-schemas :
47
+ requires :
48
+ - build-branch
46
49
- merge-build-branch :
47
50
requires :
48
51
- build-framework
49
52
- build-modules
53
+ - build-schemas
50
54
51
55
modules-coverage :
52
56
when :
@@ -149,14 +153,6 @@ jobs:
149
153
command : |
150
154
set -e
151
155
./scripts/wasm-framework-ci.sh
152
- - run :
153
- name : Generate schemas
154
- command : |
155
- # Install deps
156
- cargo install cargo-workspaces
157
- cargo install just
158
- # Run script
159
- just schema
160
156
- save_cache :
161
157
paths :
162
158
# Cargo registry
@@ -174,9 +170,7 @@ jobs:
174
170
git pull
175
171
# Check for wasm changes
176
172
git add framework/artifacts --force
177
- # Check for schema changes
178
- git add schema --force
179
- git commit -m 'Update framework WASM & Schemas [skip ci]' || true
173
+ git commit -m 'Update framework WASM' || true
180
174
git push origin "$CIRCLE_BRANCH-build" || true
181
175
- run :
182
176
name : Remove temporary branch if it failed during build framework
@@ -245,6 +239,63 @@ jobs:
245
239
failure_message : " **${CIRCLE_USERNAME}**'s modules WASM build failed. Please check why! 😭"
246
240
webhook : " ${DISCORD_STATUS_WEBHOOK}"
247
241
242
+ build-schemas :
243
+ docker :
244
+ - image : cimg/rust:1.80.0
245
+ resource_class : xlarge
246
+ steps :
247
+ - setup_remote_docker
248
+ - checkout
249
+ - run :
250
+ name : " Check for newer workflow"
251
+ background : true
252
+ command : |
253
+ while true; do
254
+ sleep 5
255
+ LATEST_COMMIT=$(git ls-remote $CIRCLE_REPOSITORY_URL | grep "$CIRCLE_BRANCH$" | cut -f 1)
256
+ if [ "$LATEST_COMMIT" != "$CIRCLE_SHA1" ]; then
257
+ echo "more recent commit to branch, exiting"
258
+ # Remove temporary branch
259
+ git push origin --delete "$CIRCLE_BRANCH-build" || true
260
+ curl -X POST "https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/cancel?circle-token=$CIRCLE_API_TOKEN"
261
+ fi
262
+ done
263
+ - run :
264
+ name : Checkout temporary branch
265
+ command : |
266
+ git fetch origin "$CIRCLE_BRANCH-build"
267
+ git checkout "$CIRCLE_BRANCH-build"
268
+ - restore_cache :
269
+ keys :
270
+ - cargocache-v2-build-rust:1.80.0-{{ checksum "framework/Cargo.lock" }}
271
+ - run :
272
+ name : Generate schemas
273
+ command : |
274
+ # Install deps
275
+ cargo install cargo-workspaces
276
+ cargo install just
277
+ # Run script
278
+ just schema
279
+ - run :
280
+ name : Commit and push schemas
281
+ command : |
282
+ git config --global user.name 'CircleCI'
283
+ git config --global user.email 'circleci@example.com'
284
+ # Pull latest changes
285
+ git pull
286
+ # Check for schema changes
287
+ git add schema --force
288
+ git commit -m 'Update Schemas [skip ci]' || true
289
+ git push origin "$CIRCLE_BRANCH-build" || true
290
+ - run :
291
+ name : Remove temporary branch if it failed during build schemas
292
+ when : on_fail
293
+ command : git push origin --delete "$CIRCLE_BRANCH-build" || true
294
+ - discord/status :
295
+ fail_only : true
296
+ failure_message : " **${CIRCLE_USERNAME}**'s schemas build failed. Please check why! 😭"
297
+ webhook : " ${DISCORD_STATUS_WEBHOOK}"
298
+
248
299
merge-build-branch :
249
300
docker :
250
301
- image : cimg/base:2024.01
0 commit comments