Skip to content

Commit f1fcec7

Browse files
ci: check for fuels deps in forc-pkg (FuelLabs#4221)
## Description closes FuelLabs#3447 Failed the first commit deliberately just to [demonstrate the failure case](https://github.com/FuelLabs/sway/actions/runs/4341593516/jobs/7581384965) (there's a mistyped newline in that job, fixed in the following commit), added a little message just to explain why we may not want `fuels` deps in `forc-pkg` - let me know if it is adequately explained! ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: Sophie Dankel <[email protected]>
1 parent 3c7eac1 commit f1fcec7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/ci.yml

+36
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,42 @@ jobs:
294294
- name: Run Unit Tests
295295
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
296296

297+
forc-pkg-fuels-deps-check:
298+
runs-on: ubuntu-latest
299+
steps:
300+
- uses: actions/checkout@v2
301+
- name: Install toolchain
302+
uses: dtolnay/rust-toolchain@master
303+
with:
304+
toolchain: ${{ env.RUST_VERSION }}
305+
- uses: Swatinem/rust-cache@v2
306+
307+
- name: Install cargo-deps
308+
run: cargo install cargo-deps
309+
310+
# We require this check to avoid cyclic dependencies between 'fuels' and 'forc-pkg'.
311+
# Detailed explanation is found in the echo below.
312+
- name: Check 'forc-pkg' dependencies for 'fuels' crates
313+
run: |
314+
deps=$(cargo deps --manifest-path forc-pkg/Cargo.toml)
315+
316+
case "$deps" in
317+
*fuels*)
318+
echo -e "\nFound dependency on a 'fuels' crate.
319+
To avoid cyclic dependencies between 'fuels' and 'forc-pkg',
320+
we want to avoid using 'fuels' crates in 'forc-pkg' since 'fuels-rs' depends on 'forc-pkg' for its integration tests.
321+
322+
To fix this, please remove any 'fuels' dependency from forc-pkg/Cargo.toml.
323+
324+
Detailed explanation here: https://github.com/FuelLabs/fuels-rs/issues/752#issuecomment-1386242106"
325+
exit 1
326+
;;
327+
*)
328+
exit 0
329+
;;
330+
esac
331+
332+
297333
cargo-test-workspace:
298334
runs-on: ubuntu-latest
299335
steps:

0 commit comments

Comments
 (0)