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: Migrate Gitlab tests to GitHub runner #698

Merged
merged 51 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1af43f0
test mounting cargo cache
ggera Aug 19, 2024
0b98788
fix permission
ggera Aug 19, 2024
ad2819b
build images in gh
ggera Aug 19, 2024
0b90a1e
fix ecr login
ggera Aug 19, 2024
d535977
macos runner
ggera Aug 20, 2024
cd186f8
run sequentially to release resouces
ggera Aug 20, 2024
344fbc2
build release outside docker
ggera Aug 20, 2024
5dfd569
undo Dockerfile changes
ggera Aug 20, 2024
8e26411
minor
ggera Aug 20, 2024
1986c5d
trigger gitlab pipleine from gh action
ggera Aug 20, 2024
a31fa3c
fix: formatting
ggera Aug 20, 2024
3116e96
formatting
ggera Aug 20, 2024
30bd9c9
get commit message in a step
ggera Aug 21, 2024
c5f38b2
fix clippy
ggera Aug 21, 2024
e4abc79
remove target from cache
ggera Aug 21, 2024
1a0e05d
Use single workflow
ntn-x2 Aug 22, 2024
3156339
Add delimiters
ntn-x2 Aug 22, 2024
1b83179
Update nightly version and add job dependencies
ntn-x2 Aug 22, 2024
b442ab0
Add job dependencies
ntn-x2 Aug 22, 2024
4d4ff5f
Trigger Gitlab pipeline only via web hooks
ntn-x2 Aug 22, 2024
4ddd5c4
Fix gitlab pipeline syntax
ntn-x2 Aug 22, 2024
642085b
Integration tests must depend on Clippy
ntn-x2 Aug 22, 2024
b4399aa
Add space cleaning
ntn-x2 Aug 22, 2024
64b21de
append cargo hash to cache key
ggera Aug 22, 2024
ee71460
Do not fail whole matrix
ntn-x2 Aug 23, 2024
a017d3b
Fix commit head job
ntn-x2 Aug 23, 2024
d6c2342
Different way for commit message
ntn-x2 Aug 23, 2024
ddc7271
ci-skip-rust
ggera Aug 23, 2024
fc08aea
ci-skip-rust
ggera Aug 23, 2024
3295fb0
Last changes
ntn-x2 Aug 29, 2024
f0b4633
Use right version of nightly for rustfmt job
ntn-x2 Aug 29, 2024
2adbe60
Add cargo cache for two more jobs
ntn-x2 Aug 29, 2024
2f01b0f
Remove isolation for vitest files
ntn-x2 Aug 29, 2024
68cd6de
ci-skip-rust
ntn-x2 Aug 29, 2024
9a3154a
Install fmt nightly toolchain
ntn-x2 Aug 29, 2024
48da3a1
ci-skip-rust
ntn-x2 Aug 29, 2024
920435b
test commit message
ntn-x2 Aug 29, 2024
b064963
test commit message
ntn-x2 Aug 29, 2024
d6d5820
test commit message 3
ntn-x2 Aug 29, 2024
fc0a881
test commit message 4
ntn-x2 Aug 29, 2024
5f4bd84
test commit message 5
ntn-x2 Aug 29, 2024
c6b572c
test commit message 6
ntn-x2 Aug 29, 2024
9eab874
ci-skip-rust
ntn-x2 Aug 29, 2024
5392b54
Add always() for job dependency
ntn-x2 Aug 29, 2024
543163e
ci-skip-rust
ntn-x2 Aug 29, 2024
55f0437
Revert file parallelism flag
ntn-x2 Aug 29, 2024
0017031
ci-skip-rust
ntn-x2 Aug 29, 2024
6426f07
ci-skip-rust
ntn-x2 Aug 29, 2024
b765a35
Revert parallelism
ntn-x2 Aug 29, 2024
c5ddd59
ci-skip-rust
ntn-x2 Aug 29, 2024
cb6d669
Merge commit '60f670d370cb29da9220e868c87a35518d8cde11' into github-r…
ntn-x2 Aug 29, 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
289 changes: 289 additions & 0 deletions .github/workflows/check-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
name: Check codebase

on:
pull_request:
push:
branches:
- develop
- master
- 'refs/tags/[0-9]+.[0-9]+.[0-9]+*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
get-commit-head:
name: Get HEAD commit message
runs-on: ubuntu-latest
outputs:
headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# We use different payloads depending on whether this is a `push` or a `pull_request` event
ref: ${{ github.event.head_commit.message || github.event.pull_request.head.sha }}

- name: Get HEAD commit message
id: get-head-commit-message
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"

cargo-clippy:
name: Run Clippy checks
runs-on: ubuntu-latest
needs: get-commit-head
if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }}

strategy:
matrix:
features:
-
- --all-features
fail-fast: false

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

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run `cargo clippy`
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "cargo clippy --all-targets --locked ${{ matrix.features }} -- -D warnings"

cargo-fmt:
name: Check formatting
runs-on: ubuntu-latest
container:
image: paritytech/ci-unified:bullseye-1.74.0
env:
RUSTUP_NIGHTLY_VERSION: nightly-2023-10-02
needs: get-commit-head
if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }}

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

- name: Install nightly toolchain
run: rustup toolchain add ${{ env.RUSTUP_NIGHTLY_VERSION }}

- name: Run `cargo fmt`
# Latest nightly version matching the base rustc version (1.74.0)
run: cargo +${{ env.RUSTUP_NIGHTLY_VERSION }} fmt -- --check

- name: Run `taplo`
run: taplo fmt --check

integration-tests:
name: Run Chopsticks tests
runs-on: ubuntu-latest
env:
working-dir: ./integration-tests/chopsticks
CI: true
PEREGRINE_WASM_OVERRIDE: ../../target/debug/wbuild/peregrine-runtime/peregrine_runtime.wasm
defaults:
run:
working-directory: ${{ env.working-dir }}
needs:
- get-commit-head
- cargo-clippy
# Run this job if the `clippy` step completed successfully or was skipped, as long as the commit does not explicitly skip integration tests as well.
if: ${{ always() && needs.cargo-clippy.result != 'failure' && !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }}

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

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Setup environment
uses: actions/setup-node@v4
with:
node-version-file: "${{ env.working-dir }}/.nvmrc"

- name: Install dependencies
run: yarn --immutable

- name: Check TS
run: yarn ts-check

- name: Check lints
run: yarn lint

- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build Peregrine runtime
run: cargo build -p peregrine-runtime

- name: Run Chopsticks tests
run: yarn test:CI

cargo-test:
name: Run Cargo tests
runs-on: ubuntu-latest
needs: cargo-clippy

strategy:
matrix:
features:
-
- --all-features
fail-fast: false

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

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run `cargo test`
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "cargo test --all-targets --locked ${{ matrix.features }}"

cargo-doc:
name: Check Rustdoc
runs-on: ubuntu-latest
needs: cargo-clippy

strategy:
matrix:
features:
-
- --all-features
fail-fast: false

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

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run `cargo doc`
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "cargo doc --no-deps --locked ${{ matrix.features }}"

try-runtime:
name: Run try-runtime
runs-on: ubuntu-latest
needs: cargo-clippy
env:
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0
container:
image: paritytech/ci-unified:bullseye-1.74.0

strategy:
matrix:
runtime:
- peregrine
- spiritnet
fail-fast: false

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

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

- name: Install try-runtime
run: |
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
./try-runtime --version

- name: Set up Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build runtime
run: cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime

- name: Run `try-runtime`
run: |
./try-runtime \
--runtime=./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm \
on-runtime-upgrade \
--disable-spec-version-check \
--checks=all \
live \
--uri=wss://${{ matrix.runtime }}.kilt.io
37 changes: 0 additions & 37 deletions .github/workflows/check-fmt.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/docs-publish.yml

This file was deleted.

Loading
Loading