From 94688fbafabdeda332abc8d59aef4619b2257fdb Mon Sep 17 00:00:00 2001 From: Bradley Olson <34992650+BradleyOlson64@users.noreply.github.com> Date: Mon, 1 Jul 2024 03:52:33 -0700 Subject: [PATCH] Updating the creditcoin build guide (#1628) also update actions used in CI config in order to make MegaLinter happy. --- .github/workflows/bench.yml | 4 +-- .github/workflows/ci.yml | 28 +++++++++---------- .github/workflows/extrinsics.yml | 4 +-- .github/workflows/llvm-cov.yml | 2 +- .github/workflows/release.yml | 8 +++--- .github/workflows/runtime-upgrade.yml | 12 ++++---- .github/workflows/runtime.yml | 2 +- .../dev-guide/src/getting-started/building.md | 22 ++++++--------- 8 files changed, 38 insertions(+), 44 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 8f02e3c2bc..f70beaf237 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -61,7 +61,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -70,7 +70,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build benchmarks - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release --features runtime-benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e879a7947d..a33f3bb44d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,7 +131,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -170,7 +170,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} profile: minimal @@ -178,7 +178,7 @@ jobs: components: rustfmt - name: Check formatting - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: fmt args: -- --check @@ -200,7 +200,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -210,7 +210,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run Clippy - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: clippy args: --all-targets --all-features -- -D warnings -A clippy::too_many_arguments -A clippy::type_complexity @@ -235,7 +235,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -270,7 +270,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -286,7 +286,7 @@ jobs: echo "RUSTDOCFLAGS=-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests" >> "$GITHUB_ENV" - name: Run tests - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: test args: --features=try-runtime -- --test-threads 1 @@ -349,7 +349,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -358,7 +358,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build SUT - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release --features fast-runtime @@ -469,7 +469,7 @@ jobs: node-version: 20 - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -776,7 +776,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -785,7 +785,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build benchmarks - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release --features runtime-benchmarks @@ -803,7 +803,7 @@ jobs: # check if automatically generated weights compile - name: Rebuild SUT with newly generated weights - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release diff --git a/.github/workflows/extrinsics.yml b/.github/workflows/extrinsics.yml index 10ac28c674..73a5ff201d 100644 --- a/.github/workflows/extrinsics.yml +++ b/.github/workflows/extrinsics.yml @@ -36,7 +36,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -45,7 +45,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build Release - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release diff --git a/.github/workflows/llvm-cov.yml b/.github/workflows/llvm-cov.yml index be205c6609..c23231b055 100644 --- a/.github/workflows/llvm-cov.yml +++ b/.github/workflows/llvm-cov.yml @@ -29,7 +29,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} components: llvm-tools-preview diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d325f9873b..fcaac9de57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -60,7 +60,7 @@ jobs: - name: Install MacOS aarch64 target if: matrix.operating-system == 'macos-11' - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: aarch64-apple-darwin @@ -87,14 +87,14 @@ jobs: echo "Tag & Platform is '${{ env.TAG_NAME }}-${{ env.PLATFORM }}'" - name: Build - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release - name: Build MacOS aarch64 target if: matrix.operating-system == 'macos-11' - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release --target aarch64-apple-darwin diff --git a/.github/workflows/runtime-upgrade.yml b/.github/workflows/runtime-upgrade.yml index 80d5616a79..dc96c2f6b0 100644 --- a/.github/workflows/runtime-upgrade.yml +++ b/.github/workflows/runtime-upgrade.yml @@ -115,7 +115,7 @@ jobs: echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} target: wasm32-unknown-unknown @@ -124,7 +124,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build SUT - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: build args: --release --features "try-runtime" @@ -373,14 +373,14 @@ jobs: sudo apt install -y gcc - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} profile: minimal override: true - name: Install Subwasm - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: install args: --locked --git https://github.com/chevdor/subwasm --tag v0.17.1 @@ -489,14 +489,14 @@ jobs: sudo apt install -y gcc - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: gluwa/toolchain@dev with: toolchain: ${{ env.RUSTC_VERSION }} profile: minimal override: true - name: Install Subwasm - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: install args: --locked --git https://github.com/chevdor/subwasm --tag v0.17.1 diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index 33451ac3b4..da5c1af5cf 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -58,7 +58,7 @@ jobs: yarn --cwd ./scripts/js upgrade 'creditcoin-js' - name: Install Subwasm - uses: actions-rs/cargo@v1 + uses: gluwa/cargo@dev with: command: install args: --locked --git https://github.com/chevdor/subwasm --tag v0.17.1 diff --git a/docs/dev-guide/src/getting-started/building.md b/docs/dev-guide/src/getting-started/building.md index 33542e7752..94e366b66e 100644 --- a/docs/dev-guide/src/getting-started/building.md +++ b/docs/dev-guide/src/getting-started/building.md @@ -13,25 +13,19 @@ not by installing your distro's `rust` package which will most likely be too old For the installation you can refer to [these instructions](https://www.rust-lang.org/tools/install). -Once you have a working rust installation, you'll need to add the `wasm32-unknown-unknown` target and install the nightly toolchain +Once you have rustup, you'll need to do the following. +1. Install and the nightly rust toolchain specified in [./ci/env](https://github.com/gluwa/creditcoin/blob/dev/ci/env). Creditcoin uses the feature `stdsimd` which was removed in later nightly versions. +2. Set the newly installed toolchain as the default for your creditcoin checkout +3. Add the `wasm32-unknown-unknown` target ```bash -rustup update -rustup toolchain install nightly +# In place of `nightly-2023-06-06, use the version specified in ci/env +rustup install nightly-2023-06-06 +# Set the newly installed toolchain as default for your creditcoin checkout +rustup override set nightly-2023-06-06 rustup target add wasm32-unknown-unknown --nightly ``` -Note: So that you don't have to specify the toolchain every build, you can set `nightly` as your default toolchain while working on creditcoin. - -You can also check -[./ci/env](https://github.com/gluwa/creditcoin/blob/dev/ci/env) -for the toolchain being used in our CI in case you run into issues with newer version before we notice them. - -```bash -# set nightly as default for your creditcoin checkout -rustup override set nightly -``` - ### System build dependencies You'll need a few system dependencies (some extra dependencies may be required depending on the platform, but