Skip to content

Commit a4561c5

Browse files
ci: caching (#657)
## fixes KILTprotocol/ticket#3345 Breaks up the on `gitlab-ci.yml` & adds one more stage release. - [x] Migrate few jobs from gitlab to Github - [x] Enable caching ## Metadata Diff to Develop Branch <details> <summary>Peregrine Diff</summary> ``` ``` </details> <details> <summary>Spiritnet Diff</summary> ``` ``` </details> ## Checklist: - [ ] I have verified that the code works - [ ] No panics! (checked arithmetic ops, no indexing `array[3]` use `get(3)`, ...) - [ ] I have verified that the code is easy to understand - [ ] If not, I have left a well-balanced amount of inline comments - [ ] I have [left the code in a better state](https://deviq.com/principles/boy-scout-rule) - [ ] I have documented the changes (where applicable) * Either PR or Ticket to update [the Docs](https://github.com/KILTprotocol/docs) * Link the PR/Ticket here --------- Co-authored-by: Chris Chinchilla <chris@kilt.io>
1 parent 880c74e commit a4561c5

12 files changed

+429
-317
lines changed

.github/workflows/check-fmt.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Check fmt
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref_name }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
get-head-commit-msg:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
20+
- name: Get Head Commit Message
21+
id: step-head-commit
22+
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
23+
24+
check-fmt:
25+
runs-on: ubuntu-latest
26+
needs: get-head-commit-msg
27+
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
28+
container:
29+
image: paritytech/ci-unified:bullseye-1.74.0
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Run cargo fmt
34+
run: cargo fmt -- --check
35+
36+
- name: Run taplo
37+
run: taplo fmt --check

.github/workflows/docs-publish.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Deploy Chain docs
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- 'refs/tags/[0-9]+.[0-9]+.[0-9]+*'
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Free Disk Space
14+
uses: jlumbroso/free-disk-space@main
15+
with:
16+
tool-cache: true
17+
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Build and Deploy in Container
25+
run: |
26+
docker run --rm \
27+
-v "${GITHUB_WORKSPACE}:/workspace" \
28+
-v "${HOME}/.cargo:/root/.cargo" \
29+
-w /workspace \
30+
paritytech/ci-unified:bullseye-1.74.0 \
31+
bash -c "
32+
RUSTDOCFLAGS='-D warnings' cargo doc --all-features --no-deps --locked && \
33+
chown -R $(id -u):$(id -g) target/doc"
34+
35+
- name: Deploy
36+
uses: JamesIves/github-pages-deploy-action@v4
37+
with:
38+
branch: gh-pages-${{ github.ref_name }}
39+
folder: target/doc
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Integration tests
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref_name }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
get-head-commit-msg:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.event.pull_request.head.sha }}
20+
21+
- name: Get Head Commit Message
22+
id: step-head-commit
23+
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
24+
25+
integration-tests:
26+
runs-on: ubuntu-latest
27+
needs: get-head-commit-msg
28+
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-integration-tests') }}
29+
env:
30+
working-dir: ./integration-tests/chopsticks
31+
CI: "true"
32+
defaults:
33+
run:
34+
working-directory: ${{ env.working-dir }}
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v4
38+
39+
- name: Setup Node.js environment
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version-file: "${{ env.working-dir }}/.nvmrc"
43+
44+
- name: Install dependencies
45+
run: yarn --immutable
46+
47+
- name: Type Checking
48+
run: yarn ts-check
49+
50+
- name: Linting
51+
run: yarn lint
52+
53+
- name: Test Suite
54+
run: yarn test:CI
55+

.github/workflows/srtool-build.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Srtool build
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
- 'refs/tags/[0-9]+.[0-9]+.[0-9]+*'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref_name }}
12+
cancel-in-progress: true
13+
14+
env:
15+
SUBWASM_VERSION: v0.21.3
16+
17+
jobs:
18+
build-wasm:
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
runtime: [peregrine, spiritnet]
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v4
28+
29+
- name: Srtool build
30+
id: srtool_build
31+
uses: chevdor/srtool-actions@v0.9.2
32+
env:
33+
PARACHAIN_PALLET_ID: "0x50"
34+
AUTHORIZE_UPGRADE_PREFIX: "0x02"
35+
AUTHORIZE_UPGRADE_CHECK_VERSION: "true"
36+
with:
37+
chain: ${{ matrix.runtime }}
38+
runtime_dir: runtimes/${{ matrix.runtime }}
39+
40+
- name: Summary
41+
run: |
42+
echo '${{ steps.srtool_build.outputs.json }}' | jq | tee ${{ matrix.runtime }}-srtool-digest.json
43+
echo "Compressed Runtime: ${{ steps.srtool_build.outputs.wasm_compressed }}"
44+
45+
- name: Install subwasm
46+
run: |
47+
wget https://github.com/chevdor/subwasm/releases/download/${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb
48+
sudo dpkg -i subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb
49+
subwasm --version
50+
51+
- name: Show Runtime information
52+
shell: bash
53+
run: |
54+
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }}
55+
subwasm info --json ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-compressed-info.json
56+
57+
- name: Extract the metadata
58+
shell: bash
59+
run: |
60+
subwasm meta ${{ steps.srtool_build.outputs.wasm_compressed }}
61+
subwasm meta --format=json+scale ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-metadata.json
62+
63+
- name: Check the metadata diff
64+
shell: bash
65+
run: |
66+
subwasm get -o ${{ matrix.runtime }}-live.wasm wss://${{ matrix.runtime }}.kilt.io
67+
subwasm diff --no-color ${{ matrix.runtime }}-live.wasm ${{ steps.srtool_build.outputs.wasm_compressed }} || \
68+
echo "Subwasm call failed, check the logs. This is likely because ${{ matrix.runtime }} is not known by subwasm" | \
69+
tee ${{ matrix.runtime }}-diff.txt
70+
71+
- name: Archive Subwasm results
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: ${{ matrix.runtime }}-runtime
75+
path: |
76+
${{ matrix.runtime }}-compressed-info.json
77+
${{ matrix.runtime }}-metadata.json
78+
${{ matrix.runtime }}-diff.txt
79+
${{ steps.srtool_build.outputs.wasm_compressed }}
80+
${{ matrix.runtime }}-srtool-digest.json
81+

.github/workflows/try-runtime.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Try-runtime
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref_name }}
8+
cancel-in-progress: true
9+
10+
env:
11+
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0
12+
CARGO_HOME: ./.cargo
13+
14+
jobs:
15+
get-head-commit-msg:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
head-commit-msg: ${{ steps.step-head-commit.outputs.headCommitMsg }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.event.pull_request.head.sha }}
23+
24+
- name: Get Head Commit Message
25+
id: step-head-commit
26+
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
27+
28+
29+
test-try-runtime:
30+
strategy:
31+
matrix:
32+
runtime: [peregrine, spiritnet]
33+
runs-on: ubuntu-latest
34+
needs: get-head-commit-msg
35+
if: ${{ !contains(needs.get-head-commit-msg.outputs.head-commit-msg, 'ci-skip-rust') }}
36+
container:
37+
image: paritytech/ci-unified:bullseye-1.74.0
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up caching for Cargo
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ secrets.CARGO_CACHE_PATH }}
46+
key: cargo-try-runtime-${{ matrix.runtime }}-${{ github.ref_name }}-${{ hashFiles('**/Cargo.lock') }}
47+
restore-keys: |
48+
cargo-try-runtime-${{ matrix.runtime }}-${{ github.ref_name }}-
49+
50+
- name: Run try-runtime
51+
run: |
52+
echo "Running ${{ matrix.runtime }} runtime migration check"
53+
54+
echo "---------- Downloading try-runtime CLI ----------"
55+
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_CLI_VERSION_TAG }}/try-runtime-x86_64-unknown-linux-musl -o try-runtime
56+
chmod +x ./try-runtime
57+
echo "Using try-runtime-cli version:"
58+
./try-runtime --version
59+
60+
echo "---------- Building ${{ matrix.runtime }} runtime ----------"
61+
cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime
62+
63+
echo "---------- Executing on-runtime-upgrade for ${{ matrix.runtime }} ----------"
64+
./try-runtime --runtime ./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm \
65+
on-runtime-upgrade --disable-spec-version-check --checks=all live --uri wss://${{ matrix.runtime }}.kilt.io

0 commit comments

Comments
 (0)