Skip to content

Instantly share code, notes, and snippets.

@AlexeyRaga
Created December 14, 2020 06:40
Show Gist options
  • Save AlexeyRaga/3049a09d519bb88cae2ce1a183065008 to your computer and use it in GitHub Desktop.
Save AlexeyRaga/3049a09d519bb88cae2ce1a183065008 to your computer and use it in GitHub Desktop.
name: Haskell
defaults:
run:
shell: bash
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["8.6.5", "8.8.4", "8.10.2"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-haskell@v1
id: setup-haskell
with:
ghc-version: ${{ matrix.ghc }}
- name: Setup binary cache
uses: haskell-actions/cabal-cache-setup-s3@v1
with:
awsKey: ${{ secrets.AWS_ACCESS_KEY_ID }}
awsSecretKey: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
awsRegion: ${{ secrets.BINARY_CACHE_REGION }}
archiveUri: ${{ secrets.BINARY_CACHE_URI }}
cabalStorePath: ${{ steps.setup-haskell.outputs.cabal-store }}
threadsNum: 12
# - name: Setup private hackage
# uses: haskell-actions/hackage-add-repository@v1
# with:
# repositoryName: "private"
# repositoryUri: ${{ secrets.HACKAGE_SERVER }}
# authToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
- name: Configure
run: |
cabal update
cabal configure --enable-documentation --enable-tests --write-ghc-environment-files=ghc8.4.4+
- name: Restore cabal cache
run: cabal-cache-restore
- name: Build
run: cabal build all
- name: Test
run: cabal test all --test-show-details=direct
- name: Create package
id: create-package
uses: ./.github/actions/haskell-package
with:
buildDocs: 'true'
targetDir: "${{ runner.temp }}/dist/${{ matrix.ghc }}"
- name: Save cabal cache
if: ${{ always() }}
run: cabal-cache-store
- name: Store packages and documentation
uses: actions/upload-artifact@v2
with:
name: dist-${{ matrix.ghc }}
path: ${{ steps.create-package.outputs.targetDir }}
retention-days: 1
publish:
if: ${{ always() }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Get pre-built package and documentation
uses: actions/download-artifact@v2
with:
name: dist-8.8.4
path: ${{ runner.temp }}
- uses: haskell-actions/hackage-publish@v1
with:
hackageServer: ${{ secrets.HACKAGE_SERVER }}
hackageToken: ${{ secrets.HACKAGE_AUTH_TOKEN }}
packagesPath: ${{ runner.temp }}/pkgs
docsPath: ${{ runner.temp }}/docs
publish: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment