Skip to content

Commit

Permalink
start building out github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
shayne-fletcher committed Jan 27, 2024
1 parent 463ecee commit 01242bf
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 20 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/hlint-from-scratch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: hlint-from-scratch
on:
push:
pull_request:
workflow_dispatch:
jobs:
hlint-from-scratch-ubuntu:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
steps:
- uses: actions/checkout@v4
- run: stack upgrade
- run: echo "repo_dir=$(mktemp -d)" >> $GITHUB_ENV
shell: bash
- run: ./hlint-from-scratch.sh --init="$repo_dir"
shell: bash
- run: ./hlint-from-scratch.sh --repo-dir="$repo_dir" --ghc-flavor="" --no-cabal --stack-yaml=stack-exact.yaml --resolver=ghc-9.6.4 --no-checkout
shell: bash
32 changes: 18 additions & 14 deletions hlint-from-scratch-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ fi

pushd "$repo_dir"

if [ ! -d "ghc" ]; then
git clone https://gitlab.haskell.org/ghc/ghc.git --recursive
pushd "ghc"
git fetch origin --tags
popd
if false; then
if [ ! -d "ghc" ]; then
git clone https://gitlab.haskell.org/ghc/ghc.git --recursive
pushd "ghc"
git fetch origin --tags
popd
fi
else
# update checkout to origin/master HEAD. not used right now.
if false; then
Expand All @@ -50,20 +52,22 @@ else
fi
fi

if [ ! -d "stack" ]; then
git clone [email protected]:commercialhaskell/stack.git
pushd "stack"
git fetch origin --tags
popd
if false; then
if [ ! -d "stack" ]; then
git clone https://github.com/commercialhaskell/stack.git
pushd "stack"
git fetch origin --tags
popd
fi
else
echo "skip clone stack..."
fi

if [ ! -d "ghc-lib" ]; then
git clone git@github.com:shayne-fletcher/ghc-lib.git
git clone https://github.com/shayne-fletcher/ghc-lib.git
pushd "ghc-lib"
git fetch origin --tags
git clone --recursive git@gitlab.haskell.org:ghc/ghc.git
git clone https://gitlab.haskell.org/ghc/ghc.git --recursive
pushd "ghc"
git fetch origin --tags
popd
Expand All @@ -73,15 +77,15 @@ else
fi

if [ ! -d "ghc-lib-parser-ex" ]; then
git clone git@github.com:shayne-fletcher/ghc-lib-parser-ex.git
git clone https://github.com/shayne-fletcher/ghc-lib-parser-ex.git
pushd "ghc-lib-parser-ex"
git fetch origin --tags
popd
else
echo "skip clone ghc-lib-parser-ex..."
fi
if [ ! -d "hlint" ]; then
git clone git@github.com:ndmitchell/hlint.git
git clone https://github.com/ndmitchell/hlint.git
pushd "hlint"
git fetch origin --tags
popd
Expand Down
15 changes: 9 additions & 6 deletions hlint-from-scratch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ while [ $# -gt 0 ]; do
GHC_FLAVOR="${BASH_REMATCH[1]}"
elif [[ "$1" =~ --init=([^[:space:]]+) ]]; then
init_arg="${BASH_REMATCH[1]}"
hlint-from-scratch-init --repo-dir="$init_arg"
./hlint-from-scratch-init.sh --repo-dir="$init_arg"
echo "repo-dir \"$repo_dir\" initialized"
echo "next: hlint-from-scratch --ghc-flavor=... ... --repo-dir=$repo_dir"
exit 0
Expand Down Expand Up @@ -236,11 +236,14 @@ else
fi
sha_ghc_lib_parser=$(shasum -a 256 "$repo_dir"/ghc-lib/ghc-lib-parser-"$version".tar.gz | awk '{ print $1 }')

if [ -z "$GHC_FLAVOR" ]; then
# If the above worked out, update CI.hs.
sed -i '' "s/current = \".*\" -- .*/current = \"$HEAD\" -- $today/g" CI.hs
# Report.
grep "current = .*" CI.hs
# temp disable while i focus on minimal set of github actions
if false; then
if [ -z "$GHC_FLAVOR" ]; then
# If the above worked out, update CI.hs.
sed -i '' "s/current = \".*\" -- .*/current = \"$HEAD\" -- $today/g" "$repo_dir"/ghc-lib/CI.hs
# Report.
grep "current = .*" "$repo_dir"/ghc-lib/CI.hs
fi
fi

# ghc-lib-parser-ex
Expand Down

0 comments on commit 01242bf

Please sign in to comment.