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

Build Sway projects at every CI run #234

Merged
merged 11 commits into from
Apr 28, 2022
Merged

Conversation

digorithm
Copy link
Member

@digorithm digorithm commented Apr 27, 2022

This PR:

  1. Removes all lock files, ABI files, and binary files for test projects used in the harness.rs test suite;
  2. Adds respective gitignores to not include lock files, ABI files, and binary files;
  3. Adds a Rust binary to build all test projects (cargo run --bin build-test-projects). This needs to be run locally when running tests;
  4. Updates the CI workflow file to run the above binary in order to build all test projects, from scratch, using the latest forc, at every new CI run, guaranteeing fresh binaries when running the test suite.

Closes #210.
Closes #201.

@digorithm digorithm self-assigned this Apr 27, 2022
@digorithm digorithm added enhancement New feature or request ci GitHub CI build/pipeline labels Apr 27, 2022
@digorithm digorithm marked this pull request as ready for review April 27, 2022 18:30
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove the swayswap project and add some newlines, otherwise great work!!! This is going to be awesome to have!

@digorithm digorithm requested a review from iqdecay April 27, 2022 18:47
@Voxelot
Copy link
Member

Voxelot commented Apr 27, 2022

You could consider using the somewhat idiomatic xtask approach for these build scripts.

https://github.com/matklad/cargo-xtask

With cargo aliasing, you get a nice cli interface like cargo xtask <task name>: alias

We use it in fuel-core and it works great.

@digorithm
Copy link
Member Author

digorithm commented Apr 27, 2022

You could consider using the somewhat idiomatic xtask approach for these build scripts.

https://github.com/matklad/cargo-xtask

We use it in fuel-core and it works great.

That'd be a nice idea to explore in future PRs -- I have no idea how it works and it would require some exploration time on my end, plus:

cargo-xtask is neither an officially recommended workflow, nor a de-facto standard (yet?). It might or might not work for your use case.

For now, I'd rather follow how it's done in sway, push this out, and unblock many things that are waiting for the next release.

iqdecay
iqdecay previously approved these changes Apr 27, 2022
Copy link
Contributor

@iqdecay iqdecay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉 🎉

uses: actions-rs/cargo@v1
with:
command: install
args: forc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should fix a forc version here instead of using latest

Copy link
Contributor

@iqdecay iqdecay Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait isn't it going to be problematic? I feel like the whole point was to use the last compiler version (ie last forc version) so we shouldn't pin it? What am I missing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, ideally we want to test it against the latest. But, for instance, if for some reason we don't wanna use the latest (e.g. latest breaks something on the SDK, we're aware of it, but we're still working on a fix), we might not want to block other PR's CI pipeline because of it. So having this control is nice.

But, then again, we have to watch ourselves and make sure we're updating this version when there's a new forc version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want the best of both worlds, then we can create a second CI workflow that runs against latest forc and isn't required to pass to merge PRs. Then if it breaks we know, but it's not blocking anything.

Copy link
Contributor

@iqdecay iqdecay Apr 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I feel like we should find a way to ensure this? I think we can't afford finding out once again that some tests are broken with 2 releases late? The SDK is getting quite big haha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge fan of that because I believe it would increase the CI runtime considerably :(. We're currently sitting at ~10min, running another one, in this case, would mean building all Sway projects again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the solution would be to run the fuels-rs CI on every forc major release?
But just on releases?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah no wait that doesn't work

Copy link
Contributor

@adlerjohn adlerjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above

@digorithm digorithm merged commit fde3978 into master Apr 28, 2022
@digorithm digorithm deleted the rodrigo/CI-fresh-binaries branch April 28, 2022 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci GitHub CI build/pipeline enhancement New feature or request
Projects
Archived in project
4 participants