Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Commit

Permalink
Start to use act to run GitHub actions locally
Browse files Browse the repository at this point in the history
For example:

    act -j check_rebase   # fails on a merge commit
    act -j check_history  # fails unless on a merge commit, typically from bors

`act` uses the job ID rather than the job name; `bors` uses the job name.

`act` 0.2.0 doesn't support the `container: name:tag` syntax.

Start to support https://github.com/nektos/act for local testing. `act` has
partial support for GitHub actions. This change works around two issues:

1.  Steps in GitHub actions can be run on the virtual machine host directly or
    inside a container. The virtual machines are configure with a [long list] of
    available software, including `git`. At present `act` does not make that
    software available locally, so instead we run inside a container. The `act`
    maintainer describes this as a [known issue].

2.  The checkout on GitHub leaves a shallow repository. The checkout step on
    `act` leaves a complete repository. Running `git fetch --unshallow` on a
    complete repository fails with the error below. As a workaround add
    `|| true` so it succeeds in both.

          fatal: --unshallow on a complete repository does not make sense

[long list]:
  https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md
[known issue]: nektos/act#74 (comment)
  • Loading branch information
maxwell-k committed Mar 18, 2020
1 parent 00b9936 commit e5b9e96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/check-commits.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
on: { pull_request }

jobs:
check:
check_history:
runs-on: ubuntu-latest
container: { image: "quay.io/keith_maxwell/lumosql-build:fedora" }
name: Check commits
steps:
- uses: actions/checkout@v2
- name: Fetch all history so that later commands succeed
run: git fetch --prune --unshallow
run: git fetch --prune --unshallow || true
- name: Fail if any commits have a subject line starting fixup!
run:
"! git log --pretty=format:%s%n origin/master..HEAD | grep -q ^fixup!"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/semi-linear.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
on: { push: { branches: [staging, trying] } }

jobs:
check:
check_rebase:
runs-on: ubuntu-latest
container: { image: "quay.io/keith_maxwell/lumosql-build:fedora" }
name: Semi linear
steps:
- uses: actions/checkout@v2
- name: Fetch all history so that later commands succeed
run: git fetch --prune --unshallow
run: git fetch --prune --unshallow || true
- name: Fail if the branch requires a rebase
run:
test "$(git rev-parse origin/master)" = "$(git merge-base
Expand Down

0 comments on commit e5b9e96

Please sign in to comment.