Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Add 'cabal: true' option to enable caching
Browse files Browse the repository at this point in the history
  * Support both cabal and stack

  * Copy `hashFiles` until exposed exposed in the actions/cache API

  * Saving cache as a post-script

  * Additional action inputs: `cache-paths` and `cache-keys`

  * Add `output.stack-root` in `action.yml`
  • Loading branch information
omelkonian committed Dec 22, 2020
1 parent 6744967 commit 2306df7
Show file tree
Hide file tree
Showing 21 changed files with 123,793 additions and 10,260 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cache: true
- run: |
runhaskell --version
runhaskell __tests__/hello.hs
Expand Down Expand Up @@ -94,6 +95,7 @@ jobs:
enable-stack: true
stack-no-global: true
stack-version: ${{ matrix.stack }}
cache: true
- run: |
stack --version
stack
13 changes: 13 additions & 0 deletions setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ inputs:
stack-setup-ghc:
required: false
description: 'If specified, enable-stack must be set. Will run stack setup to install the specified GHC'
cache:
required: false
description: 'If specified, automatically caches cabal/stack-related directories.'
cache-keys:
required: false
description: 'List of caching keys, where the first is the "primary" key and the rest are "restore" keys to fall back on.'
cache-paths:
required: false
description: 'List of directories to cache.'
outputs:
ghc-path:
description: 'The path of the ghc executable _directory_'
Expand All @@ -32,6 +41,8 @@ outputs:
description: 'The path of the stack executable _directory_'
cabal-store:
description: 'The path to the cabal store'
stack-root:
description: 'The path to the stack root'
ghc-exe:
description: 'The path of the ghc _executable_'
cabal-exe:
Expand All @@ -41,3 +52,5 @@ outputs:
runs:
using: 'node12'
main: 'dist/index.js'
post: 'dist/save-cache.js'
post-if: success()

This comment has been minimized.

Copy link
@hazelweakly

hazelweakly Dec 22, 2020

Collaborator

This should probably run always() so that we can upload an updated cache even if a build fails partially through. That would certainly be quite helpful when debugging certain issues in a branch that adds new dependencies :)

13 changes: 13 additions & 0 deletions setup/dist/action.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2306df7

Please sign in to comment.