Skip to content

Commit

Permalink
More support for local action runner act
Browse files Browse the repository at this point in the history
- add .actrc with detailed comments

   decisions for defaults:
   - use bind mount rather than docker cp for speed (requires cleaning
     environment and action addition)
   - remove containers and volumes after finishing - those can quickly
     build up to big sizes

- add action that sets git's safe directory to * for act runs
  git started checking if user running git and user owning repo are the
  same
  github requires containers to run as root user
  act doing docker cp takes long time but bind is quick, yet we get
  fperm issues as most people dont have root owned repo

Signed-off-by: Alexander Mazuruk <[email protected]>
  • Loading branch information
aalexanderr committed Nov 22, 2023
1 parent a3c5d19 commit bee9af5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file contains settings for local github action runner act:
# https://github.com/nektos/act
#
# It is recommended to run specific jobs that you need, all jobs except those
# running on should darwin work.
# e.g. act -j build_linux
#
# It is recommended to set up a separate bridge network
# and possibly define it in ~/.actrc like so:
# --network=bridge
# https://docs.docker.com/network/drivers/bridge/

# Remove containers after finishing a job, comment out for debugging
--rm

# Reuse the checkout from host, otherwise act will do docker cp that makes
# running jobs a lot longer even on SSD. Clean up your .environment before
# running it.
--bind

# Easier to have 1:1 match between triggering jobs and reading logs when they
# use the same name
--log-prefix-job-id

# Default runner image does not include enough.
# https://github.com/nektos/act#default-runners-are-intentionally-incomplete
-P ubuntu-latest=catthehacker/ubuntu:full-latest
2 changes: 2 additions & 0 deletions .github/actions/checkout-submodules-and-bootstrap/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ runs:
steps:
- name: Dump disk info
uses: ./.github/actions/dump-disk-info
- name: Set git safe directory for local act runs
uses: ./.github/actions/git-safe-directory
- name: Checkout submodules
uses: ./.github/actions/checkout-submodules
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/actions/git-safe-directory/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Git safe directory
description: For running act with checkout owned by non-root user
runs:
using: "composite"
steps:
- name: Set git safe.directory to "*"
if: ${{ env.ACT }}
shell: bash
run: git config --system --add safe.directory '*'

0 comments on commit bee9af5

Please sign in to comment.