1
0
Fork 0
mirror of https://github.com/zhaofengli/attic.git synced 2024-12-14 11:57:30 +00:00

Add CI-agnostic helper scripts

This commit is contained in:
Zhaofeng Li 2024-08-30 12:32:10 -04:00
parent 7712ed2c7f
commit fd6e3bdbef
4 changed files with 23 additions and 0 deletions

1
.ci/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/cached-shell

5
.ci/cache-shell.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
>&2 echo "Caching dev shell"
nix print-dev-env "${base}#" >"${cached_shell}"

7
.ci/common.sh Normal file
View file

@ -0,0 +1,7 @@
# Use as:
#
# source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
set -euo pipefail
base="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
cached_shell="${base}/.ci/cached-shell"

10
.ci/run Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
if [[ ! -f "${cached_shell}" ]]; then
>&2 echo "No cached shell in ${cached_shell}"
exit 1
fi
. "${cached_shell}"
exec "$@"