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

Revive CI with GH Workflows #6

Merged
merged 3 commits into from
Jan 26, 2022

Conversation

aewag
Copy link
Contributor

@aewag aewag commented Dec 23, 2021

PR revives the CI with help of the GH Workflows, similar to other crates in the RustCrypto repositories.

Tests are ran with & without no_unroll feature. As cross tests currently does not support thumbv7em-none-eabi as a target, this is not covered, but build tests are run for this target.

I have not sufficient rights to trigger Github Actions in this repository. I tested this PR within my fork:
aewag#1

Further, this PR contains commits to make rustfmt and clippy happy. To skip the rustfmt on the macros, I moved them into unrolled.rs and flagged it with the skip attribute.

@aewag aewag force-pushed the revive-ci-with-gh-workflows branch 11 times, most recently from 7a7494a to bfcea46 Compare December 23, 2021 22:39
@aewag aewag changed the title WIP Revive CI with GH Workflows Revive CI with GH Workflows Dec 23, 2021
@aewag aewag marked this pull request as ready for review December 23, 2021 22:48
@aewag aewag force-pushed the revive-ci-with-gh-workflows branch 2 times, most recently from 77f4bcc to 65987cf Compare January 4, 2022 08:53
@aewag
Copy link
Contributor Author

aewag commented Jan 4, 2022

@newpavlov Have you had a chance to look at this PR?

@aewag aewag mentioned this pull request Jan 13, 2022
@aewag aewag force-pushed the revive-ci-with-gh-workflows branch from 65987cf to 9a33bfd Compare January 25, 2022 14:31
@aewag
Copy link
Contributor Author

aewag commented Jan 25, 2022

Updated because cross was moved into its own organization cross-rs, see cross-rs/cross#631.

@tarcieri
Copy link
Member

@aewag sorry, wasn't subscribed to this repo and didn't see these PRs. Thanks for submitting them!

Comment on lines +23 to +30
- name: Install precompiled cross
run: |
export URL=$(curl -s https://api.github.com/repos/cross-rs/cross/releases/latest | \
jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
shell: bash
Copy link
Member

Choose a reason for hiding this comment

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

Curious how much time this actually saves versus cargo install cross, which we use elsewhere:

https://github.com/RustCrypto/elliptic-curves/blob/89d6ab4/.github/workflows/k256.yml#L136

Looking at the CI history, it takes about 1m11s

Copy link
Contributor Author

@aewag aewag Jan 25, 2022

Choose a reason for hiding this comment

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

Yep, I also thought about using cargo install cross. The benefit is not too big for the more complex CI code.

cross within my fork takes 30 - 40 seconds for a single run.
https://github.com/aewag/sponges/actions/runs/1745945800

I can push a variant using cargo install, and we can see if it performs much worse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, there seems to be a different issue than performance:

The current MSRV of the keccak crate is 1.41. But this is not sufficient to build cross [1]. So best is probably to work with the precompiled cross. I removed the WIP commit for experimenting with cargo install.

[1] https://github.com/aewag/sponges/runs/4940099815?check_suite_focus=true#step:3:170

Copy link
Member

Choose a reason for hiding this comment

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

It's ok to bump MSRV, especially if we're making breaking changes anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't than the MSRV of cross the bottomline MSRV of keccak?

I just pushed a WIP with MSRV 1.46. This succeeds building cross. Interestingly prior versions fail [1], although cross MSRV is 1.42. Not really sure why this is the case.

Performance-wise it takes 2m for a single run compared to 30-40s with a precompiled binary.

[1] https://github.com/aewag/sponges/runs/4942085469?check_suite_focus=true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps @aewag can check me on this but I think the set-msrv pattern introduced in this PR (and also this one, which now has differing cross-install boilerplate) could potentially be extracted as a reusable workflow?

Yes, set-msrv is a candidate to be moved into a reusable workflow. For example, this would easily allow an extension to get the MSRV from the Cargo.toml instead of hardcoding it in the CI config. I think for such extensions it is nice to have common patterns at a single place.

Additionally it seems like actions-rs is unmaintained and a rather heavyweight solution for how we actually use it. Perhaps we could fork it and slim it down to our specific needs. That would eliminate dependence on third-party actions we don't control.

I suggest to install cross using a composite action. This seems to me the most lightweight approach, that is currently available. If actions-rs gets extended or cross supports better options to install, we could simply switch to that by modifying this action only.

Copy link
Member

@tarcieri tarcieri Feb 1, 2022

Choose a reason for hiding this comment

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

@newpavlov WDYT? Should we give it a try?

It seems like we could use set-msrv everywhere to have MSRV specified once per workflow.

Copy link
Member

Choose a reason for hiding this comment

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

@tarcieri
Yeah, go ahead. We always can revert everything back if it will be too much trouble in the end.

Copy link
Member

Choose a reason for hiding this comment

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

I made a repo here: https://github.com/RustCrypto/actions

@aewag feel free to upstream the work there! It seems like we'll be able to unify the configs in sponges and hashes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a repo here: https://github.com/RustCrypto/actions

@aewag feel free to upstream the work there! It seems like we'll be able to unify the configs in sponges and hashes

Perfect, we'll do that. 👍

@aewag aewag force-pushed the revive-ci-with-gh-workflows branch 5 times, most recently from 5463d25 to 332e47a Compare January 25, 2022 18:21
@aewag aewag force-pushed the revive-ci-with-gh-workflows branch 6 times, most recently from a3f8e5d to 9a33bfd Compare January 25, 2022 19:47
@newpavlov
Copy link
Member

Thank you!

@newpavlov newpavlov merged commit 71c7948 into RustCrypto:master Jan 26, 2022
@aewag aewag deleted the revive-ci-with-gh-workflows branch January 26, 2022 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants