Skip to content

Commit

Permalink
Updating the creditcoin build guide (#1628)
Browse files Browse the repository at this point in the history
also update actions used in CI config in order to make MegaLinter happy.
  • Loading branch information
BradleyOlson64 authored Jul 1, 2024
1 parent 6c6b825 commit 94688fb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -170,15 +170,15 @@ 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
override: true
components: rustfmt

- name: Check formatting
uses: actions-rs/cargo@v1
uses: gluwa/cargo@dev
with:
command: fmt
args: -- --check
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/extrinsics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/llvm-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/runtime-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 8 additions & 14 deletions docs/dev-guide/src/getting-started/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 94688fb

Please sign in to comment.