Skip to content

v0.62.0

v0.62.0 #5802

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
env:
CARGO_TERM_COLOR: always
DASEL_VERSION: https://github.com/TomWright/dasel/releases/download/v2.3.6/dasel_linux_amd64
RUSTFLAGS: "-D warnings"
FUEL_CORE_VERSION: 0.26.0
FUEL_CORE_PATCH_BRANCH:
RUST_VERSION: 1.76.0
FORC_VERSION: 0.58.0
FORC_PATCH_BRANCH: "esdrubal/abi_hash_ids"
FORC_PATCH_REVISION: ""
NEXTEST_HIDE_PROGRESS_BAR: "true"
NEXTEST_STATUS_LEVEL: "fail"
jobs:
setup-test-projects:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
- name: Set git config
run: |
git config --global core.bigfilethreshold 100m
- name: Install forc and forc-fmt
run: |
if [[ -n $FORC_PATCH_BRANCH ]]; then
cargo install --locked forc forc-fmt --git https://github.com/FuelLabs/sway --branch $FORC_PATCH_BRANCH
elif [[ -n $FORC_PATCH_REVISION ]]; then
cargo install --locked forc forc-fmt --git https://github.com/FuelLabs/sway --rev $FORC_PATCH_REVISION
else
curl -sSLf https://github.com/FuelLabs/sway/releases/download/v${{ env.FORC_VERSION }}/forc-binaries-linux_amd64.tar.gz -L -o forc.tar.gz
tar -xvf forc.tar.gz
chmod +x forc-binaries/forc
mv forc-binaries/forc /usr/local/bin/forc
mv forc-binaries/forc-fmt /usr/local/bin/forc-fmt
fi
- name: Check format of Sway test projects
run: forc fmt --check --path e2e
- name: Build Sway test projects
run: forc build --release --terse --error-on-warnings --path e2e
- uses: actions/upload-artifact@v4
with:
retention-days: 2
name: sway-examples
path: |
e2e/sway/**/out/*
# TODO: To be removed once https://github.com/FuelLabs/fuels-rs/issues/881 is unblocked.
- name: Build Sway test projects w type paths
run: forc build --release --terse --error-on-warnings --json-abi-with-callpaths --path e2e
- uses: actions/upload-artifact@v4
with:
retention-days: 2
name: sway-examples-w-type-paths
path: |
e2e/sway/**/out/*
get-workspace-members:
runs-on: ubuntu-latest
outputs:
members: ${{ steps.set-members.outputs.members }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- id: set-members
run: |
# install dasel
curl -sSLf "$DASEL_VERSION" -L -o dasel && chmod +x dasel
mv ./dasel /usr/local/bin/dasel
members=$(cat Cargo.toml | dasel -r toml -w json 'workspace.members' | jq -r ".[]" | xargs -I '{}' dasel -f {}/Cargo.toml 'package.name' | jq -R '[.]' | jq -s -c 'add')
echo "members=$members" >> $GITHUB_OUTPUT
verify-rust-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Ensure CI is using the same minimum toolchain specified in fuels Cargo.toml
- run: |
curl -sSLf "$DASEL_VERSION" -L -o dasel && chmod +x dasel
mv ./dasel /usr/local/bin/dasel
MIN_VERSION=$(cat Cargo.toml | dasel -r toml 'workspace.package.rust-version' -w plain)
RUST_VERSION="${{ env.RUST_VERSION }}"
echo "Comparing minimum supported toolchain ($MIN_VERSION) with ci toolchain (RUST_VERSION)"
test "$MIN_VERSION" == "$RUST_VERSION"
# Ensure workspace is publishable
publish-crates-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Publish crate check
uses: xgreenx/publish-crates@v1
with:
dry-run: true
check-repo: false
ignore-unpublished-changes: true
cargo-verifications:
needs:
- setup-test-projects
- verify-rust-version
- get-workspace-members
- publish-crates-check
runs-on: ubuntu-latest
strategy:
matrix:
cargo_command: [check]
args: [--all-features]
package: ${{fromJSON(needs.get-workspace-members.outputs.members)}}
include:
- cargo_command: fmt
args: --all --verbose -- --check
- cargo_command: clippy
args: --all-targets
download_sway_artifacts: sway-examples
- cargo_command: clippy
args: --all-targets --features "default fuel-core-lib test-type-paths"
download_sway_artifacts: sway-examples-w-type-paths
- cargo_command: nextest
args: run --all-targets --features "default fuel-core-lib test-type-paths coin-cache" --workspace --cargo-quiet
download_sway_artifacts: sway-examples-w-type-paths
install_fuel_core: true
- cargo_command: nextest
args: run --all-targets --workspace --cargo-quiet
download_sway_artifacts: sway-examples
install_fuel_core: true
- cargo_command: test
args: --doc --workspace
- cargo_command: machete
args: --skip-target-dir
- command: test_wasm
args:
- command: check_doc_anchors_valid
args:
- command: check_doc_unresolved_links
args:
- command: check_typos
args:
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy,rustfmt
# selecting a toolchain either by action or manual `rustup` calls should happen
# before the cache plugin, as it uses the current rustc version as its cache key
- uses: Swatinem/rust-cache@v2.0.1
continue-on-error: true
with:
key: "${{ matrix.cargo_command }} ${{ matrix.args }} ${{ matrix.package }}"
- name: Install Fuel Core
if: ${{ matrix.install_fuel_core }}
run: |
if [[ -n $FUEL_CORE_PATCH_BRANCH ]]; then
cargo install --locked fuel-core-bin --git https://github.com/FuelLabs/fuel-core --branch "$FUEL_CORE_PATCH_BRANCH"
else
curl -sSLf https://github.com/FuelLabs/fuel-core/releases/download/v${{ env.FUEL_CORE_VERSION }}/fuel-core-${{ env.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-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu/fuel-core
mv fuel-core-${{ env.FUEL_CORE_VERSION }}-x86_64-unknown-linux-gnu/fuel-core /usr/local/bin/fuel-core
fi
- name: Download sway example artifacts
if: ${{ matrix.download_sway_artifacts }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.download_sway_artifacts }}
# Needed because `upload-artifact` will remove 'e2e/sway' because it is shared between all matched files
path: e2e/sway/
- name: Install nextest
if: ${{ matrix.cargo_command == 'nextest' }}
uses: taiki-e/install-action@nextest
- name: Install cargo-machete
if: ${{ matrix.cargo_command == 'machete' }}
uses: taiki-e/install-action@cargo-machete
- name: Cargo (workspace-level)
if: ${{ matrix.cargo_command && !matrix.package }}
run: cargo ${{ matrix.cargo_command }} ${{ matrix.args }}
- name: Cargo (package-level)
if: ${{ matrix.cargo_command && matrix.package }}
run: cargo ${{ matrix.cargo_command }} -p ${{ matrix.package }} ${{ matrix.args }}
- name: Install NodeJS for WASM testing
if: ${{ matrix.command == 'test_wasm' }}
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test WASM
if: ${{ matrix.command == 'test_wasm' }}
run: |
rustup target add wasm32-unknown-unknown
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cd wasm-tests
wasm-pack test --node
- name: Check for invalid documentation anchors
if: ${{ matrix.command == 'check_doc_anchors_valid' }}
run: cargo run --bin check-docs
- name: Check for unresolved documentation links
if: ${{ matrix.command == 'check_doc_unresolved_links' }}
run: |
! cargo doc --document-private-items |& grep -A 6 "warning: unresolved link to"
- name: Check for typos
if: ${{ matrix.command == 'check_typos' }}
uses: crate-ci/typos@v1.20.3
publish:
needs:
- cargo-verifications
- publish-crates-check
# Only do this job if publishing a release
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Verify tag version
run: |
curl -sSLf "$DASEL_VERSION" -L -o dasel && chmod +x dasel
mv ./dasel /usr/local/bin/dasel
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} Cargo.toml
- name: Publish crate
uses: xgreenx/publish-crates@v1
with:
publish-delay: 30000
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}