Skip to content

Commit

Permalink
Improve ci & update rust toolchain (Snowfork#858)
Browse files Browse the repository at this point in the history
* Upgrade rust toolchain

* Update readme

* Rustup show
  • Loading branch information
yrong authored Jun 16, 2023
1 parent f48605c commit 4f91b1a
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 78 deletions.
113 changes: 55 additions & 58 deletions .github/workflows/parachain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,15 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('parachain/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: install protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-04-22
target: wasm32-unknown-unknown
- name: setup rust toolchain
run: rustup show
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
toolchain: nightly-2023-04-22
args: >-
--manifest-path parachain/Cargo.toml
--workspace
--features runtime-benchmarks
run: >
cargo check
--manifest-path parachain/Cargo.toml
--workspace
--features runtime-benchmarks
test:
needs: check
runs-on: snowbridge-runner
Expand All @@ -71,43 +62,34 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('parachain/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: arduino/setup-protoc@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-04-22
target: wasm32-unknown-unknown
- name: setup rust toolchain
run: rustup show
# Increase stack limit for beacon light client tests
- run: sudo prlimit --pid $$ --stack=32768
# Run tests for everything except the beacon light client
- uses: actions-rs/cargo@v1
with:
command: test
args: >-
--manifest-path parachain/Cargo.toml
--workspace
--features runtime-benchmarks
--exclude snowbridge-query-events
--exclude snowbridge-ethereum-beacon-client
toolchain: nightly-2023-04-22
- name: Tests for everything except the beacon light client
run: >
cargo test
--manifest-path parachain/Cargo.toml
--workspace
--features runtime-benchmarks
--exclude snowbridge-query-events
--exclude snowbridge-ethereum-beacon-client
# Run tests for beacon light client, excluding benchmark tests
- uses: actions-rs/cargo@v1
with:
command: test
args: >-
--manifest-path parachain/Cargo.toml
--package snowbridge-ethereum-beacon-client
toolchain: nightly-2023-04-22
- name: Tests for beacon light client excluding benchmark tests
run: >
cargo test
--manifest-path parachain/Cargo.toml
--package snowbridge-ethereum-beacon-client
# Run benchmark tests for beacon light client
- uses: actions-rs/cargo@v1
with:
command: test
args: >-
--manifest-path parachain/Cargo.toml
--release
--features runtime-benchmarks
--package snowbridge-ethereum-beacon-client
toolchain: nightly-2023-04-22
- name: Benchmark tests for beacon light client
run: >
cargo test
--manifest-path parachain/Cargo.toml
--release
--features runtime-benchmarks
--package snowbridge-ethereum-beacon-client
coverage:
needs: check
runs-on: snowbridge-runner
Expand All @@ -120,14 +102,11 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: arduino/setup-protoc@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-04-22
target: wasm32-unknown-unknown
- run: cargo install cargo-tarpaulin
- run: >-
- name: setup rust toolchain
run: rustup show
- name: run coverage test
run: >
cargo install cargo-tarpaulin &&
cargo tarpaulin
--manifest-path parachain/Cargo.toml
--workspace
Expand All @@ -139,4 +118,22 @@ jobs:
uses: codecov/codecov-action@v3
with:
working-directory: parachain
files: cobertura.xml
files: cobertura.xml

check-cumulus-bridgehub:
runs-on: snowbridge-runner
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: setup rust toolchain
run: rustup show
- name: check bridge-hub runtime
run: >
cargo check
--manifest-path cumulus/Cargo.toml
--release --verbose
--package bridge-hub-rococo-runtime
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ cp .envrc.example .envrc
direnv allow
````

## Upgrade

Sometimes we would like to upgrade rust toolchain. First update `parachain/rust-toolchain.toml` as required and then update `flake.lock` running
```sh
nix flake lock --update-input rust-overlay
```

## Security

The security policy and procedures can be found in SECURITY.md.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
pkgs = import nixpkgs { inherit system overlays; };
cwd = builtins.toString ./.;
rust =
pkgs.rust-bin.fromRustupToolchainFile "${cwd}/parachain/rust-toolchain.toml";
pkgs.rust-bin.fromRustupToolchainFile "${cwd}/rust-toolchain.toml";
in
with pkgs;
{
Expand Down
19 changes: 0 additions & 19 deletions parachain/rust-toolchain.toml

This file was deleted.

10 changes: 10 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[toolchain]
channel = "1.69.0"
components = [
"clippy",
"rust-analyzer",
"rust-src",
"rustfmt",
]
targets = ["wasm32-unknown-unknown"]
profile = "minimal"

0 comments on commit 4f91b1a

Please sign in to comment.