Skip to content

fix: add RVRT to unallowed opcodes for predicates #21249

fix: add RVRT to unallowed opcodes for predicates

fix: add RVRT to unallowed opcodes for predicates #21249

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
REGISTRY: ghcr.io
RUST_VERSION: 1.79.0
NIGHTLY_RUST_VERSION: nightly-2024-07-16
jobs:
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-core:
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
- name: Install Forc
run: cargo install --locked --debug --path ./forc
- name: Build sway-lib-core
run: forc build --path sway-lib-core
build-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
- name: Install Forc
run: cargo install --locked --debug --path ./forc
- name: Build sway-lib-std
run: forc build --path sway-lib-std
build-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
- name: Build Sway examples workspace
run: cargo run --locked -p forc -- build --locked --path ./examples/Forc.toml
build-reference-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
- 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-core:
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
- name: Check Sway sway-lib-core formatting
run: cargo run --locked -p forc-fmt -- --check --path ./sway-lib-core
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
- 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
- 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
- name: Install forc-fmt
run: cargo install --locked --debug --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: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: buildjet/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Forc
run: cargo install --locked --debug --path ./forc
- name: Install Forc plugins
run: |
cargo install --locked --debug --path ./forc-plugins/forc-fmt
cargo install --locked --debug --path ./forc-plugins/forc-lsp
cargo install --locked --debug --path ./forc-plugins/forc-client
cargo install --locked --debug --path ./forc-plugins/forc-debug
cargo install --locked --debug --path ./forc-plugins/forc-doc
cargo install --locked --debug --path ./forc-plugins/forc-tx
cargo install --locked --debug --path ./forc-plugins/forc-crypto
cargo install --locked --debug forc-explore
- name: Install mdbook-forc-documenter
run: cargo install --locked --debug --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
- name: Install Forc
run: cargo install --locked --debug --path ./forc
- name: Install Forc plugins
run: |
cargo install --locked --debug --path ./forc-plugins/forc-doc
- name: Build sway-lib-std docs
run: forc doc --manifest-path ./sway-lib-std
build-forc-test-project:
runs-on: ubuntu-latest
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
- name: Install Forc
run: cargo install --locked --debug --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: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: Swatinem/rust-cache@v2
- 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
- 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: ubuntu-latest
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
- 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: ubuntu-latest
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
- 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
cargo-run-e2e-test-evm:
runs-on: ubuntu-latest
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
- name: Cargo Run E2E Tests (EVM)
run: cargo run --locked --release --bin test -- --target evm --locked --no-encoding-v1
cargo-run-e2e-test-midenvm:
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
- name: Cargo Run E2E Tests (EVM)
run: cargo run --locked --release --bin test -- --target midenvm --locked --no-encoding-v1
# TODO: Remove this upon merging std tests with the rest of the E2E tests.
cargo-test-lib-std:
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
- uses: buildjet/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build All Tests
run: cargo run --locked --release -p forc -- build --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
forc-run-benchmarks:
runs-on: ubuntu-latest
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
- name: Install Forc
run: cargo install --locked --debug --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: Checkout benchmark data
if: github.event_name == 'push'
uses: actions/checkout@v3
with:
repository: FuelLabs/sway-performance-data
path: performance-data
token: ${{ secrets.CI_ACCOUNT_PAT }}
- 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: 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
- name: Install Forc
run: cargo install --locked --debug --path ./forc
- name: Run Unit Tests
run: forc build --path sway-lib-core && forc test --path sway-lib-core && forc build --path sway-lib-std && forc test --path sway-lib-std && forc build --path test/src/in_language_tests & forc test --path test/src/in_language_tests
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
- name: Install cargo-deps
run: cargo install cargo-deps
# 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 deps --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-forc-debug:
runs-on: ubuntu-latest
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
- 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
run: cargo test --locked --release -p forc-debug
cargo-test-forc-client:
runs-on: ubuntu-latest
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
- 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
run: cargo test --locked --release -p forc-client -- --test-threads 1
cargo-test-sway-lsp:
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
- name: Run sway-lsp tests sequentially
env:
RUST_BACKTRACE: full
run: cargo test --locked --release -p sway-lsp -- --nocapture --test-threads=1
cargo-test-workspace:
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
- name: Run tests
run: cargo test --locked --release --workspace --exclude forc-debug --exclude sway-lsp --exclude forc-client
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
- 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-core,
build-sway-lib-std,
cargo-build-workspace,
cargo-clippy,
cargo-fmt-check,
cargo-run-e2e-test,
cargo-run-e2e-test-evm,
cargo-test-lib-std,
cargo-test-workspace,
cargo-test-sway-lsp,
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 }} forc/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-pkg/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-client/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-debug/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-doc/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-fmt/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-lsp/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-tx/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-plugins/forc-crypto/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-test/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-tracing/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} forc-util/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-ast/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-core/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-error/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-ir/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-ir/sway-ir-macros/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-lsp/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-parse/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-types/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} sway-utils/Cargo.toml
./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} swayfmt/Cargo.toml
- 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-core,
build-sway-lib-std,
cargo-build-workspace,
cargo-clippy,
cargo-fmt-check,
cargo-run-e2e-test,
cargo-run-e2e-test-evm,
cargo-test-lib-std,
cargo-test-workspace,
cargo-test-sway-lsp,
cargo-unused-deps-check,
pre-publish-check,
]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Checkout repository
uses: actions/checkout@v3
- 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 }}
build-publish-master-image:
needs:
[
build-forc-test-project,
build-sway-examples,
build-sway-lib-core,
build-sway-lib-std,
cargo-build-workspace,
cargo-clippy,
cargo-fmt-check,
cargo-run-e2e-test,
cargo-run-e2e-test-evm,
cargo-test-lib-std,
cargo-test-workspace,
cargo-test-sway-lsp,
cargo-unused-deps-check,
]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/forc
tags: |
type=sha
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}
labels: |
org.opencontainers.image.title=forc
org.opencontainers.image.description=Fuel Orchestrator.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- 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-publish-release-image:
# Build & Publish Docker Image Per Sway Release
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/sway
tags: |
type=semver,pattern={{raw}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- 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
strategy:
matrix:
job:
- os: ubuntu-20.04
platform: linux
target: x86_64-unknown-linux-gnu
arch: amd64
svm_target_platform: linux-amd64
- os: ubuntu-20.04
platform: linux
target: aarch64-unknown-linux-gnu
arch: arm64
svm_target_platform: linux-aarch64
- os: macos-latest
platform: darwin
target: x86_64-apple-darwin
arch: amd64
svm_target_platform: macosx-amd64
- os: macos-latest
platform: darwin
target: aarch64-apple-darwin
arch: arm64
svm_target_platform: macosx-aarch64
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
target: ${{ matrix.job.target }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: "${{ matrix.job.target }}"
- 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; 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; 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; 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; 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