Skip to content

Commit

Permalink
[ ci ] Remove hardcoded Stack root on Unix
Browse files Browse the repository at this point in the history
  • Loading branch information
banacorn committed Dec 3, 2024
1 parent aaaad2f commit bc9458c
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 32 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/test-unix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

name: CI (Unix)

defaults:
run:
shell: bash

on:
push:
branches: [master, ci-*, ci]
Expand All @@ -25,13 +29,26 @@ jobs:
- name: πŸ— Install yq
uses: frenck/action-setup-yq@v1

- name: πŸ” Determine stack resolver & GHC
- name: πŸ” Determine Stack resolver & GHC version
run: |
STACK_ROOT="$(stack path --stack-root)"
STACK_RESOLVER=$(yq .resolver stack.yaml)
GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
- name: πŸ— Setup Haskell
if : runner.os == 'macOS'
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ env.GHC_VERSION }}
enable-stack: true
stack-version: 'latest'

- name: πŸ” Determine Stack root
run: |
STACK_ROOT="$(stack path --stack-root)"
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
# things to be restored:
# Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
Expand Down Expand Up @@ -60,13 +77,13 @@ jobs:
run: |
echo PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig" >> "${GITHUB_ENV}"
- name: ⏬ Setup Haskell
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ env.GHC_VERSION }}
enable-stack: true
stack-version: 'latest'
# - name: ⏬ Setup Haskell
# uses: haskell-actions/setup@v2
# id: setup-haskell
# with:
# ghc-version: ${{ env.GHC_VERSION }}
# enable-stack: true
# stack-version: 'latest'

- name: πŸ”¨ Build
run: stack build
Expand Down
51 changes: 29 additions & 22 deletions .github/workflows/test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,26 @@ jobs:
- name: πŸ— Install yq
uses: frenck/action-setup-yq@v1

- name: πŸ” Determine stack root and resolver and GHC
- name: πŸ” Determine Stack resolver & GHC version
run: |
STACK_ROOT="$(stack path --stack-root)"
STACK_RESOLVER=$(yq .resolver stack.yaml)
GHC_VERSION=$(echo $(yq .compiler stack.yaml) | cut -c 5-)
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
# run: |
# STACK_ROOT="$(stack --system-ghc --no-install-ghc path --stack-root || echo "C:/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows")"
# echo "STACK_ROOT = ${STACK_ROOT}"
# echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
# What about C:/Users/runneradmin/AppData/Roaming/stack ?
echo GHC_VERSION="${GHC_VERSION}" >> "${GITHUB_ENV}"
- name: πŸ— Setup Haskell
if : runner.os == 'macOS'
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ env.GHC_VERSION }}
enable-stack: true
stack-version: 'latest'

- name: πŸ” Determine Stack root
run: |
STACK_ROOT="$(stack path --stack-root)"
echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
# things to be restored:
# Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
Expand Down Expand Up @@ -65,23 +72,23 @@ jobs:
run: |
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
- name: πŸ“Έ Build Snapshot
run: |
stack build --no-terminal --only-snapshot -j1
# - name: 🧰 Build Dependencies
# run: |
# stack build --no-terminal --only-dependencies
- name: 🧰 Build Dependencies
run: |
stack build --no-terminal --only-dependencies
# - name: πŸ”¨ Build and run tests
# run: |
# stack test
- name: πŸ§ͺ Run tests
run: |
stack test
- name: πŸ”¨ Build
run: stack build
# - name: πŸ”¨ Build
# run: stack build

- name: πŸ§ͺ Run tests
run: stack test
# - name: πŸ§ͺ Run tests
# run: stack test

# things to be cached

Expand Down

0 comments on commit bc9458c

Please sign in to comment.