Skip to content

Attribute for checking of trivial encoding and decoding #26782

Attribute for checking of trivial encoding and decoding

Attribute for checking of trivial encoding and decoding #26782

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.93.0
NIGHTLY_RUST_VERSION: nightly-2026-03-06
jobs:
verifications-complete:
needs:
- check-dependency-version-formats
- check-forc-manifest-version
- build-sway-lib-std
- build-sway-examples
- build-reference-examples
- forc-fmt-check-sway-lib-std
- forc-fmt-check-sway-examples
- forc-fmt-check-panic
- check-sdk-harness-test-suite-compatibility
- build-mdbook
- build-forc-doc-sway-lib-std
- cargo-build-workspace
- cargo-clippy
- cargo-test-lib-std
- forc-run-benchmarks
- forc-unit-tests
- forc-pkg-fuels-deps-check
- cargo-test-tools
- cargo-unused-deps-check
- pre-publish-check
- cargo-run-e2e-test
- cargo-run-e2e-test-release
- notify-slack-on-failure
runs-on: ubuntu-latest
steps:
- run: echo "pass"
check-dependency-version-formats:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Cache check-dep-versions build
uses: Swatinem/rust-cache@v2
with:
key: check-dep-versions-${{ runner.os }}-${{ hashFiles('.github/scripts/check-dep-versions/Cargo.lock') }}
- name: Check Workspace Dependency Version Formats
run: |
cargo run --manifest-path .github/workflows/scripts/check-dep-versions/Cargo.toml --release -- Cargo.toml
check-forc-manifest-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Cache check-forc-manifest-version build
uses: Swatinem/rust-cache@v2
with:
key: check-forc-manifest-version-${{ runner.os }}-${{ hashFiles('.github/scripts/check-forc-manifest-version/Cargo.lock') }}
- name: Check Forc Manifest Version
run: |
cargo run --manifest-path .github/workflows/scripts/check-forc-manifest-version/Cargo.toml --release -- Cargo.toml
get-fuel-core-version:
runs-on: ubuntu-latest
outputs:
fuel_core_version: ${{steps.get_fuel_core_ver.outputs.version}}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: get fuel core version
id: get_fuel_core_ver
run: |
cargo install toml-cli
version=$(toml get Cargo.toml workspace.dependencies.fuel-core-client.version | tr -d '"')
echo "version=$version" >> "$GITHUB_OUTPUT"
build-sway-lib-std:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install Forc
run: cargo install --locked --path ./forc
- name: Build sway-lib-std
run: forc build --path sway-lib-std
build-sway-examples:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Build Sway examples workspace
run: cargo run --locked -p forc -- build --locked --path ./examples/Forc.toml
build-reference-examples:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Build Sway examples workspace
run: cargo run --locked -p forc -- build --locked --path ./docs/reference/src/code/Forc.toml
forc-fmt-check-sway-lib-std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
- name: Check Sway sway-lib-std formatting
run: cargo run --locked -p forc-fmt -- --check --path ./sway-lib-std
forc-fmt-check-sway-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
- name: Check Sway examples formatting
run: cargo run --locked -p forc-fmt -- --check --path ./examples
forc-fmt-check-panic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
- name: Install forc-fmt
run: cargo install --locked --path ./forc-plugins/forc-fmt
- name: Run the formatter against all sway projects and fail if any of them panic
run: scripts/formatter/forc-fmt-check-panic.sh
check-sdk-harness-test-suite-compatibility:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install toml-cli
run: cargo install toml-cli
- name: Read and compare versions
env:
PACKAGE_NAMES: "fuel-core-client,fuel-vm,fuels" # multiple packages can be specified delimited with `,`.
run: |
.github/workflows/scripts/check-sdk-harness-version.sh
build-mdbook:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install Forc
run: cargo install --locked --path ./forc
- name: Install Forc plugins
run: |
cargo uninstall forc-mcp || true
rm -f "${CARGO_HOME:-$HOME/.cargo}/bin/forc-mcp"
for dir in ./forc-plugins/*/; do
cargo install --locked --path "$dir"
done
cargo install --locked --debug --git https://github.com/FuelLabs/forc forc-crypto
cargo install --locked --debug --git https://github.com/FuelLabs/forc forc-node
- name: Install mdbook-forc-documenter
run: cargo install --locked --path ./scripts/mdbook-forc-documenter
- name: Run mdbook build
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.52"
- name: Emit book logs to tmp.txt, fail if build logs contain 'ERROR'
run: |
MDBOOK_preprocessor__FORC_documenter__STRICT="true" mdbook build docs/book 2>&1 | tee tmp.txt
if cat tmp.txt | grep 'ERROR'
then
cat tmp.txt
rm tmp.txt && exit 1
else
rm tmp.txt && exit 0
fi
- name: Emit reference logs to tmp.txt, fail if build logs contain 'ERROR'
run: |
mdbook build docs/reference
mdbook build docs/reference &> tmp.txt
if cat tmp.txt | grep 'ERROR'
then
cat tmp.txt
rm tmp.txt && exit 1
else
rm tmp.txt && exit 0
fi
build-forc-doc-sway-lib-std:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
- name: Install Forc
run: cargo install --locked --path ./forc
- name: Install Forc plugins
run: |
cargo install --locked --path ./forc-plugins/forc-doc
- name: Build sway-lib-std docs
run: forc doc --path ./sway-lib-std
cargo-build-workspace:
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: "Build Workspace"
run: cargo build --locked --workspace --all-features --all-targets
env:
RUSTFLAGS: "-D warnings"
cargo-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
- name: Check Clippy Linter
run: cargo clippy --all-features --all-targets -- -D warnings
cargo-toml-fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Install Cargo.toml linter
uses: baptiste0928/cargo-install@v1
with:
crate: cargo-toml-lint
version: "0.1"
- name: Run Cargo.toml linter
run: git ls-files | grep Cargo.toml$ | grep -v 'templates/' | xargs --verbose -n 1 cargo-toml-lint
cargo-fmt-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt
- name: Check Formatting
run: cargo fmt --all -- --check
cargo-run-e2e-test:
runs-on: warp-ubuntu-latest-x64-4x
needs: get-fuel-core-version
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "x86_64-unknown-linux-gnu, wasm32-unknown-unknown"
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install fuel-core for tests
run: |
curl -sSLf https://github.com/FuelLabs/fuel-core/releases/download/v${{ needs.get-fuel-core-version.outputs.fuel_core_version }}/fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu.tar.gz -L -o fuel-core.tar.gz
tar -xvf fuel-core.tar.gz
chmod +x fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu/fuel-core
mv fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu/fuel-core /usr/local/bin/fuel-core
- name: Cargo Run E2E Tests (Fuel VM)
run: |
fuel-core run --db-type in-memory --debug &
sleep 5 &&
cargo run --locked --release --bin test -- --locked
cargo-run-e2e-test-release:
runs-on: warp-ubuntu-latest-x64-4x
needs: get-fuel-core-version
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "x86_64-unknown-linux-gnu, wasm32-unknown-unknown"
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install fuel-core for tests
run: |
curl -sSLf https://github.com/FuelLabs/fuel-core/releases/download/v${{ needs.get-fuel-core-version.outputs.fuel_core_version }}/fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu.tar.gz -L -o fuel-core.tar.gz
tar -xvf fuel-core.tar.gz
chmod +x fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu/fuel-core
mv fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu/fuel-core /usr/local/bin/fuel-core
- name: Cargo Run E2E Tests (Fuel VM)
run: |
fuel-core run --db-type in-memory --debug &
sleep 5 &&
cargo run --locked --release --bin test -- --locked --release --verify-ir all --kind e2e
# TODO: Remove this upon merging std tests with the rest of the E2E tests.
cargo-test-lib-std:
runs-on: warp-ubuntu-latest-x64-8x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "x86_64-unknown-linux-gnu, wasm32-unknown-unknown"
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Build All Test Projects (Debug)
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests (Debug)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
- name: Build All Test Projects (Release)
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests (Release)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
- name: Build All Test Projects - ['new_hashing' disabled] (Debug)
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --no-experimental new_hashing --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests - ['new_hashing' disabled] (Debug)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
- name: Build All Test Projects - ['new_hashing' disabled] (Release)
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --no-experimental new_hashing --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests - ['new_hashing' disabled] (Release)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
- name: Build All Test Projects - ['str_array_no_padding' enabled] (Debug)
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --experimental str_array_no_padding --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests - ['str_array_no_padding' enabled] (Debug)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
- name: Build All Test Projects - ['str_array_no_padding' enabled] (Release)
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --experimental str_array_no_padding --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests - ['str_array_no_padding' enabled] (Release)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
- name: Build All Test Projects - ['dynamic_storage' enabled] (Debug)
run: cargo run --locked --release -p forc -- build --locked --path ./test/src/sdk-harness --experimental dynamic_storage --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests - ['dynamic_storage' enabled] (Debug)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --skip can_get_predicate_address --nocapture
- name: Build All Test Projects - ['dynamic_storage' enabled] (Release)
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --experimental dynamic_storage --output-directory ./test/src/sdk-harness/out
- name: Run All SDK Tests - ['dynamic_storage' enabled] (Release)
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
forc-run-benchmarks:
runs-on: warp-ubuntu-latest-x64-4x
environment: fuel-sway-bot
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install Forc
run: cargo install --locked --path ./forc
- name: Run benchmarks
run: ./benchmark.sh
- name: Checkout benchmark data
if: github.event_name != 'push'
uses: actions/checkout@v6
with:
repository: FuelLabs/sway-performance-data
path: performance-data
- name: Get GitHub app token
if: github.event_name == 'push'
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_KEY }}
owner: FuelLabs
- name: Checkout benchmark data
if: github.event_name == 'push'
uses: actions/checkout@v6
with:
repository: FuelLabs/sway-performance-data
path: performance-data
token: ${{ steps.app-token.outputs.token }}
- name: Prepare benchmarks data for commit
if: github.event_name == 'push'
run: ./benchmark.sh --prepare-for-commit
- uses: EndBug/add-and-commit@v9
with:
cwd: "./performance-data"
message: "Updated benchmark data"
default_author: github_actions
forc-unit-tests:
runs-on: warp-ubuntu-latest-x64-4x
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install Forc
run: cargo install --locked --path ./forc
- name: Run Std Unit Tests (Debug)
run: forc test --path sway-lib-std
- name: Run Std Unit Tests (Release)
run: forc test --release --path sway-lib-std
- name: Run Std Unit Tests - ['new_hashing' disabled] (Debug)
run: forc test --path sway-lib-std --no-experimental new_hashing
- name: Run Std Unit Tests - ['new_hashing' disabled] (Release)
run: forc test --release --path sway-lib-std --no-experimental new_hashing
- name: Run Std Unit Tests - ['str_array_no_padding' enabled] (Debug)
run: forc test --path sway-lib-std --experimental str_array_no_padding
- name: Run Std Unit Tests - ['str_array_no_padding' enabled] (Release)
run: forc test --release --path sway-lib-std --experimental str_array_no_padding
- name: Run Std Unit Tests - ['dynamic_storage' enabled] (Debug)
run: forc test --path sway-lib-std --experimental dynamic_storage
- name: Run Std Unit Tests - ['dynamic_storage' enabled] (Release)
run: forc test --release --path sway-lib-std --experimental dynamic_storage
- name: Run In Language Unit Tests (Debug)
run: forc test --error-on-warnings --path test/src/in_language_tests
- name: Run In Language Unit Tests (Release)
run: forc test --error-on-warnings --release --path test/src/in_language_tests
- name: Run In Language Unit Tests - ['new_hashing' disabled] (Debug)
run: forc test --error-on-warnings --path test/src/in_language_tests --no-experimental new_hashing
- name: Run In Language Unit Tests - ['new_hashing' disabled] (Release)
run: forc test --error-on-warnings --release --path test/src/in_language_tests --no-experimental new_hashing
- name: Run In Language Unit Tests - ['str_array_no_padding' enabled] (Debug)
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental str_array_no_padding
- name: Run In Language Unit Tests - ['str_array_no_padding' enabled] (Release)
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental str_array_no_padding
- name: Run In Language Unit Tests - ['dynamic_storage' enabled] (Debug)
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental dynamic_storage
- name: Run In Language Unit Tests - ['dynamic_storage' enabled] (Release)
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental dynamic_storage
forc-pkg-fuels-deps-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
# We require this check to avoid cyclic dependencies between 'fuels' and 'forc-pkg'.
# Detailed explanation is found in the echo below.
- name: Check 'forc-pkg' dependencies for 'fuels' crates
run: |
deps=$(cargo tree --manifest-path forc-pkg/Cargo.toml)
case "$deps" in
*fuels*)
echo -e "\nFound dependency on a 'fuels' crate.
To avoid cyclic dependencies between 'fuels' and 'forc-pkg',
we want to avoid using 'fuels' crates in 'forc-pkg' since 'fuels-rs' depends on 'forc-pkg' for its integration tests.
To fix this, please remove any 'fuels' dependency from forc-pkg/Cargo.toml.
Detailed explanation here: https://github.com/FuelLabs/fuels-rs/issues/752#issuecomment-1386242106"
exit 1
;;
*)
exit 0
;;
esac
cargo-test-tools:
name: Build and test various forc tools
runs-on: warp-ubuntu-latest-x64-4x
needs: get-fuel-core-version
strategy:
matrix:
tool:
- test: cargo test --locked --release -p forc-debug
- test: cargo nextest run --locked --release -p sway-lsp --no-capture --profile ci --config-file sway-lsp/tests/nextest.toml
- test: cargo test --locked --release -p forc -- --nocapture
- test: cargo test --locked --release --workspace --exclude forc-debug --exclude sway-lsp --exclude forc
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
targets: "x86_64-unknown-linux-gnu"
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
cache-provider: "warpbuild"
- name: Install nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Install fuel-core for tests
run: |
curl -sSLf https://github.com/FuelLabs/fuel-core/releases/download/v${{ needs.get-fuel-core-version.outputs.fuel_core_version }}/fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu.tar.gz -L -o fuel-core.tar.gz
tar -xvf fuel-core.tar.gz
chmod +x fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu/fuel-core
mv fuel-core-${{ needs.get-fuel-core-version.outputs.fuel_core_version }}-x86_64-unknown-linux-gnu/fuel-core /usr/local/bin/fuel-core
- name: Run tests
env:
RUST_BACKTRACE: full
run: ${{ matrix.tool.test }}
cargo-unused-deps-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
# `cargo-udeps` requires nightly to run
toolchain: ${{ env.NIGHTLY_RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "github"
- name: Install cargo-udeps
run: cargo install --locked cargo-udeps
- name: Check Unused Deps
run: cargo udeps --locked --all-targets
notify-slack-on-failure:
needs:
[
build-sway-examples,
build-sway-lib-std,
cargo-build-workspace,
cargo-clippy,
cargo-fmt-check,
cargo-run-e2e-test,
cargo-test-lib-std,
cargo-test-tools,
cargo-unused-deps-check,
]
runs-on: ubuntu-latest
steps:
- name: Notify Slack On Failure
uses: ravsamhq/notify-slack-action@v2
if: always() && github.ref == 'refs/heads/master'
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>"
footer: ""
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }}
# This job carries out some validation steps to prepare for a publish.
# This is a separate job because we want this to fail fast if something is invalid here.
pre-publish-check:
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Verify tag version
run: |
cargo install toml-cli
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }}
- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v2
if: always()
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>"
footer: ""
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }}
publish:
# Only do this job if publishing a release
needs:
[
build-sway-examples,
build-sway-lib-std,
cargo-build-workspace,
cargo-clippy,
cargo-fmt-check,
cargo-run-e2e-test,
cargo-test-lib-std,
cargo-test-tools,
cargo-unused-deps-check,
pre-publish-check,
]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: warp-ubuntu-latest-x64-2x # needs at least 100 gb hdd
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Publish crate
uses: FuelLabs/publish-crates@v1
with:
publish-delay: 30000
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v2
if: always()
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>"
footer: ""
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }}
publish-sway-lib-std:
needs: [publish, build-and-release-forc-binaries]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Publish sway-lib-std
run: |
cd sway-lib-std
cargo run --locked -p forc-publish
env:
FORC_PUB_TOKEN: ${{ secrets.FORCPUB_TOKEN }}
- name: Notify if Job Fails
uses: ravsamhq/notify-slack-action@v2
if: always()
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>"
footer: ""
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_NOTIFY_BUILD }}
build-and-release-forc-binaries:
name: Build and upload forc binaries to release
runs-on: ${{ matrix.job.os }}
if: github.event_name == 'release' && github.event.action == 'published'
needs: [publish]
permissions:
contents: write
strategy:
matrix:
job:
- os: ubuntu-24.04
platform: linux
target: x86_64-unknown-linux-gnu
arch: amd64
svm_target_platform: linux-amd64
cross_image: x86_64-linux-gnu
- os: ubuntu-24.04
platform: linux
target: aarch64-unknown-linux-gnu
arch: arm64
svm_target_platform: linux-aarch64
cross_image: aarch64-linux-gnu
- os: macos-14
platform: darwin
target: x86_64-apple-darwin
arch: amd64
svm_target_platform: macosx-amd64
- os: macos-14
platform: darwin
target: aarch64-apple-darwin
arch: arm64
svm_target_platform: macosx-aarch64
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup cross build environment
uses: FuelLabs/sway-nightly-binaries/.github/actions/setup-cross-build@0f842ee1f5c50f9260f0e6d09367b415dc572af8
with:
target: ${{ matrix.job.target }}
cross_image: ${{ matrix.job.cross_image }}
os: ${{ matrix.job.os }}
rust_version: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: "${{ matrix.job.target }}"
- name: Prepare RocksDB build env
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get install -y build-essential clang llvm-dev libclang-dev pkg-config
# ensure bindgen loads the freshly installed libclang runtime
echo "LIBCLANG_PATH=$(llvm-config --libdir)" >> "$GITHUB_ENV"
# ensure bindgen resolves standard headers on the runner
echo "BINDGEN_EXTRA_CLANG_ARGS=--sysroot=/usr" >> "$GITHUB_ENV"
- name: Use Cross
uses: baptiste0928/cargo-install@v1
with:
crate: cross
cache-key: "${{ matrix.job.target }}"
- name: Build forc binaries
run: cross build --profile=release --target ${{ matrix.job.target }} --bins
- name: Strip release binaries x86_64-linux-gnu
if: matrix.job.target == 'x86_64-unknown-linux-gnu'
run: |
for BINARY in forc forc-fmt forc-lsp forc-debug forc-doc forc-tx forc-migrate forc-publish; do
strip "target/${{ matrix.job.target }}/release/$BINARY"
done
- name: Strip release binaries aarch64-linux-gnu
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
for BINARY in forc forc-fmt forc-lsp forc-debug forc-doc forc-tx forc-migrate forc-publish; do
docker run --rm -v \
"$PWD/target:/target:Z" \
ghcr.io/cross-rs/${{ matrix.job.target }}:main \
aarch64-linux-gnu-strip \
/target/${{ matrix.job.target }}/release/$BINARY
done
- name: Strip release binaries mac
if: matrix.job.os == 'macos-latest'
run: |
for BINARY in forc forc-fmt forc-lsp forc-debug forc-doc forc-tx forc-migrate forc-publish; do
strip -x "target/${{ matrix.job.target }}/release/$BINARY"
done
- name: Prep Assets
id: prep_assets
env:
PLATFORM_NAME: ${{ matrix.job.platform }}
TARGET: ${{ matrix.job.target }}
ARCH: ${{ matrix.job.arch }}
run: |
ZIP_FILE_NAME=forc-binaries-${{ env.PLATFORM_NAME }}_${{ env.ARCH }}.tar.gz
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV
mkdir -pv ./forc-binaries
for BINARY in forc forc-fmt forc-lsp forc-debug forc-doc forc-tx forc-migrate forc-publish; do
cp "target/${{ matrix.job.target }}/release/$BINARY" ./forc-binaries
done
tar -czvf $ZIP_FILE_NAME ./forc-binaries
- name: Archive forc binaries
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ env.ZIP_FILE_NAME }}
asset_name: ${{ env.ZIP_FILE_NAME }}
asset_content_type: application/gzip