Skip to content

Commit

Permalink
Merge branch 'ci-cache' into chrisward/pp-readme-gh
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChinchilla committed Aug 1, 2024
2 parents 285186c + 74a39ef commit 0860eac
Show file tree
Hide file tree
Showing 13 changed files with 397 additions and 324 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/check-clippy-all-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Clippy check --all-features
on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
runs-on: ubuntu-24.04
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
remove-android: 'true'
remove-dotnet: 'true'
temp-reserve-mb: 'true'
- uses: actions/checkout@v4
- name: Run Clippy
run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --all-features --locked --quiet
25 changes: 25 additions & 0 deletions .github/workflows/check-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Clippy check
on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
runs-on: ubuntu-24.04
if: ${{ !contains(github.event.head_commit.message, '[ci-skip-rust]') }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
remove-android: 'true'
remove-dotnet: 'true'
temp-reserve-mb: 'true'
- uses: actions/checkout@v4
- name: Run Clippy
run: SKIP_WASM_BUILD=1 cargo clippy --all-targets --all-features --locked --quiet
22 changes: 22 additions & 0 deletions .github/workflows/check-fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check fmt

on:
pull_request:
types: [opened, synchronize, reopened, edited]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check-fmt:
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:bullseye-1.74.0
if: ${{ !contains(github.event.head_commit.message, 'ci-skip-rust') }}
steps:
- uses: actions/checkout@v4
- name: Run cargo fmt
run: cargo fmt -- --check
- name: Run taplo
run: taplo fmt --check
35 changes: 35 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Integration tests

on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
integration-tests:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'ci-skip-integration-tests') }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js environment
run: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $HOME/.bashrc
eval "$(cat $HOME/.bashrc | tail -n +10)"
nvm install
nvm use
yarn --immutable
working-directory: ./integration-tests/chopsticks

- name: Lint & Test
run: |
yarn ts-check
yarn lint
yarn test:CI
working-directory: ./integration-tests/chopsticks

84 changes: 84 additions & 0 deletions .github/workflows/srtool-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Srtool build

on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
SUBWASM_VERSION: v0.20.0

jobs:
build-wasm:
runs-on: ubuntu-latest

strategy:
matrix:
runtime: [peregrine, spiritnet]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
env:
PARACHAIN_PALLET_ID: "0x50"
AUTHORIZE_UPGRADE_PREFIX: "0x02"
AUTHORIZE_UPGRADE_CHECK_VERSION: "true"
with:
chain: ${{ matrix.runtime }}
runtime_dir: runtimes/${{ matrix.runtime }}

- name: Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.runtime }}-srtool-digest.json
cat ${{ matrix.runtime }}-srtool-digest.json
echo "Compact Runtime: ${{ steps.srtool_build.outputs.wasm }}"
echo "Compressed Runtime: ${{ steps.srtool_build.outputs.wasm_compressed }}"
- name: Install subwasm
run: |
wget https://github.com/chevdor/subwasm/releases/download/${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb
sudo dpkg -i subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb
subwasm --version
- name: Show Runtime information
shell: bash
run: |
subwasm info ${{ steps.srtool_build.outputs.wasm }}
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }}
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-info.json
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-compressed-info.json
- name: Extract the metadata
shell: bash
run: |
subwasm meta ${{ steps.srtool_build.outputs.wasm }}
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-metadata.json
- name: Check the metadata diff
shell: bash
run: |
subwasm get -o ${{ matrix.runtime }}-live.wasm wss://${{ matrix.runtime }}.kilt.io
subwasm diff --no-color ${{ matrix.runtime }}-live.wasm ${{ steps.srtool_build.outputs.wasm }} || \
echo "Subwasm call failed, check the logs. This is likely because ${{ matrix.runtime }} is not known by subwasm" | \
tee ${{ matrix.chain }}-diff.txt
- name: Archive Subwasm results
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: ${{ matrix.runtime }}-runtime
path: |
${{ matrix.runtime }}-info.json
${{ matrix.runtime }}-compressed-info.json
${{ matrix.runtime }}-metadata.json
${{ matrix.runtime }}-diff.txt
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ matrix.runtime }}-srtool-digest.json
51 changes: 51 additions & 0 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Try-runtime

on:
push:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0
CARGO_HOME: ./.cargo

jobs:
test-try-runtime:
strategy:
matrix:
runtime: [peregrine, spiritnet]
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:bullseye-1.74.0

if: ${{ !contains(github.event.head_commit.message, 'ci-skip-rust') }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up caching for Cargo
uses: actions/cache@v4
with:
path: ${{ secrets.CARGO_CACHE_PATH }}
key: cargo-try-runtime-${{ matrix.runtime }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-try-runtime-${{ matrix.runtime }}-
- name: Run try-runtime
run: |
echo "Running ${{ matrix.runtime }} runtime migration check"
echo "---------- Downloading try-runtime CLI ----------"
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
chmod +x ./try-runtime
echo "Using try-runtime-cli version:"
./try-runtime --version
echo "---------- Building ${{ matrix.runtime }} runtime ----------"
cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime
echo "---------- Executing on-runtime-upgrade for ${{ matrix.runtime }} ----------"
./try-runtime --runtime ./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm \
on-runtime-upgrade --disable-spec-version-check --checks=all ${{ matrix.subcommand_extra_args }} live --uri wss://${{ matrix.runtime }}.kilt.io
Loading

0 comments on commit 0860eac

Please sign in to comment.