diff --git a/.github/workflows/test-linux.yaml b/.github/workflows/test-linux.yaml index 264aeea..418ff49 100644 --- a/.github/workflows/test-linux.yaml +++ b/.github/workflows/test-linux.yaml @@ -27,15 +27,6 @@ jobs: restore-keys: | ${{ runner.os }}-stack-global - - name: 💾 Restore cached stack-installed programs in ~/.local/bin - id: stack-programs - uses: actions/cache/restore@v3 - with: - path: ~/.local/bin - key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }} - restore-keys: | - ${{ runner.os }}-stack-programs - - name: 💾 Restore cached .stack-work id: stack-work uses: actions/cache/restore@v3 @@ -49,10 +40,11 @@ jobs: - name: ⏬ Install stack run: | - mkdir -p ~/.local/bin - export PATH=~/.local/bin:$PATH + # mkdir -p ~/.local/bin + # export PATH=~/.local/bin:$PATH + ## Stack is preinstalled on the GHA runners # curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack - if [[ ! -x ~/.local/bin/stack ]]; then curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi + # if [[ ! -x ~/.local/bin/stack ]]; then curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi stack --version - name: ⏬ Install GHC @@ -78,13 +70,6 @@ jobs: path: ~/.stack key: ${{ steps.stack-global.outputs.cache-primary-key }} - - name: 💾 Cache stack-installed programs in ~/.local/bin - if: always() && steps.stack-programs.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - path: ~/.local/bin - key: ${{ steps.stack-programs.outputs.cache-primary-key }} - - name: 💾 Cache .stack-work if: always() && steps.stack-work.outputs.cache-hit != 'true' uses: actions/cache/save@v3 diff --git a/.github/workflows/test-mac.yaml b/.github/workflows/test-mac.yaml index 1cf9120..7098188 100644 --- a/.github/workflows/test-mac.yaml +++ b/.github/workflows/test-mac.yaml @@ -27,15 +27,6 @@ jobs: restore-keys: | ${{ runner.os }}-stack-global - - name: 💾 Restore cached stack-installed programs in ~/.local/bin - id: stack-programs - uses: actions/cache/restore@v3 - with: - path: ~/.local/bin - key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }} - restore-keys: | - ${{ runner.os }}-stack-programs - - name: 💾 Restore cached .stack-work id: stack-work uses: actions/cache/restore@v3 @@ -53,10 +44,11 @@ jobs: - name: ⏬ Install stack run: | - mkdir -p ~/.local/bin - export PATH=~/.local/bin:$PATH + # mkdir -p ~/.local/bin + # export PATH=~/.local/bin:$PATH + ## Stack is preinstalled on the GHA runners # brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack - if [[ ! -x ~/.local/bin/stack ]]; then brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi + # if [[ ! -x ~/.local/bin/stack ]]; then brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi stack --version - name: ⏬ Install GHC @@ -80,13 +72,6 @@ jobs: path: ~/.stack key: ${{ steps.stack-global.outputs.cache-primary-key }} - - name: 💾 Cache stack-installed programs in ~/.local/bin - if: always() && steps.stack-programs.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - path: ~/.local/bin - key: ${{ steps.stack-programs.outputs.cache-primary-key }} - - name: 💾 Cache .stack-work if: always() && steps.stack-work.outputs.cache-hit != 'true' uses: actions/cache/save@v3 diff --git a/.github/workflows/test-windows.yaml b/.github/workflows/test-windows.yaml index e02dbbb..3a25690 100644 --- a/.github/workflows/test-windows.yaml +++ b/.github/workflows/test-windows.yaml @@ -8,11 +8,21 @@ on: pull_request: branches: [master] +defaults: + run: + shell: bash + jobs: build: runs-on: windows-latest steps: + - name: Determine stack root + run: | + STACK_ROOT="$(stack --system-ghc --no-install-ghc path --stack-root)" + echo "STACK_ROOT = ${STACK_ROOT}" + echo STACK_ROOT="${STACK_ROOT:-C:/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows}" >> "${GITHUB_ENV}" + - name: 📥 Checkout repository uses: actions/checkout@v4 @@ -22,21 +32,10 @@ jobs: id: stack-global uses: actions/cache/restore@v3 with: - path: C:\Users\runneradmin\AppData\Roaming\stack\ - key: ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }} - restore-keys: | - ${{ runner.os }}-appdata-roaming-stack - - - name: 💾 Restore cached stack-installed programs in ~/.local/bin - id: stack-programs - uses: actions/cache/restore@v3 - with: - path: C:\Users\runneradmin\AppData\Local\Programs\stack\ - # which files signal a change in stack's global db ? - # **.yaml includes */package.yaml and stack.yaml* (too many), and hopefully no other changing yamls - key: ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }} + path: ${{ env.STACK_ROOT }} + key: ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-appdata-local-programs-stack + ${{ runner.os }}-stack-global - name: 💾 Restore cached .stack-work id: stack-work @@ -50,39 +49,37 @@ jobs: # actions - name: ⏬ Install stack + ## Stack is preinstalled on GHA runners. + # #if: steps.stack-programs-dir.outputs.cache-hit != 'true' # this step is needed to get stack.exe into PATH, for now + # curl -sL https://get.haskellstack.org/stable/windows-x86_64.zip -o stack.zip + # 7z x stack.zip stack.exe run: | - curl -sL https://get.haskellstack.org/stable/windows-x86_64.zip -o stack.zip - 7z x stack.zip stack.exe which stack stack --version - which ./stack - ./stack --version - # must avoid GHC versions broken on windows such as 8.8.3 with https://gitlab.haskell.org/ghc/ghc/issues/17926 - # current default stack.yaml uses GHC 8.8.4 which hopefully is ok - name: ⏬ Install GHC # if: steps.stack-programs-dir.outputs.cache-hit != 'true' # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH% run: | - ./stack --no-terminal setup --install-ghc + stack --no-terminal setup --install-ghc - name: Install the icu library run: | - ./stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf + stack exec -- pacman -S --noconfirm mingw-w64-x86_64-icu mingw-w64-x86_64-pkgconf - name: 📸 Build Snapshot run: | - ./stack build --no-terminal --only-snapshot -j1 + stack build --no-terminal --only-snapshot -j1 - name: 🧰 Build Dependencies run: | - ./stack build --no-terminal --only-dependencies + stack build --no-terminal --only-dependencies - name: 🔨 Build and run tests run: | - ./stack test + stack test # things to be cached @@ -90,16 +87,9 @@ jobs: if: always() && steps.stack-global.outputs.cache-hit != 'true' uses: actions/cache/save@v3 with: - path: ~/.stack + path: ${{ env.STACK_ROOT }} key: ${{ steps.stack-global.outputs.cache-primary-key }} - - name: 💾 Cache stack-installed programs in ~/.local/bin - if: always() && steps.stack-programs.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 - with: - path: ~/.local/bin - key: ${{ steps.stack-programs.outputs.cache-primary-key }} - - name: 💾 Cache .stack-work if: always() && steps.stack-work.outputs.cache-hit != 'true' uses: actions/cache/save@v3