Skip to content

Commit

Permalink
506 switch to stable rust toolchain channel (#513)
Browse files Browse the repository at this point in the history
* initial push

* fix unused implementor in `reward-distribution`,
and add a step in CI to install rust nightly version

* * wrap Amount in another trait (in redeem pallet) to be able to mock it

* revert runtime-benchmark requirements in mock.rs of all pallets

* go to previous day nightly version

* set override to false

* specific toolchain

* fix clippy issues;
create a matrix to install rust stable and nightly separately

* do not allow parallel

* `--lib`, not `--libs`

* fix nightly ci

* fix nightly ci

* convert to lib

* fix clippy command and install nightly using `dtolnay`

* fix nightly CI

* use a newer nightly toolchain and update readme;
fix example code;
update the cargo lock

* fix warnings and use and older toolchain because of `The 'cargo' binary, normally provided by the 'cargo' component, is not applicable to the nightly`

* use new version

* change all .md to run tests with `+nightly`

* applied cargo fmt

* specify the nightly version in readmes;
and use a variable to assign value of the nightly version in CIs

* FIX YAML FILE

* revert yaml file

* https://github.com/pendulum-chain/spacewalk/actions/runs/8876331480/job/24367603763?pr=513#step:13:15,
#513 (comment),
#513 (comment),

* no need to define the nightly version
#513 (review)

* revert `testing-utils` of pallet `currency`, and build packages individually, instead of `--all-features`

* #513 (comment)

* fix https://github.com/pendulum-chain/spacewalk/actions/runs/8922194140/job/24503885678?pr=513#step:11:658

* #513 (comment)

* Update .github/workflows/ci-dev.yml

Co-authored-by: Marcel Ebert <[email protected]>

* https://github.com/pendulum-chain/spacewalk/actions/runs/8922961363/job/24506180390?pr=513#step:11:3011

cargo build is too heavy; opting with check instead

* https://github.com/pendulum-chain/spacewalk/actions/runs/8924275855/job/24510269896

* uncomment all lines

* had to remove `service` as it requires a companion lib: the `runtime`.

also added `set -e` to make sure the script exits upon the first error found

* https://github.com/pendulum-chain/spacewalk/actions/runs/8926871185/job/24518930774#step:11:70

* https://github.com/pendulum-chain/spacewalk/actions/runs/8927530752/job/24521111869?pr=513#step:14:20,
cleanup the cmd-all command of clippy for `runner`

* #513 (review)

* fix rewards-distribution test issue
add more comments/explanations

* #513 (comment)

* revise description of `cmd-all`

---------

Co-authored-by: Marcel Ebert <[email protected]>
  • Loading branch information
b-yap and ebma authored May 7, 2024
1 parent ea66a30 commit 1c3ea1c
Show file tree
Hide file tree
Showing 77 changed files with 1,915 additions and 1,320 deletions.
39 changes: 30 additions & 9 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
max-parallel: 1
matrix:
os: [ ubuntu-latest, macos-latest ]
rust: [stable, nightly]
include:
- os: ubuntu-latest
sccache-path: /home/runner/.cache/sccache
Expand Down Expand Up @@ -54,9 +55,28 @@ jobs:
brew install sccache
- name: Setup Rust toolchain
if: matrix.rust == 'stable'
# Call `rustup show` as a hack so that the toolchain defined in rust-toolchain.toml is installed
run: rustup show

- name: Remove rust-toolchain.toml for nightly
if: matrix.rust == 'nightly'
# To make sure that the nightly version will be used all throughout
run: |
rm /home/runner/work/spacewalk/spacewalk/rust-toolchain.toml
- name: Setup nightly Rust toolchain
if: matrix.rust == 'nightly'
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-02-09
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Setup nightly Rust as default
if: matrix.rust == 'nightly'
run: rustup default nightly-2024-02-09

- name: Use Cache
uses: Swatinem/rust-cache@v2
with:
Expand All @@ -75,38 +95,39 @@ jobs:
- name: Start sccache server
run: sccache --start-server


- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features
- name: Check Build
if: matrix.rust == 'stable'
run: |
bash ./scripts/cmd-all build check
- name: Test
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
env:
env:
SOURCE_STELLAR_SECRET_MAINNET: ${{ secrets.SOURCE_STELLAR_SECRET_MAINNET }}
SOURCE_STELLAR_SECRET_TESTNET: ${{ secrets.SOURCE_STELLAR_SECRET_TESTNET }}
DEST_STELLAR_SECRET_MAINNET: ${{ secrets.DEST_STELLAR_SECRET_MAINNET }}
DEST_STELLAR_SECRET_TESTNET: ${{ secrets.DEST_STELLAR_SECRET_TESTNET }}
with:
toolchain: nightly-2024-02-09
command: test
args: --all --all-features

- name: Rustfmt
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-02-09
command: fmt
args: --all -- --check

- name: Print sccache stats
run: sccache --show-stats

- name: Stop sccache server
run: sccache --stop-server || true

run: sccache --stop-server || true
56 changes: 41 additions & 15 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
name: continuous-integration-main
jobs:
ci:
strategy:
max-parallel: 1
matrix:
rust: [stable, nightly]
runs-on: ubuntu-20.04
env:
RUST_BACKTRACE: full
Expand Down Expand Up @@ -36,10 +40,29 @@ jobs:
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y protobuf-compiler libprotobuf-dev
- name: Setup Rust toolchain
- name: Setup stable Rust toolchain
if: matrix.rust == 'stable'
# Call `rustup show` as a hack so that the toolchain defined in rust-toolchain.toml is installed
run: rustup show

- name: Remove rust-toolchain.toml for nightly
if: matrix.rust == 'nightly'
# To make sure that the nightly version will be used all throughout
run: |
rm /home/runner/work/spacewalk/spacewalk/rust-toolchain.toml
- name: Setup nightly Rust toolchain
if: matrix.rust == 'nightly'
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-02-09
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Setup nightly Rust as default
if: matrix.rust == 'nightly'
run: rustup default nightly-2024-02-09

- name: Use Cache
uses: Swatinem/rust-cache@v2
with:
Expand All @@ -52,38 +75,41 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features
- name: Check Build
if: matrix.rust == 'stable'
run: |
bash ./scripts/cmd-all build check
- name: Test
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
env:
env:
SOURCE_STELLAR_SECRET_MAINNET: ${{ secrets.SOURCE_STELLAR_SECRET_MAINNET }}
SOURCE_STELLAR_SECRET_TESTNET: ${{ secrets.SOURCE_STELLAR_SECRET_TESTNET }}
DEST_STELLAR_SECRET_MAINNET: ${{ secrets.DEST_STELLAR_SECRET_MAINNET }}
DEST_STELLAR_SECRET_TESTNET: ${{ secrets.DEST_STELLAR_SECRET_TESTNET }}
with:
toolchain: nightly-2024-02-09
command: test
args: --all --all-features

- name: Rustfmt
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-02-09
command: fmt
args: --all -- --check

- name: Clippy -- Main
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -W clippy::all -A clippy::style -A clippy::forget_copy -A clippy::forget_ref
- name: Clippy -- Libraries and Binaries
if: matrix.rust == 'stable'
run: |
bash ./scripts/cmd-all clippy "clippy --lib --bins" "-- -W clippy::all -A clippy::style -A forgetting_copy_types -A forgetting_references"
- name: Clippy -- All Targets
- name: Clippy -- Tests and Examples
if: matrix.rust == 'nightly'
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-02-09
command: clippy
# We are a bit more forgiving when it comes to the code in tests and only check for correctness
args: --all-features --all-targets -- -A clippy::all -W clippy::correctness -A clippy::forget_copy -A clippy::forget_ref
args: --all-features --tests --benches --examples -- -A clippy::all -W clippy::correctness -A forgetting_copy_types -A forgetting_references
Loading

0 comments on commit 1c3ea1c

Please sign in to comment.