Skip to content

Commit d5752ab

Browse files
KayanskiBuckram123
authored andcommitted
Add .circleci/config.yml (#534)
1 parent 4c601a3 commit d5752ab

22 files changed

+1290
-3809
lines changed

.circleci/config.yml

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ workflows:
4343
- build-modules:
4444
requires:
4545
- build-branch
46+
- build-schemas:
47+
requires:
48+
- build-branch
4649
- merge-build-branch:
4750
requires:
4851
- build-framework
4952
- build-modules
53+
- build-schemas
5054

5155
modules-coverage:
5256
when:
@@ -149,14 +153,6 @@ jobs:
149153
command: |
150154
set -e
151155
./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
160156
- save_cache:
161157
paths:
162158
# Cargo registry
@@ -174,9 +170,7 @@ jobs:
174170
git pull
175171
# Check for wasm changes
176172
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
180174
git push origin "$CIRCLE_BRANCH-build" || true
181175
- run:
182176
name: Remove temporary branch if it failed during build framework
@@ -245,13 +239,80 @@ jobs:
245239
failure_message: "**${CIRCLE_USERNAME}**'s modules WASM build failed. Please check why! 😭"
246240
webhook: "${DISCORD_STATUS_WEBHOOK}"
247241

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+
248299
merge-build-branch:
249300
docker:
250301
- image: cimg/base:2024.01
251302
resource_class: small
252303
steps:
253304
- setup_remote_docker
254305
- checkout
306+
- run:
307+
name: Import GPG Key
308+
command: |
309+
echo -e "$GPG_PRIVATE_KEY" | gpg --import
310+
echo -e "trust\n5\ny\n" | gpg --command-fd 0 --edit-key 4C19E4CC17E67B7B
311+
- run:
312+
name: Configure Git for Signing
313+
command: |
314+
git config --global user.signingkey 4C19E4CC17E67B7B
315+
git config --global commit.gpgSign true
255316
- run:
256317
name: "Merge build branch"
257318
command: |
@@ -262,7 +323,7 @@ jobs:
262323
git fetch origin "$CIRCLE_BRANCH-build"
263324
# Merge artifacts to a branch
264325
git merge "origin/$CIRCLE_BRANCH-build" --squash
265-
git commit -m "Update WASM & Schemas [skip ci]" || echo "No changes to commit"
326+
git commit -S -m "Update WASM & Schemas [skip ci]" || echo "No changes to commit"
266327
git push origin $CIRCLE_BRANCH || true
267328
# Delete temporary branch
268329
git push origin --delete "$CIRCLE_BRANCH-build"
4.88 KB
Binary file not shown.
4.86 KB
Binary file not shown.

framework/artifacts/checksums.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
9b6394e85b956d66d8a286d541c6ef160ea52341635fa97c03f61a7563127864 abstract_account-xion.wasm
2-
98274761e51dd60d0fb9bdba3672c8e6329edd4ce8af047481373fb9d7bbf4c0 abstract_account.wasm
1+
3e0e10c4dbe5bfc83b9180288ca400bbc400e815cbf957fc63f0133910a59541 abstract_account-xion.wasm
2+
378f78cfc073d1d2e0ca01234618ad2efc6b68898e2e6ecb0d88a0505922ba90 abstract_account.wasm
33
3541b83bb328bd6fe18c0868cd69f37bdf760975c706746e9a41365fdfef13d7 abstract_ans_host.wasm
44
c2cf261e856081b53ba075a5cd2ce41b4ac2ef92301dc078c06babf4a12d0806 abstract_ibc_client.wasm
55
9482a8b60432b0e3be375126c471713c75beeeed5d12165bba1ce2fa933f6895 abstract_ibc_host.wasm
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
640 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)