Skip to content

Commit 6b91619

Browse files
authored
More support for local action runner act (#30615)
- 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]>
1 parent fc2a071 commit 6b91619

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

.actrc

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file contains settings for local github action runner act:
2+
# https://github.com/nektos/act
3+
#
4+
# It is recommended to run specific jobs that you need, all jobs except those
5+
# running on should darwin work.
6+
# e.g. act -j build_linux
7+
#
8+
# It is recommended to set up a separate bridge network
9+
# and possibly define it in ~/.actrc like so:
10+
# --network=bridge
11+
# https://docs.docker.com/network/drivers/bridge/
12+
13+
# Remove containers after finishing a job, comment out for debugging
14+
--rm
15+
16+
# Reuse the checkout from host, otherwise act will do docker cp that makes
17+
# running jobs a lot longer even on SSD. Clean up your .environment before
18+
# running it.
19+
--bind
20+
21+
# Easier to have 1:1 match between triggering jobs and reading logs when they
22+
# use the same name
23+
--log-prefix-job-id
24+
25+
# Default runner image does not include enough.
26+
# https://github.com/nektos/act#default-runners-are-intentionally-incomplete
27+
-P ubuntu-latest=catthehacker/ubuntu:full-latest

.github/actions/checkout-submodules-and-bootstrap/action.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ runs:
1717
steps:
1818
- name: Dump disk info
1919
uses: ./.github/actions/dump-disk-info
20+
- name: Set git safe directory for local act runs
21+
uses: ./.github/actions/git-safe-directory
2022
- name: Checkout submodules
2123
uses: ./.github/actions/checkout-submodules
2224
with:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: Git safe directory
2+
description: For running act with checkout owned by non-root user
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set git safe.directory to "*"
7+
if: ${{ env.ACT }}
8+
shell: bash
9+
run: git config --system --add safe.directory '*'

0 commit comments

Comments
 (0)