Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: checks tool #1385

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
4edfedf
move e2e tests into separate crate
May 11, 2024
0024c6f
update ci
May 11, 2024
ab94801
fix doc links
May 11, 2024
c0526e2
clippy fix
May 11, 2024
07c0355
move test-type-paths to e2e
May 11, 2024
221ed86
cargo hack passing, std needs sorting out
May 11, 2024
da324d1
use crate level std feature
May 11, 2024
dc2262f
lessen features
May 11, 2024
d2225d2
fuels accounts unused crate deps
May 11, 2024
9eab659
fuels core deps
May 11, 2024
55ee802
fuels programs unused deps
May 11, 2024
4b3b421
cleanup std flags
May 11, 2024
81e99d5
move back fuel-tx
May 11, 2024
88bbec3
checks tool wip
May 12, 2024
85a1623
prepare for doc check integration
May 12, 2024
bd870b5
wip
May 13, 2024
942e1c8
fix unit tests
May 13, 2024
3cb0237
wip
May 14, 2024
d4e882e
remove target
May 14, 2024
792dd18
move forc
May 14, 2024
c678645
Update packages/fuels-code-gen/src/program_bindings/abigen/bindings/s…
segfault-magnet May 14, 2024
d3fbb43
propagate feature flags
May 14, 2024
d9511d0
fix coin cache usage of fuel core types
May 14, 2024
1b04bfb
fix forc path
May 14, 2024
39718c1
Merge remote-tracking branch 'origin/refactor/move_e2e_tests' into bu…
May 14, 2024
64b02d0
wip again
May 14, 2024
142f9e5
Merge remote-tracking branch 'origin/master' into bug/fix_deps
May 14, 2024
76656ba
add typos
May 14, 2024
ca8c7e9
move config to rust based
May 16, 2024
6bd0805
graceful shutdown
May 16, 2024
1277993
normal checks passing
May 16, 2024
bd30cf9
move parsing of cargo to a build script
May 16, 2024
7d01bbb
wip
May 16, 2024
e19a773
fix cargodoc flag
May 16, 2024
5ec656b
cargo hack passed
May 16, 2024
eaf766c
Merge remote-tracking branch 'origin/master' into bug/fix_deps
May 16, 2024
2a44943
deny unused crate deps
May 16, 2024
2b00675
split off udeps check
May 17, 2024
8c43184
Merge remote-tracking branch 'origin/master' into bug/fix_deps
May 17, 2024
e6d060f
simplify
May 18, 2024
615dd5b
fix ci jobs gen
May 19, 2024
463f0b5
fix type paths flag
May 19, 2024
e7cfeb5
fix ci
May 19, 2024
8cd77ea
fix checks generation stage
May 19, 2024
9eedae9
use debug checks
May 19, 2024
63f81f1
change how output is generated
May 19, 2024
01f4904
fix output gen again
May 19, 2024
8b440e8
fix path
May 19, 2024
8b79b0c
wrong path
May 19, 2024
5a1cccf
make checks executable
May 19, 2024
f11e7c1
add mandatory root parameter
May 19, 2024
918c892
typos download
May 19, 2024
7c19d44
fix typos extracting
May 19, 2024
f15bc42
add name to matrix tasks
May 19, 2024
05cf1b3
fix names
May 19, 2024
ad82288
add examples dep
May 19, 2024
54ebde3
debug
May 19, 2024
8d34270
fix cache
May 19, 2024
7c5f030
fix type paths dep
May 19, 2024
ded67cb
missing tests
May 19, 2024
17a1059
fix type paths
May 19, 2024
7dfbae4
fix task ids
May 19, 2024
a050f63
reorg
May 20, 2024
156286f
reorg
May 20, 2024
e77e15f
clippy
May 20, 2024
f783d88
fix unification
May 20, 2024
b2087d7
self review
May 21, 2024
56dd3f0
Merge remote-tracking branch 'origin/master' into bug/fix_deps
May 21, 2024
30a0439
nits
May 21, 2024
3e3ca45
nits
May 21, 2024
c2d25c5
fix ci
May 21, 2024
0dcc6a2
remove debug
May 21, 2024
56ea526
Merge remote-tracking branch 'origin/master' into bug/fix_deps
May 22, 2024
9cba587
use workspace package spec
May 22, 2024
860f228
sort cargo
May 22, 2024
acee784
integrate fuel core version check
May 22, 2024
f814602
Merge branch 'master' into bug/fix_deps
hal3e May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 84 additions & 88 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:
NEXTEST_STATUS_LEVEL: "fail"

jobs:
setup-test-projects:
compile_sway_projects:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -82,20 +82,39 @@ jobs:
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
build-checks-binary:
runs-on: ubuntu-latest
outputs:
config: ${{ steps.generate-config.outputs.config }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}

- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"

- name: Build checks binary
run: cargo build --package checks --bin checks

- name: Upload checks binary
uses: actions/upload-artifact@v4
with:
name: checks-binary
path: target/debug/checks

- name: Generate config
id: generate-config
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "config<<$EOF" >> "$GITHUB_OUTPUT"
./target/debug/checks -r . --dump-ci-config >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"

verify-rust-version:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -130,66 +149,44 @@ jobs:

cargo-verifications:
needs:
- setup-test-projects
- compile_sway_projects
- verify-rust-version
- get-workspace-members
- build-checks-binary
- 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_fuel_core_version
args:
- command: check_doc_anchors_valid
args:
- command: check_doc_unresolved_links
args:
- command: check_typos
args:
config: ${{fromJSON(needs.build-checks-binary.outputs.config)}}
name: ${{ matrix.config.name }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: dtolnay/rust-toolchain@master

- name: Install Rust toolchain
if: ${{ matrix.config.deps.rust && matrix.config.deps.rust.nightly == false }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy,rustfmt
components: ${{ matrix.config.deps.rust.components || '' }}

# 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
- name: Install Rust nightly toolchain
if: ${{ matrix.config.deps.rust && matrix.config.deps.rust.nightly == true }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: ${{ matrix.config.deps.rust.components || '' }}

# 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 }}"
key: "${{ matrix.config.cache_key }}"

- name: Install Fuel Core
if: ${{ matrix.install_fuel_core }}
if: ${{ matrix.config.deps.fuel_core_binary }}
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"
Expand All @@ -200,60 +197,59 @@ jobs:
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 }}
- name: Download sway example artifacts (Normal)
if: ${{ matrix.config.deps.sway_artifacts == 'Normal' }}
uses: actions/download-artifact@v4
with:
name: sway-examples
# Needed because `upload-artifact` will remove 'e2e/sway' because it is shared between all matched files
path: e2e/sway/

- name: Download sway example artifacts (TypePaths)
if: ${{ matrix.config.deps.sway_artifacts == 'TypePaths' }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.download_sway_artifacts }}
name: sway-examples-w-type-paths
# 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' }}
if: ${{ matrix.config.deps.cargo.nextest }}
uses: taiki-e/install-action@nextest

- name: Install cargo-machete
if: ${{ matrix.cargo_command == 'machete' }}
if: ${{ matrix.config.deps.cargo.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' }}
if: ${{ matrix.config.deps.wasm }}
uses: actions/setup-node@v3
with:
node-version: 18

- name: Test WASM
if: ${{ matrix.command == 'test_wasm' }}
- name: Install wasm toolchain
if: ${{ matrix.config.deps.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 that fuel_core version.rs file is up to date
if: ${{ matrix.command == 'check_fuel_core_version' }}
run: cargo run --bin fuel-core-version -- --manifest-path ./Cargo.toml verify
- name: Install typos tool
if: ${{ matrix.config.deps.typos_cli }}
run: |
curl -sSLf 'https://github.com/crate-ci/typos/releases/download/v1.21.0/typos-v1.21.0-x86_64-unknown-linux-musl.tar.gz' > typos.tar.gz
tar xf typos.tar.gz --wildcards "./typos" && rm typos.tar.gz
chmod +x typos
mv typos /usr/local/bin/typos

- name: Check for invalid documentation anchors
if: ${{ matrix.command == 'check_doc_anchors_valid' }}
run: cargo run --bin check-docs
- name: Download checks binary
uses: actions/download-artifact@v4
with:
name: checks-binary

- name: Check for unresolved documentation links
if: ${{ matrix.command == 'check_doc_unresolved_links' }}
- name: Run checks
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
chmod +x checks
./checks --only-tasks-with-ids ${{ matrix.config.task_ids }} --root . --sway-type-paths

publish:
needs:
Expand Down
72 changes: 42 additions & 30 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ members = [
"packages/fuels-macros",
"packages/fuels-programs",
"packages/fuels-test-helpers",
"scripts/check-docs",
"scripts/fuel-core-version",
"scripts/checks",
"scripts/versions-replacer",
"wasm-tests",
]
Expand All @@ -41,40 +40,53 @@ rust-version = "1.76.0"
version = "0.62.0"

[workspace.dependencies]
Inflector = "0.11.4"
Inflector = { version = "0.11.4", default-features = false }
async-trait = { version = "0.1.74", default-features = false }
bech32 = "0.9.1"
bech32 = { version = "0.9.1", default-features = false }
bytes = { version = "1.5.0", default-features = false }
chrono = "0.4.31"
chrono = { version = "0.4.31", default-features = false }
clap = { version = "4.5", default-features = false }
elliptic-curve = { version = "0.13.8", default-features = false }
eth-keystore = "0.5.0"
fuel-abi-types = "0.5.0"
futures = "0.3.29"
eth-keystore = { version = "0.5.0", default-features = false }
fuel-abi-types = { version = "0.5.0", default-features = false }
futures = { version = "0.3.29", default-features = false }
hex = { version = "0.4.3", default-features = false }
itertools = "0.12.0"
portpicker = "0.1.1"
proc-macro2 = "1.0.70"
quote = "1.0.33"
rand = { version = "0.8.5", default-features = false, features = [
"std_rng",
"getrandom",
] }
regex = "1.10.2"
semver = "1.0.20"
itertools = { version = "0.12.0", default-features = false }
portpicker = { version = "0.1.1", default-features = false }
proc-macro2 = { version = "1.0.70", default-features = false }
quote = { version = "1.0.33", default-features = false }
rand = { version = "0.8.5", default-features = false }
regex = { version = "1.10.2", default-features = false }
semver = { version = "1.0.20", default-features = false }
serde = { version = "1.0.193", default-features = false }
serde_json = "1.0.108"
serde_json = { version = "1.0.108", default-features = false }
serde_with = { version = "3.4.0", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
syn = "2.0.39"
syn = { version = "2.0.39", default-features = false }
tai64 = { version = "4.0.0", default-features = false }
tempfile = { version = "3.8.1", default-features = false }
thiserror = { version = "1.0.50", default-features = false }
tokio = { version = "1.34.0", default-features = false }
tracing = "0.1.40"
trybuild = "1.0.85"
tracing = { version = "0.1.40", default-features = false }
trybuild = { version = "1.0.85", default-features = false }
uint = { version = "0.9.5", default-features = false }
which = { version = "6.0.0", default-features = false }
zeroize = "1.7.0"
zeroize = { version = "1.7.0", default-features = false }
pretty_assertions = { version = "1.4.0", default-features = false }
walkdir = { version = "2.5", default-features = false }
tokio-util = { version = "0.7", default-features = false }
nix = { version = "0.28", default-features = false }
anyhow = { version = "1.0", default-features = false }
getrandom = { version = "0.2", default-features = false }
wasm-bindgen-test = { version = "0.3", default-features = false }
serde_yaml = { version = "0.9", default-features = false }
colored = { version = "2.1", default-features = false }
duct = { version = "0.13", default-features = false }
toml = { version = "0.8", default-features = false }
once_cell = { version = "1.19", default-features = false }
color-eyre = { version = "0.6", default-features = false }
cargo_metadata = { version = "0.18", default-features = false }
argh = { version = "0.1", default-features = false }

# Dependencies from the `fuel-core` repository:
fuel-core = { version = "0.26.0", default-features = false }
Expand All @@ -85,13 +97,13 @@ fuel-core-services = { version = "0.26.0", default-features = false }
fuel-core-types = { version = "0.26.0", default-features = false }

# Dependencies from the `fuel-vm` repository:
fuel-asm = { version = "0.49.0" }
fuel-crypto = { version = "0.49.0" }
fuel-merkle = { version = "0.49.0" }
fuel-storage = { version = "0.49.0" }
fuel-tx = { version = "0.49.0" }
fuel-types = { version = "0.49.0" }
fuel-vm = { version = "0.49.0" }
fuel-asm = { version = "0.49.0", default-features = false }
fuel-crypto = { version = "0.49.0", default-features = false }
fuel-merkle = { version = "0.49.0", default-features = false }
fuel-storage = { version = "0.49.0", default-features = false }
fuel-tx = { version = "0.49.0", default-features = false }
fuel-types = { version = "0.49.0", default-features = false }
fuel-vm = { version = "0.49.0", default-features = false }

# Workspace projects
fuels = { version = "0.62.0", path = "./packages/fuels", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish = false
chrono = { workspace = true }
# TODO: [issue](https://github.com/FuelLabs/fuels-rs/issues/1375) needs to be removed, `ScriptTransaction` and `CreateTransaction` in `fuels` use `fuel_tx::Input` but don't reexport or convert it into a `fuels` owned type
fuel-tx = { workspace = true }
fuels = { workspace = true }
fuels = { workspace = true, features = ["test-helpers", "std"] }
# TODO: [issue](https://github.com/FuelLabs/fuels-rs/issues/1376) because setup-program-test uses it but `fuels` did not reexport `rand`
rand = { workspace = true }
# used in test assertions
Expand Down
6 changes: 4 additions & 2 deletions examples/codec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ repository = { workspace = true }
description = "Fuel Rust SDK codec examples."

[dev-dependencies]
fuels = { workspace = true }
tokio = { workspace = true, features = ["full"] }
fuels = { workspace = true, features = [
"std",
] }
tokio = { workspace = true, features = ["macros"] }
8 changes: 6 additions & 2 deletions examples/contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ repository = { workspace = true }
description = "Fuel Rust SDK contract examples."

[dev-dependencies]
fuels = { workspace = true }
fuels = { workspace = true, features = [
"std",
"test-helpers",
"fuel-core-lib",
] }
rand = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio = { workspace = true, features = ["macros"] }

[features]
fuel-core-lib = ["fuels/fuel-core-lib"]
Expand Down
6 changes: 5 additions & 1 deletion examples/cookbook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ repository = { workspace = true }
description = "Fuel Rust SDK cookbook examples."

[dev-dependencies]
fuels = { workspace = true }
fuels = { workspace = true, features = [
"std",
"test-helpers",
"fuel-core-lib",
] }
rand = { workspace = true }
tokio = { workspace = true, features = ["full"] }

Expand Down
Loading
Loading