Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: caching #657

Merged
merged 55 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
c1a8bc8
ci: enable cache
ggera Jun 13, 2024
0786a36
ci: speedup pipeline with needs
ggera Jun 14, 2024
10bb9be
ci: test try-runtime with github actions
ggera Jun 14, 2024
2d1d7ed
ci: Add self-hosted runner
ggera Jun 20, 2024
c492ccc
ci: run jobs in container
ggera Jun 20, 2024
8c24d38
fix: github action
ggera Jun 20, 2024
e6738b6
ci: use DinD
ggera Jun 20, 2024
d1e1adb
ci: try-runtime gh action
ggera Jun 27, 2024
506a2f0
ci: upgrade caching version
ggera Jun 27, 2024
3681ced
ci: integration tests
ggera Jun 27, 2024
c35236e
ci: add tests gh action
ggera Jun 27, 2024
5b42fff
ci: srtool build
ggera Jun 28, 2024
42348a9
ci: tirgger on workflow_dispatch
ggera Jul 1, 2024
4c0ba3e
ci: use default cargo location
ggera Jul 1, 2024
225b872
Merge branch 'develop' of github.com:KILTprotocol/mashnet-node into c…
ggera Jul 18, 2024
dd91860
ci: address PR comments
ggera Jul 24, 2024
60be123
Merge branch 'develop' into ci-cache
ggera Jul 24, 2024
37b5ce1
Merge branch 'develop' of github.com:KILTprotocol/mashnet-node into c…
ggera Jul 24, 2024
95d1402
Merge branch 'ci-cache' of github.com:KILTprotocol/mashnet-node into …
ggera Jul 24, 2024
7377a4e
ci: prevent cancel-in-progress
ggera Jul 24, 2024
d453946
chore: merge develop
ggera Jul 29, 2024
3faf1d4
chore: resolve PR comments
ggera Jul 29, 2024
f15cbfd
Merge branch 'develop' of github.com:KILTprotocol/mashnet-node into c…
ggera Jul 30, 2024
a27face
chore: merge develop
ggera Jul 30, 2024
3c0bab3
ci-skip-rust
ggera Jul 30, 2024
7982893
chore: test skip
ggera Jul 30, 2024
a04f9ae
Merge branch 'develop' of github.com:KILTprotocol/mashnet-node into c…
ggera Jul 30, 2024
39a6191
chore: test ci-skip-rust
ggera Jul 30, 2024
7eb9671
ci-skip-rust;ci-skip-integration-tests
ggera Jul 30, 2024
1f87ef7
ci-skip-rust;ci-skip-integration-tests
ggera Jul 30, 2024
6a14c76
chore: test maximise build space
ggera Aug 1, 2024
eecdd08
ci-skip-integration-tests
ggera Aug 1, 2024
d5f972a
ci-skip-rust;ci-skip-integration-tests
ggera Aug 1, 2024
b925762
ci-skip-rust;ci-skip-integration-tests
ggera Aug 1, 2024
874802f
ci-skip-rust;ci-skip-integration-tests
ggera Aug 1, 2024
74a39ef
ci-skip-rust;ci-skip-integration-tests
ggera Aug 1, 2024
9a2417f
chore: commit message is not available on PR
ggera Aug 1, 2024
8419714
add check skip flags
ggera Aug 6, 2024
b2917a8
address PR comments
ggera Aug 7, 2024
af9c1a9
chore: formatting
ggera Aug 8, 2024
4a17731
chore: use actions/setup-node
ggera Aug 8, 2024
7ceefa6
ci-skip-rust
ggera Aug 8, 2024
bb1e606
ci-skip-rust
ggera Aug 8, 2024
499b0c6
ci-skip-rust
ggera Aug 8, 2024
6d71c3d
ci-skip-rust
ggera Aug 8, 2024
2e2dfa2
ci-skip-rust
ggera Aug 8, 2024
b35afb1
ci-skip-rust;ci-skip-integration-tests
ggera Aug 8, 2024
1f90326
ci-skip-rust;ci-skip-integration-tests
ggera Aug 8, 2024
980854e
ci-skip-rust;ci-skip-integration-tests
ggera Aug 8, 2024
f74de15
ci-skip-rust;ci-skip-integration-tests
ggera Aug 8, 2024
635f8dc
ci-skip-rust;ci-skip-integration-tests
ggera Aug 8, 2024
9a4fcc2
ci-skip-rust;ci-skip-integration-tests
ggera Aug 8, 2024
5f3baf1
chore: minor change
ggera Aug 12, 2024
749ca69
docs: Add GitHub docs autogen (#684)
ChrisChinchilla Aug 13, 2024
d8bdf80
Include metadata in artifact
ggera Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: try-runtime Workflow
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved

on: [pull_request]

jobs:
build:
strategy:
matrix:
runtime: [ peregrine, spiritnet ]
runs-on: paritytech/ci-unified:bullseye-1.70.0

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

- name: Set Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved

- name: Build
run: cargo build --release -p ${{ matrix.runtime }}-runtime --features try-runtime
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved

- name: Run tests
uses: NodleCode/[email protected]
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
with:
url: ${metrix.rpc-endpoint}
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
snap: snapshots/eden-snapshot-full
runtime: target/release/wbuild/${metrix.runtime}-runtime/peregrine_runtime.compact.compressed.wasm
checks: "all"
options: "----disable-spec-version-check"

- name: Upload WASM artifacts
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/upload-artifact@v3
with:
name: wasm-artifact
path: target/release/wbuild/*-runtime/*.wasm
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# ignore vscode settings
.vscode

# ignore .cargo in CI
.cargo/
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved

**/__pycache__

**/node_modules
Expand Down
232 changes: 24 additions & 208 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,216 +1,32 @@
.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
include:
- local: '.gitlab/check.yml'
- local: '.gitlab/test.yml'
- local: '.gitlab/build.yml'
- local: '.gitlab/release.yml'
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved

variables:
CARGO_HOME: $CI_PROJECT_DIR/.cargo
CARGO_TARGET_DIR: $CI_PROJECT_DIR/target
DOCKER_HUB_PARACHAIN: "kiltprotocol/kilt-node"
DOCKER_HUB_STANDALONE: "kiltprotocol/standalone-node"
DOCKER_HUB_DIP_PROVIDER_TEMPLATE: "kiltprotocol/dip-provider-node-template"
DOCKER_HUB_DIP_CONSUMER_TEMPLATE: "kiltprotocol/dip-consumer-node-template"
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0

ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
cache:
key: ${CI_COMMIT_REF_SLUG}-rust
paths:
- target
- .cargo/bin/
- .cargo/registry/index/
- .cargo/registry/cache/
- .cargo/git/db/

ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
workflow:
auto_cancel:
on_new_commit: interruptible


stages:
- test
- build

clippy-and-docs:
extends: .check_skip_rust
interruptible: true
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.70.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.70.0
stage: test
script:
- cargo fmt -- --check
- cargo install taplo-cli --version 0.9.0
- taplo fmt --check

test:
interruptible: true
extends: .check_skip_rust
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.70.0
stage: test
script:
- cargo test --all --all-targets --locked

test-features:
extends: .check_skip_rust
interruptible: true
timeout: 2 hours
image: paritytech/ci-unified:bullseye-1.70.0
stage: test
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.70.0
stage: test
variables:
CI: "true"
script:
- cd ./integration-tests/chopsticks
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && . "$NVM_DIR/nvm.sh" --no-use
- eval "[ -f .nvmrc ] && nvm install" && nvm use
- yarn --immutable
- yarn ts-check
- yarn lint
- yarn test:CI

# TODO: The try-runtime-cli executable could be built as part of the Docker image directly, saving some time.
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.70.0
stage: test
variables:
TRY_RUNTIME_CLI_VERSION_TAG: v0.6.1
script:
- curl -sL https://github.com/paritytech/try-runtime-cli/releases/download/${TRY_RUNTIME_CLI_VERSION_TAG}/try-runtime-x86_64-unknown-linux-musl -o try-runtime
- chmod +x ./try-runtime
- ./try-runtime --version
- cargo build --locked --release -p ${RUNTIME}-runtime --features try-runtime
- ./try-runtime --runtime ./target/release/wbuild/${RUNTIME}-runtime/${RUNTIME}_runtime.compact.compressed.wasm on-runtime-upgrade --disable-spec-version-check --checks=all live --uri=${ENDPOINT}

build:
interruptible: true
timeout: 2 hours
image:
name: kiltprotocol/kilt-ci:2.7.31
entrypoint: [""]
stage: build
only:
refs:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
- /^[dev-](\w*-)*[0-9]?$/
variables:
DOCKER_HUB_PARACHAIN: "kiltprotocol/kilt-node"
DOCKER_HUB_STANDALONE: "kiltprotocol/standalone-node"
DOCKER_HUB_DIP_PROVIDER_TEMPLATE: "kiltprotocol/dip-provider-node-template"
DOCKER_HUB_DIP_CONSUMER_TEMPLATE: "kiltprotocol/dip-consumer-node-template"
before_script:
- aws --version
- docker --version
script:
- echo -n $CI_REGISTRY_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_REGISTRY
- ./.maintain/docker-auth-config.sh

- ./.maintain/build-image.sh build
- "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_SHORT_SHA}; fi"
- "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"

build-wasm-peregrine:
interruptible: true
image:
name: paritytech/srtool:1.70.0
entrypoint: [""]
stage: build
only:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
script:
- export PACKAGE=peregrine-runtime
- export RUNTIME_DIR=runtimes/peregrine
- export PARACHAIN_PALLET_ID=0x50
- export AUTHORIZE_UPGRADE_PREFIX=0x02
- cp -r * /build
- /srtool/build build
- subwasm meta --format=json+scale /out/peregrine_runtime.compact.wasm > /out/peregrine-metadata.json
- subwasm get -o peregrine-live.wasm wss://peregrine.kilt.io
- subwasm diff --no-color peregrine-live.wasm /out/peregrine_runtime.compact.wasm | tee /out/peregrine-diff.txt
- mkdir ./out
- mv /out/* ./out/
artifacts:
paths:
- out/*.wasm
- out/*.json
- out/*.txt
expire_in: 12 week

build-wasm-spiritnet:
interruptible: true
image:
name: paritytech/srtool:1.70.0
entrypoint: [""]
stage: build
only:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
script:
- export PACKAGE=spiritnet-runtime
- export RUNTIME_DIR=runtimes/spiritnet
- export PARACHAIN_PALLET_ID=0x50
- export AUTHORIZE_UPGRADE_PREFIX=0x02
- cp -r * /build
- /srtool/build build
- subwasm meta --format=json+scale /out/spiritnet_runtime.compact.wasm > /out/spiritnet-metadata.json
- subwasm get -o spiritnet-live.wasm wss://spiritnet.kilt.io
- subwasm diff --no-color spiritnet-live.wasm /out/spiritnet_runtime.compact.wasm | tee /out/spiritnet-diff.txt
- mkdir ./out
- mv /out/* ./out/
artifacts:
paths:
- out/*.wasm
- out/*.json
- out/*.txt
expire_in: 12 week

build-wasm-try-runtime:
interruptible: true
parallel:
matrix:
- RUNTIME: "peregrine"
- RUNTIME: "spiritnet"
image:
name: paritytech/ci-unified:bullseye-1.70.0
entrypoint: [""]
stage: build
only:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
script:
- 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
- release
26 changes: 26 additions & 0 deletions .gitlab/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
build:
interruptible: true
timeout: 2 hours
image:
name: kiltprotocol/kilt-ci:2.7.31
entrypoint: [""]
stage: build
only:
refs:
- develop
- master
- /^[0-9]+(?:\.[0-9]+){2}(?:-(rc)*([0-9])+)?$/
- /^[dev-](\w*-)*[0-9]?$/
before_script:
- aws --version
- docker --version
script:
- echo -n $CI_REGISTRY_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- aws ecr get-login-password | docker login --username AWS --password-stdin $AWS_REGISTRY
- ./.maintain/docker-auth-config.sh
- ./.maintain/build-image.sh build
- "if [[ ! -z ${CI_COMMIT_BRANCH} ]]; then ./.maintain/push-image.sh build ${CI_COMMIT_SHORT_SHA}; fi"
- "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"

15 changes: 15 additions & 0 deletions .gitlab/check.yml
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.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:
ntn-x2 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading
Loading