Skip to content

Commit

Permalink
ci: try-runtime gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
ggera committed Jun 27, 2024
1 parent e6738b6 commit 8343ca2
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 210 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/clippy-check.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
on: push
name: Clippy check

# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"

jobs:
clippy_check:
runs-on: [self-hosted]
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.8-dind
privileged: true
container:
image: paritytech/ci-unified:bullseye-1.77.0
steps:
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@ jobs:
matrix:
runtime: [ peregrine, spiritnet ]
uri: [ 'wss://peregrine.kilt.io:443', 'wss://peregrine.kilt.io:443' ]
runs-on: [ self-hosted ]
services:
docker:
image: docker:20.10.8-dind
privileged: true
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:bullseye-1.77.0

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

- name: Build
run: cargo build --release -p ${{ matrix.runtime }}-runtime --features try-runtime --locked
- name: script
run: |
echo "Running ${{ matrix.runtime }} runtime migration check"
export RUST_LOG=remote-ext=debug,runtime=debug
- name: Run tests
uses: NodleCode/[email protected]
with:
url: ${matrix.uri}
snap: snapshots/eden-snapshot-full
runtime: target/release/wbuild/${metrix.runtime}-runtime/peregrine_runtime.compact.compressed.wasm
checks: "all"
options: "----disable-spec-version-check"
echo "---------- Downloading try-runtime CLI ----------"
curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/v0.7.0/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 }} --features try-runtime
echo "---------- Executing on-runtime-upgrade for ${{ matrix.uri }} ----------"
./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 ${{ matrix.uri }}
16 changes: 4 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
default:
interruptible: true
include:
- local: '.gitlab/check-skip.yml'
- local: '.gitlab/check.yml'
- local: '.gitlab/test.yml'
- local: '.gitlab/build.yml'
- local: '.gitlab/release.yml'

variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
CARGO_TARGET_DIR: $CI_PROJECT_DIR/target
default:
cache:
key: ${CI_COMMIT_REF_SLUG}-rust
paths:
- target
- .cargo/bin/
- .cargo/registry/index/
- .cargo/registry/cache/
- .cargo/git/db/

workflow:
auto_cancel:
on_new_commit: interruptible

stages:
- check
- test
- build
- release
47 changes: 46 additions & 1 deletion .gitlab/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
build:
interruptible: true
timeout: 2 hours
image:
name: kiltprotocol/kilt-ci:2.7.31
Expand Down Expand Up @@ -28,4 +27,50 @@ build:
- "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build latest-${CI_COMMIT_BRANCH}; fi"
- "if [[ ! -z ${CI_COMMIT_TAG} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_TAG}; fi"
- "if [[ ! -z ${CI_COMMIT_TAG} && ! -z ${CI_COMMIT_TAG##*-rc*} && ! -z ${CI_COMMIT_TAG##*dev-*} ]]; then ./.maintain/push-image.sh build latest; fi"
cache:
key: cache-build
paths:
- target/
- .cargo/bin/
- .cargo/registry/index/
- .cargo/registry/cache/
- .cargo/git/db/

build-wasm:
image:
name: paritytech/srtool:1.77.0
entrypoint: [""]
stage: build
only:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
parallel:
matrix:
- RUNTIME: "peregrine"
ENDPOINT: "wss://peregrine.kilt.io"
- RUNTIME: "spiritnet"
ENDPOINT: "wss://spiritnet.kilt.io"
script:
- export PACKAGE=${RUNTIME}-runtime
- export RUNTIME_DIR=runtimes/${RUNTIME}
- export PARACHAIN_PALLET_ID=0x50
- export AUTHORIZE_UPGRADE_PREFIX=0x02
- cp -r * /build
- /srtool/build build
- subwasm meta --format=json+scale /out/${RUNTIME}_runtime.compact.wasm > /out/${RUNTIME}-metadata.json
- subwasm get -o ${RUNTIME}-live.wasm ${ENDPOINT}
- subwasm diff --no-color ${RUNTIME}-live.wasm /out/${RUNTIME}_runtime.compact.wasm | tee /out/${RUNTIME}-diff.txt
- mkdir ./out
- mv /out/* ./out/
cache:
key: cache-wasm
paths:
- /build
- /out
artifacts:
paths:
- out/*.wasm
- out/*.json
- out/*.txt
expire_in: 12 week
15 changes: 0 additions & 15 deletions .gitlab/check-skip.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .gitlab/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.check_skip_rust:
before_script:
- |-
if echo "$CI_COMMIT_TITLE" | grep -q "ci-skip-rust"; then
echo "Skipping rust tests due to commit title"
exit 0
fi
.check_skip_integration_tests:
before_script:
- |-
if echo "$CI_COMMIT_TITLE" | grep -q "ci-skip-integration-tests"; then
echo "Skipping integration tests due to commit title"
exit 0
fi
cargo-clippy:
extends: .check_skip_rust
image: paritytech/ci-unified:bullseye-1.77.0
stage: check
variables:
RUSTFLAGS: "-D warnings"
script:
- cargo clippy --all-targets --locked --workspace --quiet
- cargo clippy --all-targets --all-features --locked --workspace --quiet

check-toml-format:
extends: .check_skip_rust
image: paritytech/ci-unified:bullseye-1.77.0
stage: check
cache: {}
script:
- cargo fmt -- --check
- taplo fmt --check
60 changes: 0 additions & 60 deletions .gitlab/release.yml

This file was deleted.

87 changes: 30 additions & 57 deletions .gitlab/test.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
clippy-and-docs:
extends: .check_skip_rust
interruptible: true
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.77.0
stage: test
script:
- cargo clippy --all-features --all-targets --locked -- -D warnings
- RUSTDOCFLAGS='-D warnings' cargo doc --all-features --no-deps --locked

fmt:
interruptible: true
extends: .check_skip_rust
image: paritytech/ci-unified:bullseye-1.77.0
stage: test
script:
- cargo fmt -- --check
- taplo fmt --check

test:
interruptible: true
extends: .check_skip_rust
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.77.0
stage: test
cache:
key: cache-test
paths:
- target/
- .cargo/bin/
- .cargo/registry/index/
- .cargo/registry/cache/
- .cargo/git/db/
script:
- cargo test --all --all-targets --locked

test-features:
extends: .check_skip_rust
interruptible: true
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.77.0
stage: test
needs:
- test
cache:
key: cache-test
paths:
- target/
- .cargo/bin/
- .cargo/registry/index/
- .cargo/registry/cache/
- .cargo/git/db/
script:
- cargo test --all --all-features --all-targets --locked

integration-tests:
extends: .check_skip_integration_tests
interruptible: true
timeout: 30 minutes
image: paritytech/ci-unified:bullseye-1.77.0
stage: test
cache: {}
cache:
key: cache-integration-tests
paths:
- ./integration-tests/chopsticks/node_modules
variables:
CI: "true"
script:
Expand All @@ -56,51 +53,27 @@ integration-tests:
- yarn lint
- yarn test:CI

build-wasm-try-runtime:
interruptible: true
test-try-runtime:
parallel:
matrix:
- RUNTIME: "peregrine"
ENDPOINT: "wss://peregrine.kilt.io:443"
- RUNTIME: "spiritnet"
image:
name: paritytech/ci-unified:bullseye-1.77.0
entrypoint: [""]
stage: release
ENDPOINT: "wss://spiritnet.kilt.io:443"
image: paritytech/ci-unified:bullseye-1.77.0
stage: test
only:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
variables:
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0
script:
# Build
- cargo build --release -p ${RUNTIME}-runtime --features try-runtime
- mkdir ./out
- mv target/release/wbuild/${RUNTIME}-runtime/${RUNTIME}_runtime.compact.compressed.wasm ./dangerous_${RUNTIME}.try-runtime.wasm
artifacts:
name: ${RUNTIME}_try-runtime
paths:
- ./dangerous_${RUNTIME}.try-runtime.wasm
expire_in: 12 week

test-try-runtime:
extends: .check_skip_rust
interruptible: true
parallel:
matrix:
- RUNTIME: "peregrine"
ENDPOINT: "wss://peregrine.kilt.io:443"
- RUNTIME: "spiritnet"
ENDPOINT: "wss://spiritnet.kilt.io:443"
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.77.0
stage: release
variables:
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0
needs:
- build-wasm-try-runtime
artifacts:
paths:
- out/*
when: on_success
script:
# Test
- cargo install --git https://github.com/paritytech/try-runtime-cli --tag ${TRY_RUNTIME_CLI_VERSION_TAG} --locked
- ./.cargo/bin/try-runtime --version
- ./try-runtime --runtime ./out/dangerous_${RUNTIME}.try-runtime.wasm on-runtime-upgrade --disable-spec-version-check --checks=all live --uri=${ENDPOINT}
- ./try-runtime --runtime ./dangerous_${RUNTIME}.try-runtime.wasm on-runtime-upgrade --disable-spec-version-check --checks=all live --uri=${ENDPOINT}
Loading

0 comments on commit 8343ca2

Please sign in to comment.