-
Notifications
You must be signed in to change notification settings - Fork 7
117 lines (101 loc) · 3.25 KB
/
ci.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: "CI"
on:
push:
branches:
- main
pull_request:
jobs:
build-test:
name: "Build & test"
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
repository: input-output-hk/quickcheck-dynamic
# On pull_request events, we want to check out the latest commit of the
# PR, which is different to github.ref (the default, which would point
# to a "fake merge" commit). On push events, the default is fine as it
# refers to the pushed commit.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
# Also ensure we have all history with all tags
fetch-depth: 0
- name: Prepare nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: Github cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/[email protected]
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: |
cabal-${{ runner.os }}-${{ hashFiles('cabal.project', 'default.nix', 'shell.nix') }}
restore-keys: |
cabal-${{ runner.os }}-${{ hashFiles('cabal.project', 'default.nix', 'shell.nix') }}
- name: Prepare nix shell
run:
nix develop --accept-flake-config --build
- name: Build
run: |
nix develop --accept-flake-config --command cabal update
nix develop --accept-flake-config --command cabal build all --ghc-options=-Werror
- name: Test
run:
nix develop --accept-flake-config --command cabal test all
- name: Formatting
run:
nix develop --accept-flake-config --command fourmolu --mode check .
haddock:
name: "Haddock & benchmarks"
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
repository: input-output-hk/quickcheck-dynamic
- name: Prepare nix
uses: cachix/install-nix-action@v22
with:
extra_nix_config: |
accept-flake-config = true
- name: Github cache ~/.cabal/packages, ~/.cabal/store and dist-newstyle
uses: actions/[email protected]
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: |
cabal-${{ runner.os }}-${{ hashFiles('cabal.project', 'default.nix', 'shell.nix') }}
- name: Documentation (Haddock)
run: |
nix develop --accept-flake-config --command .github/workflows/ci-haddock.sh
- name: Upload build & test artifacts
uses: actions/upload-artifact@v2
with:
name: haddocks
path: ./docs
documentation:
name: Documentation
needs: [haddock]
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
repository: input-output-hk/quickcheck-dynamic
- name: Download generated documentation
uses: actions/download-artifact@v3
with:
name: haddocks
path: docs
- name: Publish Documentation
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}
publish_dir: docs/
enable_jekyll: true
force_orphan: true