mirror of
https://github.com/FuelLabs/sway.git
synced 2025-12-23 10:11:56 +00:00
Some checks failed
CI / build-sway-examples (push) Has been cancelled
Codspeed Benchmarks / benchmarks (push) Has been cancelled
CI / check-dependency-version-formats (push) Has been cancelled
CI / check-forc-manifest-version (push) Has been cancelled
CI / get-fuel-core-version (push) Has been cancelled
CI / build-sway-lib-std (push) Has been cancelled
CI / build-reference-examples (push) Has been cancelled
CI / forc-fmt-check-sway-lib-std (push) Has been cancelled
CI / forc-fmt-check-sway-examples (push) Has been cancelled
CI / forc-fmt-check-panic (push) Has been cancelled
CI / check-sdk-harness-test-suite-compatibility (push) Has been cancelled
CI / build-mdbook (push) Has been cancelled
CI / build-forc-doc-sway-lib-std (push) Has been cancelled
CI / build-forc-test-project (push) Has been cancelled
CI / cargo-build-workspace (push) Has been cancelled
CI / cargo-clippy (push) Has been cancelled
CI / cargo-toml-fmt-check (push) Has been cancelled
CI / cargo-fmt-check (push) Has been cancelled
CI / cargo-test-lib-std (push) Has been cancelled
CI / forc-run-benchmarks (push) Has been cancelled
CI / forc-unit-tests (push) Has been cancelled
CI / forc-pkg-fuels-deps-check (push) Has been cancelled
CI / cargo-unused-deps-check (push) Has been cancelled
CI / pre-publish-check (push) Has been cancelled
github pages / deploy (push) Has been cancelled
CI / verifications-complete (push) Has been cancelled
CI / cargo-run-e2e-test (push) Has been cancelled
CI / cargo-run-e2e-test-release (push) Has been cancelled
CI / Build and test various forc tools (push) Has been cancelled
CI / notify-slack-on-failure (push) Has been cancelled
CI / publish (push) Has been cancelled
CI / publish-sway-lib-std (push) Has been cancelled
CI / Build and upload forc binaries to release (push) Has been cancelled
Fixes #7433
917 lines
34 KiB
YAML
917 lines
34 KiB
YAML
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.90.0
|
|
NIGHTLY_RUST_VERSION: nightly-2025-09-28
|
|
|
|
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
|
|
- build-forc-test-project
|
|
- 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@v3
|
|
|
|
- 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@v3
|
|
|
|
- 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@v3
|
|
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v2
|
|
|
|
- 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" # multiple packages can be specified delimeted with `,`.
|
|
run: |
|
|
.github/workflows/scripts/check-sdk-harness-version.sh
|
|
|
|
build-mdbook:
|
|
runs-on: warp-ubuntu-latest-x64-4x
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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: |
|
|
for dir in ./forc-plugins/*/; do
|
|
cargo install --locked --path "$dir"
|
|
done
|
|
- 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.25"
|
|
- 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@v3
|
|
- 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
|
|
|
|
build-forc-test-project:
|
|
runs-on: warp-ubuntu-latest-x64-4x
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_VERSION }}
|
|
targets: wasm32-unknown-unknown
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
cache-provider: "warpbuild"
|
|
- name: Install Forc
|
|
run: cargo install --locked --path ./forc
|
|
- name: Initialize test project
|
|
run: forc new test-proj
|
|
- name: Update project forc manifest to use local sway-lib-std
|
|
run: echo "std = { path = \"../sway-lib-std/\" }" >> test-proj/Forc.toml
|
|
- name: Build test project
|
|
run: forc build --path test-proj
|
|
# TODO: Re-add this upon landing unit test support: #1832
|
|
# - name: Run test project's test suite
|
|
# run: (cd test-proj && forc test)
|
|
- name: Install cargo-generate
|
|
run: cargo install --locked cargo-generate
|
|
- name: Install fuel-core
|
|
run: cargo install --locked fuel-core-bin
|
|
- name: Generate Rust Integration Tests
|
|
run: (cd test-proj && cargo generate --init --path ../templates/sway-test-rs --name test-proj)
|
|
- name: Update project cargo manifest with workspace
|
|
run: |
|
|
echo "
|
|
|
|
[workspace]" >> test-proj/Cargo.toml
|
|
- name: Build and Run Default Integration Test
|
|
run: (cd test-proj && cargo test --release)
|
|
|
|
cargo-build-workspace:
|
|
runs-on: warp-ubuntu-latest-x64-8x
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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@v3
|
|
- 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
|
|
|
|
# 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@v3
|
|
- 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 Tests
|
|
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness
|
|
- name: Test All Tests
|
|
run: cargo run --locked --release -p forc -- test --release --locked --path ./test/src/sdk-harness
|
|
- name: Cargo Test sway-lib-std
|
|
run: cargo test --locked --release --manifest-path ./test/src/sdk-harness/Cargo.toml -- --nocapture
|
|
- name: Build All Tests - Experimental Feature 'new_hashing' disabled
|
|
run: cargo run --locked --release -p forc -- build --release --locked --path ./test/src/sdk-harness --no-experimental new_hashing
|
|
- name: Test All Tests - Experimental Feature 'new_hashing' disabled
|
|
run: cargo run --locked --release -p forc -- test --release --locked --path ./test/src/sdk-harness --no-experimental new_hashing
|
|
- name: Cargo Test sway-lib-std - Experimental Feature 'new_hashing' disabled
|
|
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@v3
|
|
- 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@v3
|
|
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@v3
|
|
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@v3
|
|
- 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 - Experimental feature 'const_generics' (Debug)
|
|
run: forc test --path sway-lib-std --experimental const_generics
|
|
- name: Run Std Unit Tests - Experimental feature 'const_generics' (Release)
|
|
run: forc test --release --path sway-lib-std --experimental const_generics
|
|
- name: Run Std Unit Tests - Experimental feature 'new_hashing' (Debug)
|
|
run: forc test --path sway-lib-std --no-experimental new_hashing
|
|
- name: Run Std Unit Tests - Experimental feature 'new_hashing' (Release)
|
|
run: forc test --release --path sway-lib-std --no-experimental new_hashing
|
|
- name: Run Std Unit Tests - Experimental feature 'const_generics,new_hashing' (Debug)
|
|
run: forc test --path sway-lib-std --experimental const_generics --no-experimental new_hashing
|
|
- name: Run Std Unit Tests - Experimental feature 'const_generics,new_hashing' (Release)
|
|
run: forc test --release --path sway-lib-std --experimental const_generics --no-experimental new_hashing
|
|
- 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 - Experimental feature 'const_generics' (Debug)
|
|
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental const_generics
|
|
- name: Run In Language Unit Tests - Experimental feature 'const_generics' (Release)
|
|
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental const_generics
|
|
- name: Run In Language Unit Tests - Experimental feature 'new_hashing' (Debug)
|
|
run: forc test --error-on-warnings --path test/src/in_language_tests --no-experimental new_hashing
|
|
- name: Run In Language Unit Tests - Experimental feature 'new_hashing' (Release)
|
|
run: forc test --error-on-warnings --release --path test/src/in_language_tests --no-experimental new_hashing
|
|
- name: Run In Language Unit Tests - Experimental feature 'const_generics,new_hashing' (Debug)
|
|
run: forc test --error-on-warnings --path test/src/in_language_tests --experimental const_generics --no-experimental new_hashing
|
|
- name: Run In Language Unit Tests - Experimental feature 'const_generics,new_hashing' (Release)
|
|
run: forc test --error-on-warnings --release --path test/src/in_language_tests --experimental const_generics --no-experimental new_hashing
|
|
|
|
forc-pkg-fuels-deps-check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- 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-client -- --test-threads 1
|
|
- test: cargo test --locked --release -p forc-debug
|
|
- test: cargo test --locked --release -p forc-client -- --test-threads 1
|
|
- test: cargo test --locked --release -p forc-mcp -- --test-threads 1
|
|
- test: cargo test --locked --release -p forc-node -- --test-threads 1
|
|
- 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-client --exclude forc-mcp --exclude forc --exclude forc-node
|
|
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@v3
|
|
- 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-forc-test-project,
|
|
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@v3
|
|
|
|
- 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-forc-test-project,
|
|
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@v3
|
|
|
|
- name: Install toolchain
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_VERSION }}
|
|
|
|
- name: Link forc-mcp docs into Cargo target
|
|
run: |
|
|
set -euo pipefail
|
|
DOCS_SRC="${{ github.workspace }}/docs/book/src/forc/plugins/forc_mcp/forc_call_tool"
|
|
DOCS_DST="${{ github.workspace }}/target/docs/book/src/forc/plugins/forc_mcp/forc_call_tool"
|
|
mkdir -p "$(dirname "$DOCS_DST")"
|
|
ln -sfn "$DOCS_SRC" "$DOCS_DST"
|
|
|
|
- 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-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-mcp forc-migrate forc-node forc-publish forc-call; 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-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-mcp forc-migrate forc-node forc-publish forc-call; 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-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-mcp forc-migrate forc-node forc-publish forc-call; 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-deploy forc-run forc-doc forc-crypto forc-tx forc-submit forc-mcp forc-migrate forc-node forc-publish forc-call; 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
|