Skip to content

Commit

Permalink
CI workflow improvements (#81)
Browse files Browse the repository at this point in the history
* CI worflow improvements

* fixes

* cleanup

* cancel previous

* fix

* ...

* fix

* Delete .github/workflows/cancel.yml

* efficiency

* fix

* setup fix

* fix

* fixes

* revert the basic CI

* tarpaulin

* revert cache version

* fix

* fixes

* Update coverage.yml

* syntax fyx

* Update action.yml

* switch to stable

* rust-src
  • Loading branch information
Szegoo authored Apr 17, 2024
1 parent 0fb8b20 commit d6313a1
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ runs:
rustup component add clippy --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup component add rust-src
rustup show
shell: bash
6 changes: 5 additions & 1 deletion .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

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

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
fmt:
Expand Down Expand Up @@ -50,7 +54,7 @@ jobs:
run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV

- name: Cargo clippy
run: cargo +nightly clippy -- -D warnings
run: cargo clippy -- -D warnings

- name: Check Code
run: cargo check
4 changes: 4 additions & 0 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Benchmarks
on:
workflow_dispatch:

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

jobs:
benchmark:
runs-on: ubuntu-22.04
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test coverage

on:
# Triggers the workflow on push or pull request events but only for the main branch
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

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

env:
TARPAULIN_VERSION: 0.27.3

jobs:
coverage:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/setup

- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.GH_TOKEN }}

- name: Use Git CLI for Cargo
run: echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV

- name: Run cargo-tarpaulin
run: |
wget https://github.com/xd009642/tarpaulin/releases/download/${{ env.TARPAULIN_VERSION }}/cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz
tar -zxvf cargo-tarpaulin-x86_64-unknown-linux-musl.tar.gz -C $HOME/.cargo/bin
cargo tarpaulin --workspace \
-e regionx-node regionx-runtime \
--exclude-files **/mock.rs **/weights/* \
--out xml
- uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: RegionX-Labs/RegionX-Node
10 changes: 5 additions & 5 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
- main
workflow_dispatch:

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

jobs:
check-dependencies:
runs-on: ubuntu-latest
Expand All @@ -18,11 +22,7 @@ jobs:
- uses: ./.github/actions/setup

- name: Install Rust
run: |
rustup show
rustup toolchain install nightly
cargo install --git https://github.com/paritytech/psvm psvm
run: cargo install --git https://github.com/paritytech/psvm psvm
- name: Check Dependency Versions
run: |
chmod +x ./scripts/check-dependency-versions.sh
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ name: Smoke tests
on:
workflow_dispatch:

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

jobs:
smoke:
runs-on: ubuntu-latest

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- uses: ./.github/actions/setup

- name: Zombienet setup
run: |
wget https://github.com/paritytech/zombienet/releases/download/v1.3.100/zombienet-linux-x64
Expand All @@ -26,16 +32,11 @@ jobs:
- name: Pull Docker Image
run: docker pull szegoo/regionx-node:latest

- name: Create Container
id: create-container
run: |
container_id=$(docker create szegoo/regionx-node:latest)
echo "::set-output name=container_id::$container_id"

- name: Copy Executable from Container
- name: Compile regionx-node
run: |
docker cp ${{ steps.create-container.outputs.container_id }}:/usr/bin/regionx-node .
cargo build --release
cp ./target/release/regionx-node .
- name: Run smoke test 0001
run: ./zombienet-linux-x64 -p native test ./zombienet_tests/0001-smoke-test.zndsl
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Tests
on:
workflow_dispatch:

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

jobs:
test:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/try_runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Try-runtime
on:
workflow_dispatch:

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

jobs:
try-runtime:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly"
channel = "stable"
components = [ "rustfmt", "clippy" ]
targets = [ "wasm32-unknown-unknown"]
profile = "minimal"

0 comments on commit d6313a1

Please sign in to comment.