|
1 | | -# This is a basic workflow to help you get started with Actions |
| 1 | +name: Haskell |
2 | 2 |
|
3 | | -name: CI |
| 3 | +defaults: |
| 4 | + run: |
| 5 | + shell: bash |
4 | 6 |
|
5 | | -# Controls when the action will run. Triggers the workflow on push or pull request |
6 | | -# events but only for the master branch |
7 | | -on: |
8 | | - push: |
9 | | - branches: [ master ] |
10 | | - pull_request: |
11 | | - branches: [ master ] |
| 7 | +on: [push] |
12 | 8 |
|
13 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
14 | 9 | jobs: |
15 | | - # This workflow contains a single job called "build" |
16 | 10 | build: |
17 | | - # The type of runner that the job will run on |
18 | | - runs-on: ubuntu-latest |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + ghc: ["8.8.4", "8.6.5", "8.8.3", "8.10.2"] |
| 17 | + os: [ubuntu-latest] |
19 | 18 |
|
20 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
21 | 19 | steps: |
22 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
23 | 20 | - uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + submodules: true |
| 23 | + - uses: actions/setup-haskell@v1 |
| 24 | + id: setup-haskell |
| 25 | + with: |
| 26 | + ghc-version: ${{ matrix.ghc }} |
| 27 | + |
| 28 | + - name: Configure |
| 29 | + run: cabal configure --write-ghc-environment-files=ghc8.4.4+ |
| 30 | + |
| 31 | + - name: Restore cabal cache |
| 32 | + uses: haskell-works/cabal-cache-action@v1 |
| 33 | + env: |
| 34 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 35 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 36 | + BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }} |
| 37 | + BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }} |
| 38 | + BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }} |
| 39 | + with: |
| 40 | + args: | |
| 41 | + sync-from-archive \ |
| 42 | + --threads "$BINARY_CACHE_THREADS" \ |
| 43 | + --archive-uri "$BINARY_CACHE_URI" \ |
| 44 | + --region "$BINARY_CACHE_REGION" \ |
| 45 | + --store-path "${{ steps.setup-haskell.outputs.cabal-store }}" |
| 46 | +
|
| 47 | + - name: Build |
| 48 | + run: cabal build all |
| 49 | + |
| 50 | + - name: Save cabal cache |
| 51 | + uses: haskell-works/cabal-cache-action@v1 |
| 52 | + if: ${{ always() }} |
| 53 | + env: |
| 54 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 55 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 56 | + BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }} |
| 57 | + BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }} |
| 58 | + BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }} |
| 59 | + with: |
| 60 | + args: | |
| 61 | + sync-to-archive \ |
| 62 | + --threads "$BINARY_CACHE_THREADS" \ |
| 63 | + --archive-uri "$BINARY_CACHE_URI" \ |
| 64 | + --region "$BINARY_CACHE_REGION" \ |
| 65 | + --store-path "${{ steps.setup-haskell.outputs.cabal-store }}" |
24 | 66 |
|
25 | | - # Runs a single command using the runners shell |
26 | | - - name: Run a one-line script |
27 | | - run: echo Hello, world! |
| 67 | + - name: Build |
| 68 | + run: cabal test all --test-show-details=direct |
28 | 69 |
|
29 | | - # Runs a set of commands using the runners shell |
30 | | - - name: Run a multi-line script |
31 | | - run: | |
32 | | - echo Add other actions to build, |
33 | | - echo test, and deploy your project. |
| 70 | + - name: Save cabal cache |
| 71 | + uses: haskell-works/cabal-cache-action@v1 |
| 72 | + if: ${{ always() }} |
| 73 | + env: |
| 74 | + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 75 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 76 | + BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }} |
| 77 | + BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }} |
| 78 | + BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }} |
| 79 | + with: |
| 80 | + args: | |
| 81 | + sync-to-archive \ |
| 82 | + --threads "$BINARY_CACHE_THREADS" \ |
| 83 | + --archive-uri "$BINARY_CACHE_URI" \ |
| 84 | + --region "$BINARY_CACHE_REGION" \ |
| 85 | + --store-path "${{ steps.setup-haskell.outputs.cabal-store }}" |
0 commit comments