From 6d5a4fca51f211ec08c02e19e60e0103c58fe041 Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Sun, 28 Jan 2024 03:33:43 -0500 Subject: [PATCH] --no-builds --cabal --- .github/workflows/hlint-from-scratch.yml | 12 +++++------- hlint-from-scratch-cabal-build-test.sh | 5 ++++- hlint-from-scratch.sh | 22 ++++++++++++++-------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/hlint-from-scratch.yml b/.github/workflows/hlint-from-scratch.yml index 630583d..f44ea21 100644 --- a/.github/workflows/hlint-from-scratch.yml +++ b/.github/workflows/hlint-from-scratch.yml @@ -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 diff --git a/hlint-from-scratch-cabal-build-test.sh b/hlint-from-scratch-cabal-build-test.sh index eedbd22..27ca6d0 100755 --- a/hlint-from-scratch-cabal-build-test.sh +++ b/hlint-from-scratch-cabal-build-test.sh @@ -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" diff --git a/hlint-from-scratch.sh b/hlint-from-scratch.sh index 1b4eb7d..6805c4c 100755 --- a/hlint-from-scratch.sh +++ b/hlint-from-scratch.sh @@ -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="" @@ -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 @@ -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 @@ -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 ... @@ -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 @@ -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" \