ci: add beta releasy to fuels-rs to track fuel-core #4774
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.20.6 | |
RUST_VERSION: 1.72.1 | |
FORC_VERSION: 0.46.0 | |
FORC_PATCH_BRANCH: "" | |
FORC_PATCH_REVISION: "" | |
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 | |
working-directory: packages/fuels | |
- name: Build Sway test projects | |
run: forc build --terse --error-on-warnings | |
working-directory: packages/fuels | |
- uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 2 | |
name: sway-examples | |
# cache only the sway build artifacts, skip all src files | |
path: | | |
packages/fuels/tests | |
!packages/fuels/tests/*.rs | |
!packages/fuels/tests/**/*.rs | |
!packages/fuels/tests/**/*.sw | |
!packages/fuels/tests/**/Forc.toml | |
!packages/fuels/tests/**/Forc.lock | |
!packages/fuels/tests/.gitignore | |
# 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 --terse --json-abi-with-callpaths | |
working-directory: packages/fuels | |
- uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 2 | |
name: sway-examples-w-type-paths | |
# cache only the sway build artifacts, skip all src files | |
path: | | |
packages/fuels/tests | |
!packages/fuels/tests/*.rs | |
!packages/fuels/tests/**/*.rs | |
!packages/fuels/tests/**/*.sw | |
!packages/fuels/tests/**/Forc.toml | |
!packages/fuels/tests/**/Forc.lock | |
!packages/fuels/tests/.gitignore | |
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: katyo/publish-crates@v2 | |
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" --workspace | |
download_sway_artifacts: sway-examples-w-type-paths | |
install_fuel_core: true | |
- cargo_command: nextest | |
args: run --all-targets --workspace | |
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: | |
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: | | |
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 | |
- name: Download sway example artifacts | |
if: ${{ matrix.download_sway_artifacts }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ matrix.download_sway_artifacts }} | |
path: packages/fuels/tests/ | |
- 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 packages/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" | |
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: katyo/publish-crates@v2 | |
with: | |
publish-delay: 30000 | |
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |