Merge rust-bitcoin/rust-bitcoin#833: Allow contributors to easily run CI locally with `act`

006193f5b6 feat: Support running CI locally with `act` (Andrew Ahlers)

Pull request description:

  Disable problematic jobs that involve Github Actions caching or `cross` whenever the environment is set to ACT. This allows running the CI pipeline locally and hopefully speeds up PR cycle times by reducing unexpected CI pipeline results.

  ## Motivation

  The CI pipeline does not run until maintainer approval. This allows an easy path for contributors to test out the CI pipeline locally and avoid unexpected results. I personally kept hitting issues here due to MSRV always throwing me off

  ## Potential issues

  - `act` does not support Github Actions caching feature which is used in the `fuzz` workflow so I simply disabled it if `act` is detected.

  - the `cross` workflow is similarly disabled. I kept hitting `sh: 1: cargo: not found` (see: https://github.com/cross-rs/cross/issues/260). I tried a few different workaround but had no success.

  I'm hoping this is acceptable as it still improves the local testing situation and covers the `Tests` workflow

ACKs for top commit:
  apoelstra:
    ACK 006193f5b6
  Kixunil:
    ACK 006193f5b6

Tree-SHA512: 079d50276161ef2c7d61e41d8f47126b8def41ea61f4560be03950e6e4e07ae8bb67ab22ac8f0e46e5e5e3406b64c1de4bb2c62526c36b82db962842ffc377ca
This commit is contained in:
Andrew Poelstra 2022-02-18 19:27:08 +00:00
commit 1871c3ada9
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
5 changed files with 17 additions and 1 deletions

1
.actrc Normal file
View File

@ -0,0 +1 @@
-e contrib/act/event.json

View File

@ -5,6 +5,7 @@ on: [push, pull_request]
jobs:
fuzz:
if: ${{ !github.event.act }}
runs-on: ubuntu-20.04
env:
HFUZZ_BUILD_ARGS: "--features honggfuzz_fuzz"
@ -41,6 +42,7 @@ jobs:
path: executed_${{ matrix.fuzz_target }}
verify-execution:
if: ${{ !github.event.act }}
needs: fuzz
runs-on: ubuntu-latest
steps:

View File

@ -64,6 +64,7 @@ jobs:
Cross:
name: Cross testing
if: ${{ !github.event.act }}
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
@ -101,7 +102,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
run: sudo apt update && sudo apt install qemu-system-arm gcc-arm-none-eabi
run: sudo apt update && sudo apt install -y qemu-system-arm gcc-arm-none-eabi
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:

View File

@ -114,6 +114,15 @@ Please try to address them, otherwise your PR might get closed without merging
after a longer time of inactivity. If your PR isn't ready for review yet please
mark it by prefixing the title with `WIP: `.
### CI Pipeline
The CI pipeline requires approval before being run on each MR.
In order to speed up the review process the CI pipeline can be run locally using
[act](https://github.com/nektos/act). The `fuzz` and `Cross` jobs will be
skipped when using `act` due to caching being unsupported at this time. We do
not *actively* support `act` but will merge PRs fixing `act` issues.
## Policy on Altcoins/Altchains
Patches which add support for non-Bitcoin cryptocurrencies by adding constants

3
contrib/act/event.json Normal file
View File

@ -0,0 +1,3 @@
{
"act": true
}