Skip to content

chore(deps): update rust - all minor and patch updates #1185

chore(deps): update rust - all minor and patch updates

chore(deps): update rust - all minor and patch updates #1185

name: Cargo check and test
on: [pull_request]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
get-version:
name: Get version
runs-on: ubuntu-latest
outputs:
toolchain: ${{ steps.get_toolchain.outputs.TOOLCHAIN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags
- run: pip3 install yq==2.13.0
- name: Get Build Version
id: get_version
run: ./scripts/check-version.sh
shell: bash
- name: Get Toolchain Version
id: get_toolchain
run: |
echo "TOOLCHAIN=$(cat rust-toolchain.toml | tomlq .toolchain.channel)" >> $GITHUB_OUTPUT
check-weights-have-changes:
name: Check Weights
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: check
id: check
run: |
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files"
files_changed_data=$(curl -s --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' -X GET -G "$URL")
files_changed="$(echo $files_changed_data | jq -r '.[] | .filename')"
# Adding || true to avoid "Process exited with code 1" errors
pallet_dirs_changed="$(echo "${files_changed}" | xargs dirname | grep -v "pallets/traits/*" | grep -v "pallets/doas/*" | grep -v "pallets/transaction-payment-free/*" | grep -o "pallets/[^/]*" | sort | uniq || true)"
pallets_requiring_weights=()
for pallet_dir in ${pallet_dirs_changed}; do
weights="$(echo "${files_changed}" | grep -o "${pallet_dir}/src/weights.rs" || true)"
if [[ -z "$weights" ]]; then pallets_requiring_weights+=($(basename $pallet_dir)); fi
done
echo "pallets=${pallets_requiring_weights[*]}" >> $GITHUB_OUTPUT
- name: Find Comment
id: find
uses: peter-evans/find-comment@v3
if: steps.check.outputs.pallets != ''
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: This PR updates the following pallets
- name: Create comment
uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.find.outputs.comment-id == '' && steps.find.outcome == 'success' }}
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
This PR updates the following pallets - they may also require updates to their extrinsic weights:
**${{ steps.check.outputs.pallets }}**
For the author and any reviewers:
- consider whether the changes could significantly affect the weight of any extrinsics
- consider whether benchmarks need updating to correctly cover weight variations over inputs
For a guide on running benchmarks to update weights see [calculating weights](https://github.com/digicatapult/sqnc-node#calculating-weights)
check:
name: Check and test
runs-on: ubuntu-latest
needs: [get-version]
steps:
- uses: actions/checkout@v4
- name: Install toolchains
run: |
rustup toolchain install ${{ needs.get-version.outputs.toolchain }}
rustup target add wasm32-unknown-unknown --toolchain ${{ needs.get-version.outputs.toolchain }}
rustup component add rust-src
- name: install protobuf compiler
run: sudo apt-get install protobuf-compiler
- name: Install sccache
env:
TEMP: ${{ runner.temp }}
run: |
curl -L https://github.com/gruntwork-io/fetch/releases/download/v0.4.6/fetch_linux_amd64 --output $TEMP/fetch
chmod +x $TEMP/fetch
$TEMP/fetch --repo="https://github.com/mozilla/sccache" --tag="~>0.7.5" --release-asset="^sccache-v[0-9.]*-x86_64-unknown-linux-musl.tar.gz$" $TEMP
tar -xvf $TEMP/sccache-v*-x86_64-unknown-linux-musl.tar.gz -C $TEMP
mv $TEMP/sccache-v*-x86_64-unknown-linux-musl/sccache $TEMP/sccache
rm -rf $TEMP/sccache-v*-x86_64-unknown-linux-musl $TEMP/sccache-v*-x86_64-unknown-linux-musl.tar.gz $TEMP/fetch
chmod +x $TEMP/sccache
- name: Install rustfmt
run: rustup component add rustfmt
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-index-
- name: Cache sccache
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/cache
key: ${{ runner.os }}-cargo-build-cache-debug-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-cargo-build-cache-debug-${{ hashFiles('**/Cargo.lock') }}
${{ runner.os }}-cargo-build-cache-debug-
- name: Cargo format
env:
RUSTC_WRAPPER: ${{ runner.temp }}/sccache
SCCACHE_DIR: ${{ runner.temp }}/cache
SCCACHE_CACHE_SIZE: "1G"
run: cargo fmt --check
- name: Cargo check
env:
RUSTC_WRAPPER: ${{ runner.temp }}/sccache
SCCACHE_DIR: ${{ runner.temp }}/cache
SCCACHE_CACHE_SIZE: "1G"
run: cargo check
- name: Cargo test
env:
RUSTC_WRAPPER: ${{ runner.temp }}/sccache
SCCACHE_DIR: ${{ runner.temp }}/cache
SCCACHE_CACHE_SIZE: "1G"
run: cargo test