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

CI: Re-write using maintainer tools #699

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 43 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# rust-bitcoin workflow notes

We are attempting to run max 20 parallel jobs using GitHub actions (usage limit for free tier).

ref: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration

The minimal/recent lock files are handled by CI (`rust.yml`).

## Jobs

Run from `rust.yml` unless stated otherwise. Total 21 jobs but
`Prepare` is quick and must be run first anyway.

0. `Prepare`
1. `Stable - minimal`
2. `Stable - recent`
3. `Nightly - minimal`
4. `Nightly - recent`
5. `MSRV - minimal`
6. `MSRV - recent`
7. `Lint`
8. `Docs`
9. `Docsrs`
10. `Bench`
11. `Format`
12. `ASAN`
13. `Arch32Bit`
14. `WASM`
15. `NoStd`
<!-- Jobs run from `cross.yaml` -->
16. `Cross testing - aarch64-unknown-linux-gnu`
17. `Cross testing - i686-unknown-linux-gnu`
18. `Cross testing - x86_64-pc-windows-gnu`
19. `Cross testing - x86_64-unknown-linux-gnu`
20. `Cross testing - aarch64-unknown-linux-musl`
21. `Cross testing - arm-unknown-linux-gnueabi`
22. `Cross testing - arm-unknown-linux-gnueabihf`
23. `Cross testing - armv7-unknown-linux-gnueabihf`
24. `Cross testing - powerpc-unknown-linux-gnu`
25. `Cross testing - powerpc64le-unknown-linux-gnu`
26. `Cross testing - riscv64gc-unknown-linux-gnu`
27. `Cross testing - s390x-unknown-linux-gnu`
28. `Cross testing - x86_64-unknown-linux-musl`
41 changes: 41 additions & 0 deletions .github/workflows/cron-semi-weekly-update-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Update Nightly rustc
on:
schedule:
- cron: "0 0 * * 1,4" # runs every Monday and Thursday at 00:00
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update nightly rustc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Update rust.yml to use latest nightly
run: |
set -x
# Not every night has a nightly, so extract the date from whatever
# version of the compiler dtolnay/rust-toolchain gives us.
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
# Update the nightly version in the reference file.
echo "nightly-${NIGHTLY_DATE}" > nightly-version
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
# Some days there is no new nightly. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated nightly. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
author: Update Nightly Rustc Bot <[email protected]>
committer: Update Nightly Rustc Bot <[email protected]>
title: Automated daily update to rustc (to nightly-${{ env.nightly_date }})
body: |
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
branch: create-pull-request/daily-nightly-update
18 changes: 7 additions & 11 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,16 @@ jobs:
- x86_64-unknown-linux-musl
# - x86_64-unknown-netbsd # error in tests "error: test failed, to rerun pass '--lib'", disabled for now
steps:
- name: Checkout Crate
uses: actions/checkout@v2
- name: "Checkout repo"
Copy link
Collaborator

Choose a reason for hiding this comment

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

IME quotes are unusual in GH actions ant thus I think they're harder to read.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you want me to remove all quotes from all of our GitHub actions files?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that every string on YAML should be quoted.
@Kixunil don't know if you already seen this but here are a bunch of good arguments: https://ruudvanasseldonk.com/2023/01/11/the-yaml-document-from-hell

(PS: I wish we could do GH Actions using TOML, I honestly think YAML is very very easy to shoot yourself in the foot...)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I knew YAML is bad but I didn't know it's that bad. I'd make an exception for the name: field since it just contains a human-readable name but if you want to use some kind of linter and ban it entirely, it's fine.

uses: actions/checkout@v4
- uses: Swatinem/[email protected]
with:
key: ${{ matrix.feature }}${{ matrix.os }}
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install target
- name: "Select toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Install target"
run: rustup target add ${{ matrix.arch }}
- name: install cross
- name: "Install cross"
run: cargo install cross
- name: run cross test
- name: "Run cross test"
run: cross test --target ${{ matrix.arch }} --verbose
Loading
Loading