Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 40 additions & 21 deletions .github/workflows/packcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ jobs:
# ------------------------------------------------------------------------
# Location of packcheck.sh (the shell script invoked to perform CI tests ).
# ------------------------------------------------------------------------
# You can either commit the packcheck.sh script at this path in your repo or
# you can use it by specifying the PACKCHECK_REPO_URL option below in which
# case it will be automatically copied from the packcheck repo to this path
# during CI tests. In any case it is finally invoked from this path.
PACKCHECK: "./packcheck.sh"
PACKCHECK_SAFE: "./packcheck-safe.sh"
# You can either commit the packcheck.sh script in your repo root or
# you can use it by specifying the PACKCHECK_REPO_URL option.
# If this option is enabled packcheck clears out the environment
# and only uses the options explicitly set on the command line
# only, implicit environment won't affect the build. if you find
# this annoying comment is out.
PACKCHECK_STRICT: "y"
# If you have not committed packcheck.sh in your repo at PACKCHECK
# then it is automatically pulled from this URL.
PACKCHECK_GITHUB_URL: "https://raw.githubusercontent.com/composewell/packcheck"
Expand Down Expand Up @@ -330,34 +331,42 @@ jobs:
# on windows-latest GitHub Actions defaults to PowerShell
shell: bash
run: |
if test ! -e "$PACKCHECK"
then
if test -z "$PACKCHECK_GITHUB_COMMIT"
PACKCHECK=packcheck.sh
PACKCHECK_SAFE=packcheck-safe.sh
download_one () {
if test ! -e "$1"
then
if test -z "$PACKCHECK_GITHUB_COMMIT"
then
die "Downloading [$1]: PACKCHECK_GITHUB_COMMIT env var is not specified."
fi
PACKCHECK_URL_PREFIX=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}
curl --fail -sLO ${PACKCHECK_URL_PREFIX}/$1 || exit 1
chmod +x "$1"
elif test ! -x "$1"
then
die "PACKCHECK_GITHUB_COMMIT env var is not specified."
chmod +x $1
fi
PACKCHECK_URL_PREFIX=${PACKCHECK_GITHUB_URL}/${PACKCHECK_GITHUB_COMMIT}/packcheck
curl --fail -sL -o "$PACKCHECK" ${PACKCHECK_URL_PREFIX}.sh || exit 1
chmod +x $PACKCHECK
curl --fail -sL -o "$PACKCHECK" ${PACKCHECK_URL_PREFIX}-safe.sh || exit 1
chmod +x $PACKCHECK_SAFE
elif test ! -x "$PACKCHECK"
}
download_one packcheck.sh
if test "$PACKCHECK_STRICT" = "y"
then
chmod +x $PACKCHECK
chmod +x $PACKCHECK_SAFE
download_one packcheck-safe.sh
fi

- name: Setup packcheck
shell: bash
run: |
PACKCHECK=packcheck.sh
PACKCHECK_SAFE=packcheck-safe.sh
cat << 'EOF' > packcheck-setup.sh
setup_packcheck_args() {
# $1 is the BUILD_MODE (e.g., BUILD_DEPS_ONLY)
local MODE=$1

if test -n "$SUBDIR"; then
mv "$PACKCHECK" "$SUBDIR/"
mv "$PACKCHECK_SAFE" "$SUBDIR/"
test -e "$PACKCHECK_SAFE" && mv "$PACKCHECK_SAFE" "$SUBDIR/"
rm -f cabal.project
cd "$SUBDIR"
fi
Expand Down Expand Up @@ -406,7 +415,12 @@ jobs:
run: |
source packcheck-setup.sh
setup_packcheck_args "BUILD_DEPS_ONLY"
eval "$PACKCHECK_SAFE $ARGS"
if test "$PACKCHECK_STRICT" = "y"
then
eval "./packcheck-safe.sh $ARGS"
else
eval "./packcheck.sh $ARGS"
fi

- name: Save hackage package index (non-Windows)
uses: actions/cache/save@v4
Expand Down Expand Up @@ -464,7 +478,12 @@ jobs:
run: |
source packcheck-setup.sh
setup_packcheck_args "BUILD_PACKAGE_ONLY"
eval "$PACKCHECK_SAFE $ARGS"
if test "$PACKCHECK_STRICT" = "y"
then
eval "./packcheck-safe.sh $ARGS"
else
eval "./packcheck.sh $ARGS"
fi

# Enable for debugging, this itself takes 50 sec on Windows, in packcheck
# build which is tiny.
Expand Down
Loading