Skip to content

Commit

Permalink
CI: Re-write using maintainer tools
Browse files Browse the repository at this point in the history
Re-write CI using the new maintainer tools script. A few things to note:

- Currently we have `Cross` job in `rust.yaml` as well as `cross.yaml`,
  remove the one in `rust.yaml`.
- Put sanitizer and wasm jobs in their own scripts
- Utilize `extra_tests.sh` for additional feature combos
- We are exceeding the 20 job limit, see the README

Unless I'm made a mistake this shouldn't reduce the test coverage in any
way.
  • Loading branch information
tcharding committed May 19, 2024
1 parent 6648126 commit b9fa126
Show file tree
Hide file tree
Showing 12 changed files with 454 additions and 272 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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. `API`
<!-- Jobs run from `cross.yaml` -->
15. `Cross testing - aarch64-unknown-linux-gnu`
16. `Cross testing - i686-unknown-linux-gnu`
17. `Cross testing - x86_64-pc-windows-gnu`
18. `Cross testing - x86_64-unknown-linux-gnu`
19. `Cross testing - aarch64-unknown-linux-musl`
20. `Cross testing - arm-unknown-linux-gnueabi`
21. `Cross testing - arm-unknown-linux-gnueabihf`
22. `Cross testing - armv7-unknown-linux-gnueabihf`
23. `Cross testing - powerpc-unknown-linux-gnu`
24. `Cross testing - powerpc64le-unknown-linux-gnu`
25. `Cross testing - riscv64gc-unknown-linux-gnu`
26. `Cross testing - s390x-unknown-linux-gnu`
27. `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"
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 }}
Loading

0 comments on commit b9fa126

Please sign in to comment.