This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get
act
debugging working with quirks
- `.ci/debug/run_act.sh` to run in act - `.ci/debug/run_act_break_before_install.sh` to run in act and enter an infinite loop before install, so you can attach to the container (couldn't figure out how to force act to run container in interactive mode) - Bump node to `15.x` (deprecated, but same as cloud for now) - Run `setup_debugging.sh` in ACT runs to fix quirks of 500MB container (instead of 20GB full container), e.g. missing `yarn` - Still some jankiness - e.g., if running as a submodule, action will think that repository doesn't exist (since `.git` is a pointer to a relative path in the parent, rather than itself)
- Loading branch information
1 parent
211afff
commit bbbe582
Showing
9 changed files
with
148 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
exec curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
infinite_sleep() { | ||
echo "Sleeping in foreground..." | ||
echo "Attach to container with:" | ||
echo | ||
echo "-" | ||
echo ' docker exec -it $(docker ps -q --filter name=act-*) /bin/bash' | ||
echo | ||
echo "-" | ||
echo | ||
echo "Or, to kill this container:" | ||
echo "-" | ||
echo ' docker kill $(docker ps -q --filter name=act-*)' | ||
echo "-" | ||
|
||
echo "(Sleeping now... ctrl+c might not be enough to kill me)" | ||
|
||
while : | ||
do | ||
sleep 10 & | ||
wait $! | ||
done | ||
|
||
exit 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"head_commit": { | ||
"message": "Blah blah blah" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
DEBUG_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" | ||
REPO_DIR="$DEBUG_DIR/../.." | ||
DEBUG_REL_DIR=".ci/debug/" | ||
|
||
ACT_TARGET_ACTION="${1-build_and_deploy_preview}" | ||
if test -n "$ACT_TARGET_ACTION" ; then | ||
shift | ||
fi | ||
|
||
ACT_EVENT_PAYLOAD="${1-"${DEBUG_REL_DIR}"payloads/commit-event.json}" | ||
if test -n "$ACT_EVENT_PAYLOAD" ; then | ||
shift | ||
fi | ||
|
||
# note: remaining arguments will be passed to `act` in final `exec` | ||
|
||
# need to use "no" so that act doesn't ask the user to set it | ||
# BREAK_INTERACTIVE_BEFORE_INSTALL=${"$BREAK_INTERACTIVE_BEFORE_INSTALL"-"no"} | ||
|
||
pushd "$REPO_DIR" | ||
trap "popd" exit | ||
|
||
echo "All config variables are OPTIONAL. Simply press enter to skip one." | ||
echo "Current variables set:" | ||
echo | ||
echo -n " BREAK_INTERACTIVE_BEFORE_INSTALL=\"${BREAK_INTERACTIVE_BEFORE_INSTALL}\"" | ||
echo " # If non-empty, infinite sleep before yarn install" | ||
echo | ||
echo "---" | ||
echo | ||
|
||
# act docs: https://github.com/nektos/act | ||
exec act \ | ||
-j "${ACT_TARGET_ACTION}" \ | ||
-e "$ACT_EVENT_PAYLOAD" \ | ||
-s BREAK_INTERACTIVE_BEFORE_INSTALL="$BREAK_INTERACTIVE_BEFORE_INSTALL" \ | ||
"$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
DEBUG_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" | ||
|
||
# Set flag to be checked by install.sh when it sources debug_install.sh | ||
export BREAK_INTERACTIVE_BEFORE_INSTALL=yes | ||
exec "$DEBUG_DIR"/run_act.sh "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# The GitHub workflow should conditionally call this script when running in ACT | ||
|
||
if ! test -n "$ACT" ; then | ||
echo "Fatal Error: Cannot call debug_preinstall.sh when not running inside ACT" | ||
exit 1 | ||
fi | ||
|
||
# `yarn` should be installed in GitHub actions, but when we're debugging | ||
# with `act`, the 500MB container doesn't include `yarn`, so install it | ||
if ! which yarn ; then | ||
echo "------" | ||
echo "Yarn not found (running in act?) - install it..." | ||
echo "Node version: $(node --version)" | ||
echo "------" | ||
|
||
set -e | ||
apt-get update -qq | ||
apt-get install -yy curl gnupg2 | ||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | ||
|
||
# Also, for some reason we nede to reinstall Node for this to work | ||
curl -sL https://deb.nodesource.com/setup_15.x | bash - | ||
apt-get install -yy nodejs | ||
apt-get install --no-install-recommends yarn | ||
set +e | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters