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

Use rust-bitcoin-maintainer-tools and re-write CI #348

Merged
merged 2 commits into from
May 9, 2024

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented May 2, 2024

Use the new maintainer tools test script we created in rust-bitcoin/rust-bitcoin-maintainer-tools#4

For this repo usage of the script is a big change, the coverage does not change that much except we run one example instead of just building it and we run cargo using cargo --locked whereas currently for stable and nightly the dependencies used are much more recent.

FTR:

  • We do not format (exists in current ci but is not enforced because of bug is test.sh)
  • We just build the examples (same as current behaviour)
  • We do not lint (same as current behaviour)
  • We do not pin, instead we commit a lock file with working dependency versions. Please note that there are two lock files as is customary but in this repo I was unable to get a set of more recent dependencies to build so both files are the same.

This replaces #338

@tcharding tcharding force-pushed the 05-02-ci-maintainer-tools branch 26 times, most recently from 54993cd to f046739 Compare May 2, 2024 04:42
@tcharding
Copy link
Member Author

I'm not sure ATM why the script doesn't pin properly, the pin.sh script seems to work locally.

@apoelstra
Copy link
Member

I'm confused about the relationship between the lockfiles and pin.sh. Why have both? pin.sh is guaranteed to go out of date as non-pinned deps break CI.

Also lol there is no way you can make cargo +nightly fmt a requirement on a crate that Steven literally maintains. (It doesn't look like you have done this ... so then why stick a formatting commit into this?)

Copy link

@storopoli storopoli left a comment

Choose a reason for hiding this comment

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

small comment

uses: actions/checkout@v4
with:
repository: tcharding/rust-bitcoin-maintainer-tools
ref: 05-02-ci

Choose a reason for hiding this comment

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

What happens once we loop an year?
This is not "collision resistant" 😂

Copy link
Member

Choose a reason for hiding this comment

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

We also need to change the repository from tcharding/rbmt to rust-bicoin/rbmt. I was imagining then that the ref would just be a commit ID. But if we want to use tags then you're right, we should make sure the year is part of the name :)

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad, I did comment on that somewhere. Using my repo and branch is just for testing.

This is not "collision resistant" 😂

I'm currently solving this issue with a "clobber branches if they are a year old policy", its even more confusing when I accidentally use the wrong date a few days in the future

@tcharding
Copy link
Member Author

Also lol there is no way you can make cargo +nightly fmt a requirement on a crate that Steven literally maintains.

Yes I woke up yesterday morning realising I had been a massive dick and done that (use nightly), current state does not.

(It doesn't look like you have done this ... so then why stick a formatting commit into this?)

I believe formatting was intended to be enforced in CI, the current test.sh script looks like that anyway but is buggy, so I ran the formatter (with stable) and "kept" that behaviour.

@tcharding
Copy link
Member Author

Please note, the solution I found to pinning issues is to just only run MSRV job using the minimal lock file.

@tcharding
Copy link
Member Author

tcharding commented May 3, 2024

EDIT: (original message below) After sleeping on this I think a better approach is to just not have a formatting job and note the bug in the current test.sh script in this PR for the record. We could then, if desired, add that job as a separate PR with an explicit requirement for review from @stevenroose.

Hey @stevenroose

I believe I am acting correctly here but can you please ack because we have had prior history re formatting.

rustfmt appears to be meant to be enforced in CI at the moment but it is not because the cargo fmt -- --check result is not being handled correctly.

I have therefore enforced formatting in this PR using the stable toolchain as it currently does. However this required a formatting patch because there are formatting issues currently on master.

No probs if you want the format patch and CI job removed - just holla at me.

Thanks

@tcharding tcharding force-pushed the 05-02-ci-maintainer-tools branch 3 times, most recently from 128bedc to 2e81f41 Compare May 3, 2024 20:41
@apoelstra
Copy link
Member

Please note, the solution I found to pinning issues is to just only run MSRV job using the minimal lock file.

The recent lockfile should also work with the MSRV. If it doesn't then we need to back off on the deps in the recent lockfile. It's supposed to represent the most recent dependencies that work.

@tcharding
Copy link
Member Author

It's supposed to represent the most recent dependencies that work.

I never realised it was supposed to represent the most recent dependencies that work with MSRV. Was that always what you had in mind? Since most users will not be using MSRV does that not mean the file has way less relevance? Also does that not mean our test coverage is worse because we may miss issues with current versions that most people are then going to hit?

If we want a recent for MSRV I rekon we should have a third lock file and have a recent for stable as well.

@apoelstra
Copy link
Member

apoelstra commented May 4, 2024

I never realised it was supposed to represent the most recent dependencies that work with MSRV. Was that always what you had in mind?

Yes.

Since most users will not be using MSRV does that not mean the file has way less relevance?

Maybe. If "most users" want to use dependencies I've never tested (or rather, I have tested and confirmed are broken) and don't care about, that is their perogative. But the point of these lockfiles is to provide specific versions that we've tested to work.

If we want a recent for MSRV I rekon we should have a third lock file and have a recent for stable as well.

Yeah, this is probably a good idea.

apoelstra added a commit to rust-bitcoin/rust-bitcoin-maintainer-tools that referenced this pull request May 7, 2024
72e42b3 Add CI shell scripts (Tobin C. Harding)

Pull request description:

  We would like to put all the CI scripts in a single place instead of copied to each repository.

  Add a `ci/` directory and in it a `run_task.sh` script as well as auxilary scripts required. Include a README to document the directory.

  When the following three PRs have green CI runs then I believe we can merge this. And then I will update each of the PRs to use this repo and `master` (instead my fork and the PR branch `05-02-ci`).

  - [x] `rust-bitcoin`: rust-bitcoin/rust-bitcoin#2736
  - [x] `rust-miniscript`: rust-bitcoin/rust-miniscript#682
  - [x] `rust-bitcoincore-rpc`: rust-bitcoin/rust-bitcoincore-rpc#348
  - [x] `rust-chf` https://github.com/tcharding/rust-chf/actions/runs/8931701405

  All green with one minute till my End Of Day - BOOM!

ACKs for top commit:
  apoelstra:
    utACK 72e42b3

Tree-SHA512: 199203ff283cce6f05ac69c971aaf563b1df9574900cf24ef0d979dee34419d6d3ba01de930e08318878e49ce0dd5e30e81c5eb4603b8404acce909eca03a6a6
@tcharding tcharding force-pushed the 05-02-ci-maintainer-tools branch 2 times, most recently from 7cf092c to dafeae0 Compare May 7, 2024 22:28
Make the indentation like it is in other repositories in this org. Done
in preparation for further patching of the workflow.

Whitespace only.
@tcharding tcharding force-pushed the 05-02-ci-maintainer-tools branch 3 times, most recently from fcde06b to a27c42f Compare May 7, 2024 22:47
We have a CI script in the `rust-bitcoin-maintainer-tools` repository,
lets use it.

Requires adding `Cargo-minimal.lock` and `Cargo-recent.lock`. Both these
lock files are tested with all three toolchains (msrv, stable, nightly).

Note, I could not find a more recent set of dependencies that works so
the two lock files are the same.
@tcharding tcharding marked this pull request as ready for review May 7, 2024 22:56
This was referenced May 7, 2024
@tcharding
Copy link
Member Author

Yeah, this is probably a good idea.

Just checking, this can be done separate to this PR, right?

Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 93602a9

@apoelstra
Copy link
Member

I think this is OK to merge without Steven. It's only CI and the existing stuff is broken and it doesn't introduce any new dependencies or requirements for nightly tooling or anything.

@apoelstra apoelstra merged commit 95d035b into rust-bitcoin:master May 9, 2024
13 checks passed
apoelstra added a commit that referenced this pull request May 13, 2024
3a3446a Depend on bitcoin v0.32.0 (Tobin C. Harding)

Pull request description:

  Done on top of #348 because I had to pin in the CI script, draft until that goes in.

  Depend on the latest release of `rust-bitcoin`.

ACKs for top commit:
  apoelstra:
    ACK 3a3446a nice! lots of slight improvements here

Tree-SHA512: badf1b26a030985c55a807b916e00c4199d5260ef69664ac6fc4db0182a13dc4433ca26f773d4ecbc9b61f5400f82c0a5f38d05f183e9a8aa6242f06a60397ed
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