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 01384f0
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 216 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/clippy-check.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
on: push
name: Clippy check
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

# 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
50 changes: 29 additions & 21 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
name: try-runtime Workflow
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

on: [pull_request]

on: push
jobs:
build:
test-try-runtime:
strategy:
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
runtime: [peregrine, spiritnet]
uri: ['wss://peregrine.kilt.io', 'wss://spiritnet.kilt.io']
exclude:
- runtime: peregrine
uri: 'wss://spiritnet.kilt.io'
- runtime: spiritnet
uri: 'wss://peregrine.kilt.io'
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:bullseye-1.77.0

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

- name: script
run: |
echo "Running ${{ matrix.runtime }} runtime migration 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
- name: Build
run: cargo build --release -p ${{ matrix.runtime }}-runtime --features try-runtime --locked
echo "---------- Building ${{ matrix.runtime }} runtime ----------"
cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime
- 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 "---------- 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.

Loading

0 comments on commit 01384f0

Please sign in to comment.