Skip to content

Merge pull request #81 from ja0nz/master #143

Merge pull request #81 from ja0nz/master

Merge pull request #81 from ja0nz/master #143

Workflow file for this run

# Based on https://kodimensional.dev/github-actions
name: CI
# Trigger the workflow on push or pull request, but only for the master branch
on:
pull_request:
push:
branches: [master]
env:
cabalConfig: --enable-tests --enable-benchmarks --disable-optimization --enable-deterministic --write-ghc-environment-files=always
jobs:
cabal:
name: ghc ${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ "ubuntu-latest" ]
cabal: [ "latest" ]
ghc: [ "8.10", "9.0" ]
fail-fast: false
steps:
- uses: cachix/install-nix-action@v12
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: haskell/actions/setup@v1
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- uses: actions/checkout@v2
- name: Install system dependencies
run: sudo apt-get install libsodium-dev
- name: Install Nix dependencies
run: nix-env -f '<nixpkgs>' -iA git nix-prefetch-git
- name: "Repository update"
run: |
cabal v2-update
# NOTE: Freeze is for the caching
- name: "Configuration freeze"
run: |
cabal v2-freeze $cabalConfig
- uses: actions/cache@v1
name: Cache cabal-store
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
dist-newstyle
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
- name: Build dependencies
run: |
cabal install tasty-discover
cabal build all --only-dependencies $cabalConfig
- name: Build
run: |
cabal build all $cabalConfig
- name: Test
run: |
cabal test all $cabalConfig
- name: "Haddock"
if: ${{ matrix.ghc == '8.10' }}
run: |
cabal v2-haddock $cabalConfig
- name: "Source distribution file"
if: ${{ matrix.ghc == '8.10' }}
run: |
cabal v2-sdist
nix:
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v12
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= orion:s0C06f1M46DCpHUUP2r8iIrhfytkCbXWltMeMMa4jbw= expipiplus1/update-nix-fetchgit:Z33K0KEImsos+kVTFvZxfLxaBi+D1jEeB6cX0uCo7B0=
substituters = https://cache.nixos.org/ s3://nix-cache?region=ap-southeast-1&scheme=https&endpoint=binarycache.home.monoid.al
secret-key-files = /root/nix-sign.sec
experimental-features = nix-command
- uses: actions/checkout@v2
- run: |
aws configure set aws_access_key_id nix
aws configure set aws_secret_access_key "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
sudo cp -r ~/.aws /root/.aws
sudo sh -c 'printf "%s" "${{ secrets.NIX_SIGNING_KEY }}" > /root/nix-sign.sec'
- run: |
drvs=$(nix-instantiate | sed 's/!.*//')
nix-build --no-out-link $drvs
reqs=$(nix-store --query --requisites --include-outputs $drvs)
nix copy \
--to 's3://nix-cache?region=ap-southeast-1&scheme=https&endpoint=binarycache.home.monoid.al' \
$reqs