Skip to content

Commit

Permalink
fix: šŸ©¹ Minor integration test and comment fixes (and testing Blacksmiā€¦
Browse files Browse the repository at this point in the history
ā€¦th runners) (#380)

* ci: šŸ‘· Use blacksmith runners for GH actions

* ci: āœ… Changes in comments of the runtime to trigger build in CI

* ci: šŸ‘· Use Blacksmith's cached Docker builds

* ci: šŸ‘· Remove `cache-from` and `cache-to` (also trying BS cache)

* ci: šŸ‘· Optimise VCPUs used for each job

* fix: āœ… Fix what to `waitFor` in `onboard` test

* ci: šŸ‘· Persist `./target` folder in Blacksmith Sticky Disk

* ci: šŸ¤” Empty commit to trigger CI

* ci: šŸ‘· Enable cargo incremental build

* ci: šŸ’š Remove use of sccache to enable incremental builds

* revert: āŖ Rollback blacksmith runners test
  • Loading branch information
ffarall authored Feb 28, 2025
1 parent 946b1a8 commit dea0e2b
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 112 deletions.
6 changes: 3 additions & 3 deletions .github/workflow-templates/setup-pnpm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ description: Installs pnpm and caches the pnpm store

inputs:
node_version:
description: 'Node.js version'
default: '22'
description: "Node.js version"
default: "22"
required: false

runs:
Expand Down Expand Up @@ -33,4 +33,4 @@ runs:
path: ${{ steps.get_pnpm_store.outputs.store_path }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
${{ runner.os }}-pnpm-store-
4 changes: 2 additions & 2 deletions .github/workflows/api-augment-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: pnpm/action-setup@v4
with:
version: 9

- name: Use Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -38,4 +38,4 @@ jobs:
cd api-augment
pnpm publish ${{ github.event.inputs.DryRun && '--dry-run' || '' }} --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4 changes: 2 additions & 2 deletions .github/workflows/api-augment-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: mozilla-actions/sccache-action@v0.0.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8
with:
cache: false
cache: false
- uses: rui314/setup-mold@v1
- uses: ./.github/workflow-templates/setup-pnpm
- name: Install libpq-dev
Expand All @@ -52,4 +52,4 @@ jobs:
draft: true
title: "Upgrade TypeScript API for runtime-${{ github.event.inputs.sha }}"
reviewers: "moonsong-coredev"
labels: "B0-silent,D2-notlive"
labels: "B0-silent,D2-notlive"
174 changes: 87 additions & 87 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,95 +9,95 @@
name: Rust Tests

on:
pull_request:
push:
branches:
- main
workflow_dispatch:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
setup:
runs-on: ubuntu-latest
outputs:
node_changed: ${{ steps.node_check.outputs.changed }}
env:
SKIP_BUILD_LABEL_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'skip-node-build') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if Parachain Node needs rebuild
id: node_check
run: |
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before }}"
HEAD_SHA="${{ github.sha }}"
setup:
runs-on: ubuntu-latest
outputs:
node_changed: ${{ steps.node_check.outputs.changed }}
env:
SKIP_BUILD_LABEL_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'skip-node-build') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if Parachain Node needs rebuild
id: node_check
run: |
BASE_SHA="${{ github.event.pull_request.base.sha || github.event.before }}"
HEAD_SHA="${{ github.sha }}"
if [[ "${{ env.SKIP_BUILD_LABEL_PRESENT }}" != "true" ]] && git diff --name-only $BASE_SHA $HEAD_SHA | grep -E '^(client|node|pallets|runtime)/|^Cargo\.toml$'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "Comparing changes from $BASE_SHA to $HEAD_SHA"
echo "changed=false" >> $GITHUB_OUTPUT
fi
if [[ "${{ env.SKIP_BUILD_LABEL_PRESENT }}" != "true" ]] && git diff --name-only $BASE_SHA $HEAD_SHA | grep -E '^(client|node|pallets|runtime)/|^Cargo\.toml$'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "Comparing changes from $BASE_SHA to $HEAD_SHA"
echo "changed=false" >> $GITHUB_OUTPUT
fi
prepare:
needs: [setup]
if: needs.setup.outputs.node_changed == 'true'
name: Prepare artifacts
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
with:
# By default actions/checkout checks out a merge commit. Check out the PR head instead.
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rust-lang/setup-rust-toolchain@v1.8
with:
cache: false
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- uses: rui314/setup-mold@v1
- name: Install nextest
uses: taiki-e/install-action@nextest
# Install libpq-dev
- name: Install libpq-dev
run: sudo apt-get update && sudo apt-get install -y libpq-dev
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Build and archive tests
run: cargo nextest archive --archive-file nextest-archive.tar.zst
- name: Upload archive to workflow
uses: actions/upload-artifact@v4
with:
name: nextest-archive
path: nextest-archive.tar.zst
prepare:
needs: [setup]
if: needs.setup.outputs.node_changed == 'true'
name: Prepare artifacts
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CARGO_INCREMENTAL: "0"
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
with:
# By default actions/checkout checks out a merge commit. Check out the PR head instead.
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rust-lang/setup-rust-toolchain@v1.8
with:
cache: false
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- uses: rui314/setup-mold@v1
- name: Install nextest
uses: taiki-e/install-action@nextest
# Install libpq-dev
- name: Install libpq-dev
run: sudo apt-get update && sudo apt-get install -y libpq-dev
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Build and archive tests
run: cargo nextest archive --archive-file nextest-archive.tar.zst
- name: Upload archive to workflow
uses: actions/upload-artifact@v4
with:
name: nextest-archive
path: nextest-archive.tar.zst

all-rust-tests:
needs: [setup, prepare]
if: needs.setup.outputs.node_changed == 'true'
name: Run all tests (/w partitioning)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
partition: [1, 2]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Download archive
uses: actions/download-artifact@v4
with:
name: nextest-archive
- name: Run Tests for All Projects!
run: |
~/.cargo/bin/cargo-nextest nextest run \
--archive-file nextest-archive.tar.zst \
--partition count:${{ matrix.partition }}/2
all-rust-tests:
needs: [setup, prepare]
if: needs.setup.outputs.node_changed == 'true'
name: Run all tests (/w partitioning)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
partition: [1, 2]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Download archive
uses: actions/download-artifact@v4
with:
name: nextest-archive
- name: Run Tests for All Projects!
run: |
~/.cargo/bin/cargo-nextest nextest run \
--archive-file nextest-archive.tar.zst \
--partition count:${{ matrix.partition }}/2
2 changes: 1 addition & 1 deletion .github/workflows/types-bundle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
package: types-bundle/package.json
registry: https://registry.npmjs.org/
access: public
dry-run: ${{ github.event.inputs.dry_run }}
dry-run: ${{ github.event.inputs.dry_run }}
6 changes: 3 additions & 3 deletions client/actors-framework/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub trait Actor: Sized {

/// Handles a message received by the actor.
///
/// * `message` - The message to be handled.
/// - `message` - The message to be handled.
///
fn handle_message(
&mut self,
Expand All @@ -47,8 +47,8 @@ pub trait Actor: Sized {
pub trait ActorEventLoop<T: Actor> {
/// Creates a new instance of the event loop.
///
/// * `actor` - The actor instance.
/// * `receiver` - The receiver for the actor's messages.
/// - `actor` - The actor instance.
/// - `receiver` - The receiver for the actor's messages.
///
fn new(actor: T, receiver: sc_utils::mpsc::TracingUnboundedReceiver<T::Message>) -> Self;

Expand Down
4 changes: 2 additions & 2 deletions client/forest-manager/src/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use crate::{
/// by attempting to find leaves that are exact matches or close neighbors to the challenged key.
///
/// # Arguments
/// * `trie` - A trie data structure from which an iterator is created.
/// * `challenged_file_key` - The key for which the proof is being constructed. This function
/// - `trie` - A trie data structure from which an iterator is created.
/// - `challenged_file_key` - The key for which the proof is being constructed. This function
/// will seek this key within the trie to determine relational nodes.
///
/// # Returns
Expand Down
18 changes: 9 additions & 9 deletions primitives/treasury-funding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ where
/// ```
///
/// where:
/// * `x` is the system utilisation rate, i.e. fraction of the total storage being provided in the system
/// - `x` is the system utilisation rate, i.e. fraction of the total storage being provided in the system
/// that is currently being used.
/// * `d` is the falloff or `decay_rate`. A co-efficient dictating the strength of the global incentivisation to get the `ideal_system_utilisation`. A higher number results in less
/// - `d` is the falloff or `decay_rate`. A co-efficient dictating the strength of the global incentivisation to get the `ideal_system_utilisation`. A higher number results in less
/// typical funds to the treasury at the cost of greater volatility for providers, since the treasury cut will be more sensitive to changes in the system utilisation rate.
/// `d` then should be bigger than 0.01, as if the falloff is smaller than 1%, the treasury cut will get to its maximum value with a really small change in the system utilisation rate over the ideal,
/// as the exponential that calculates the adjustment will be really close to 1.
/// `d` should also be smaller than `(1 - x_ideal) / 3`, as if the falloff is bigger than that, the maximum value of the exponential that calculates the adjustment will be always less than 90% even at 100% utilisation,
/// making it so the treasury cut will max out at barely over 90% of the maximum treasury cut instead of the full 100%.
/// * `x_ideal` is the ideal system utilisation rate.
/// - `x_ideal` is the ideal system utilisation rate.
///
/// The parameters utilized in the calculation are provided by the configuration trait `LinearThenPowerOfTwoTreasuryCutCalculatorConfig`.
pub struct LinearThenPowerOfTwoTreasuryCutCalculator<
Expand Down Expand Up @@ -163,20 +163,20 @@ where
/// ```
///
/// where:
/// * x is the system utilisation rate, i.e. fraction of the total storage being provided in the system
/// - x is the system utilisation rate, i.e. fraction of the total storage being provided in the system
/// that is currently being used.
/// * d is the falloff or `decay_rate`
/// * x_ideal: the ideal system utilisation rate.
/// - d is the falloff or `decay_rate`
/// - x_ideal: the ideal system utilisation rate.
///
/// The result is meant to be scaled with the minimum percentage amount and maximum percentage amount
/// that goes to the treasury.
///
/// Arguments are:
/// * `system_utilisation`: The fraction of the total storage being provided in the system that is
/// - `system_utilisation`: The fraction of the total storage being provided in the system that is
/// currently being used. Known as `x` in the literature. Must be between 0 and 1.
/// * `ideal_system_utilisation`: The fraction of total storage being provided in the system that should
/// - `ideal_system_utilisation`: The fraction of total storage being provided in the system that should
/// be being actively used. Known as `x_ideal` in the literature. Must be between 0 and 1.
/// * `falloff`: Known as `decay_rate` in the literature. A co-efficient dictating the strength of
/// - `falloff`: Known as `decay_rate` in the literature. A co-efficient dictating the strength of
/// the global incentivisation to get the `ideal_system_utilisation`. A higher number results in less typical
/// funds to the treasury at the cost of greater volatility for providers. Must be more than 0.01.
///
Expand Down
7 changes: 4 additions & 3 deletions test/suites/integration/bsp/onboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ describeBspNet("BSPNet: Adding new BSPs", ({ before, createUserApi, createApi, i

await it("is peer of other nodes", async () => {
await waitFor({
lambda: async () => (await userApi.rpc.system.peers()).length > 0
lambda: async () => {
const peers = (await userApi.rpc.system.peers()).map(({ peerId }) => peerId.toString());
return peers.includes(peerId);
}
});
const peers = (await userApi.rpc.system.peers()).map(({ peerId }) => peerId.toString());
strictEqual(peers.includes(peerId), true, `PeerId ${peerId} not found in ${peers}`);
});
});

Expand Down

0 comments on commit dea0e2b

Please sign in to comment.