Skip to content

Commit

Permalink
--no-builds --cabal
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne-fletcher committed Jan 28, 2024
1 parent 7269546 commit 6d5a4fc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/hlint-from-scratch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ jobs:
if: matrix.os == 'macos'
- run: cabal update
# - run: cabal new-install cabal-install --overwrite-policy=always
- run: cabal new-install apply-refact
if: matrix.os == 'ubuntu'
- run: |-
echo "GHCLIB_AZURE='1'" >> $GITHUB_ENV
echo "repo_dir=$HOME/project" >> $GITHUB_ENV
# - run: cabal new-install apply-refact
# if: matrix.os == 'ubuntu'
- run: echo "GHCLIB_AZURE='1'" >> $GITHUB_ENV
shell: bash
- run: echo "$repo_dir"&&./hlint-from-scratch.sh --init="$repo_dir"
- run: ./hlint-from-scratch.sh --init="$HOME/project"
shell: bash
- run: echo "$repo_dir"&&./hlint-from-scratch.sh --repo-dir="$repo_dir" --ghc-flavor="" --no-cabal --stack-yaml=stack-exact.yaml --resolver=ghc-9.6.4 --no-checkout
- run: ./hlint-from-scratch.sh --ghc-flavor="" --stack-yaml=stack-exact.yaml --resolver=ghc-9.6.4 --no-checkout --no-builds
shell: bash
5 changes: 4 additions & 1 deletion hlint-from-scratch-cabal-build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ cabal new-clean
# cabal new-build all
flags="--ghc-option=-j"
cmd="cabal new-build all $flags"
ffi_inc_path="C_INCLUDE_PATH=$(xcrun --show-sdk-path)/usr/include/ffi"
ffi_inc_path=""
if [ $(uname) == 'Darwin' ]; then
ffi_inc_path="C_INCLUDE_PATH=$(xcrun --show-sdk-path)/usr/include/ffi"
fi
ghc_version_number=$(ghc -V | tail -c 6)
if [[ "$ghc_version_number" == "9.2.2" ]]; then
eval "$ffi_inc_path" "$cmd"
Expand Down
22 changes: 14 additions & 8 deletions hlint-from-scratch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ args="
"
usage="usage: $prog $args"

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

GHC_FLAVOR=""
no_builds=""
no_cabal=""
Expand All @@ -81,7 +83,7 @@ while [ $# -gt 0 ]; do
GHC_FLAVOR="${BASH_REMATCH[1]}"
elif [[ "$1" =~ --init=([^[:space:]]+) ]]; then
repo_dir="${BASH_REMATCH[1]}"
./hlint-from-scratch-init.sh --repo-dir="$repo_dir"
"$SCRIPT_DIR"/hlint-from-scratch-init.sh --repo-dir="$repo_dir"
echo "repo-dir \"$repo_dir\" initialized"
echo "next: hlint-from-scratch --ghc-flavor=... ... --repo-dir=$repo_dir"
exit 0
Expand Down Expand Up @@ -248,7 +250,7 @@ fi

# ghc-lib-parser-ex

cd ../ghc-lib-parser-ex && git checkout .
cd "$repo_dir"/ghc-lib-parser-ex && git checkout .
branch=$(git rev-parse --abbrev-ref HEAD)

# if the flavor indicates ghc's master branch get on
Expand Down Expand Up @@ -341,7 +343,7 @@ set -e

# Hlint

cd ../hlint && git checkout .
cd "$repo_dir"/hlint && git checkout .
branch=$(git rev-parse --abbrev-ref HEAD)
# if the flavor indicates ghc's master branch get on hlint's
# 'ghc-next' branch ...
Expand Down Expand Up @@ -448,11 +450,15 @@ fi
# context. Well, never mind; take the approach of constraining the
# bounds exactly. It's kind of more explicitly saying what we mean
# anyway.
sed -i '' "s/^version:.*\$/version: $version/g" hlint.cabal
sed -i '' "s/^.*ghc-lib-parser ==.*\$/ ghc-lib-parser == $version/g" hlint.cabal
sed -i '' "s/^.*ghc-lib-parser-ex >=.*\$/ ghc-lib-parser-ex == $version/g" hlint.cabal
set +e
echo "phase test-ghc-9.0.sh in $(pwd)"
ls .

sed -i'' "s/^version:.*\$/version: $version/g" hlint.cabal
sed -i'' "s/^.*ghc-lib-parser ==.*\$/ ghc-lib-parser == $version/g" hlint.cabal
sed -i'' "s/^.*ghc-lib-parser-ex >=.*\$/ ghc-lib-parser-ex == $version/g" hlint.cabal
# sarif tests encode the current hlint version number
sed -i '' "s/3.5/$version/g" tests/sarif.test # hack. see issue https://github.com/ndmitchell/hlint/issues/1492
sed -i'' "s/3.5/$version/g" tests/sarif.test # hack. see issue https://github.com/ndmitchell/hlint/issues/1492
eval "stack" "$stack_yaml_flag" "sdist" "." "--tar-dir" "."

# - Generate a cabal.project of
Expand All @@ -464,7 +470,7 @@ eval "stack" "$stack_yaml_flag" "sdist" "." "--tar-dir" "."
# - Run ghc-lib-test-mini-hlint, ghc-lib-test-mini-compile and the
# hlint test suite.
tmp_dir=$(mktemp -d)
(cd "$tmp_dir" && hlint-from-scratch-cabal-build-test.sh \
(cd "$tmp_dir" && "$SCRIPT_DIR"/hlint-from-scratch-cabal-build-test.sh \
"$cabal_with_ghc_flag" \
--version-tag="$version" \
--ghc-lib-dir="$repo_dir/ghc-lib" \
Expand Down

0 comments on commit 6d5a4fc

Please sign in to comment.