summaryrefslogtreecommitdiff
path: root/.circleci/config.yml
blob: 5e094eedabb4782d71888126710ab05348039b5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
version: 2
jobs:
  build:
    macos:
      xcode: "9.0"
    steps:
      - checkout
      - run:
          name: Install Nix
          command: |
            curl https://nixos.org/nix/install | sh
      - run:
          name: Compute cache key
          command: |
            find . -name "*.cabal" -o -name "stack.yaml" -o -name "*.nix" -type f | sort | xargs cat > /tmp/stack-deps
      - restore_cache:
          keys:
            - hmatrix-stack-dependencies-{{ arch }}-{{ checksum "/tmp/stack-deps" }}
            - hmatrix-stack-dependencies-{{ arch }}-
      - run:
          name: Build dependencies
          shell: /bin/bash -eilo pipefail
          command: |
            nix-env -f nixpkgs.nix -iA stack
            stack --no-terminal --nix build --only-snapshot --prefetch --no-haddock --jobs=1
            # stack --no-terminal --nix build --only-snapshot --prefetch --no-haddock --test --bench --jobs=1
      - save_cache:
          key: hmatrix-stack-dependencies-{{ arch }}-{{ checksum "/tmp/stack-deps" }}
          paths:
            - ~/.stack
      - run:
          name: Build project
          shell: /bin/bash -eilo pipefail
          command: |
            stack --no-terminal --nix build --pedantic

    # docker:
    #   - image: terrorjack/vanilla:haskell
    # steps:
    #   - checkout
    #   - restore_cache:
    #       key: stack-deps-urk-{{ checksum "stack.yaml" }}
    #   - run:
    #       name: Update packages
    #       command: nix-channel --update
    #   - run:
    #       name: Setup build toolchain
    #       command: nix-shell --run "stack setup"
    #   - run:
    #       name: Building dependencies
    #       command: nix-shell --run "stack test --only-snapshot --prefetch"
    #   - save_cache:
    #       paths:
    #         - "~/.stack"
    #       key: stack-deps-urk-{{ checksum "stack.yaml" }}
    #   - run:
    #       name: Building
    #       command: nix-shell --run "stack build --pedantic"
    #   - run:
    #       name: Building tests
    #       command: nix-shell --run "stack test --pedantic --no-run-tests"
    #   - run:
    #       name: Running tests
    #       command: nix-shell --run "stack test"