Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable MacOS caching for Github Actions #441

Merged
merged 1 commit into from
Dec 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ jobs:
- uses: actions/checkout@v1

- name: Select build directory
run: echo "CABAL_BUILDDIR=dist" >> $GITHUB_ENV
run: |
echo "CABAL_BUILDDIR=dist" >> $GITHUB_ENV
echo "PLAN_JSON=dist/cache/plan.json" >> $GITHUB_ENV
echo "$HOME/.cabal/bin" >> $GITHUB_PATH

- name: Install pkgconfiglite
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -80,12 +83,24 @@ jobs:
*) echo "CABAL_VERSION=3.4.0.0-rc4" >> $GITHUB_ENV;;
esac

- uses: actions/setup-haskell@v1
- uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ env.CABAL_VERSION }}

- name: MacOS cabal setup work-around
if: matrix.os == 'macos-latest'
run: |
echo insecure >> $HOME/.curlrc
ghcup install cabal 3.4.0.0-rc4
ghcup set cabal 3.4.0.0-rc4
rm $HOME/.curlrc

- name: Haskell versions
run: |
ghc --version
cabal --version

- name: Install build environment
if: matrix.os == 'ubuntu-latest'
Expand All @@ -109,17 +124,20 @@ jobs:
flags: -external-libsodium-vrf
EOF

- name: Record dependencies
run: |
cat ${{ env.PLAN_JSON }} | jq -r '."install-plan"[].id' | sort > dependencies.txt

- uses: actions/cache@v2
if: matrix.os != 'macos-latest'
name: Cache cabal store
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist
key: cache-${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('cabal-cache.cabal') }}-${{ github.sha }}
restore-keys: cache-${{ runner.os }}-${{ matrix.ghc }}-v1-${{ hashFiles('cabal-cache.cabal') }}-
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: cache-cabal-store-v1-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
restore-keys: |
cache-cabal-store-v1-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }}
cache-cabal-store-v1-${{ runner.os }}-${{ matrix.ghc }}-

- name: Install dependencies
- name: Build dependencies
run: cabal build all --builddir="$CABAL_BUILDDIR" --only-dependencies

- name: Build
Expand Down