From 01242bfc4cdd6239ed3a2c11220aec7ca7451e6c Mon Sep 17 00:00:00 2001 From: Shayne Fletcher Date: Sat, 27 Jan 2024 15:09:08 -0500 Subject: [PATCH] start building out github actions --- .github/workflows/hlint-from-scratch.yml | 22 ++++++++++++++++ hlint-from-scratch-init.sh | 32 +++++++++++++----------- hlint-from-scratch.sh | 15 ++++++----- 3 files changed, 49 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/hlint-from-scratch.yml diff --git a/.github/workflows/hlint-from-scratch.yml b/.github/workflows/hlint-from-scratch.yml new file mode 100644 index 0000000..85f6a7f --- /dev/null +++ b/.github/workflows/hlint-from-scratch.yml @@ -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 diff --git a/hlint-from-scratch-init.sh b/hlint-from-scratch-init.sh index a383410..9372027 100755 --- a/hlint-from-scratch-init.sh +++ b/hlint-from-scratch-init.sh @@ -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 @@ -50,20 +52,22 @@ else fi fi -if [ ! -d "stack" ]; then - git clone git@github.com: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 @@ -73,7 +77,7 @@ 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 @@ -81,7 +85,7 @@ 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 diff --git a/hlint-from-scratch.sh b/hlint-from-scratch.sh index f7bb66b..3883447 100755 --- a/hlint-from-scratch.sh +++ b/hlint-from-scratch.sh @@ -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 @@ -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