-
Notifications
You must be signed in to change notification settings - Fork 37
140 lines (136 loc) · 7.58 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Continuous integration
on: [push, pull_request]
env:
# Bump this number to invalidate the Github-actions cache
cache-invalidation-key: 0
nixpkgs-url: https://github.com/NixOS/nixpkgs/archive/574d1eac1c200690e27b8eb4e24887f8df7ac27c.tar.gz
NIX_PATH: https://github.com/NixOS/nixpkgs/archive/574d1eac1c200690e27b8eb4e24887f8df7ac27c.tar.gz
ghc-exe: $(pwd)/ghc-dps-compact-95615577d7/bin/ghc
ghc-name: ghc-dps-compact-95615577d7
ghc-internal-name: ghc-9.11.20241002-x86_64-unknown-linux
jobs:
cabal-test:
name: cabal test - GHC ${{ matrix.ghc-version }}
strategy:
matrix:
ghc-version: [96, 98, 910]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: false
- uses: cachix/install-nix-action@v15
with:
nix_path: "${{ env.nixpkgs-url }}"
- name: Cache Cabal dependencies
uses: actions/cache@v2
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: cabal-deps-${{ runner.os }}-${{ hashFiles('nix/sources.json') }}-${{ matrix.ghc-version }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('linear-base.cabal') }}-${{ github.sha }}
restore-keys: cabal-deps-${{ runner.os }}-${{ hashFiles('nix/sources.json') }}-${{ matrix.ghc-version }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('linear-base.cabal') }}-
- name: Build Nix dependencies
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "echo '=== Nix dependencies installed ==='"
- name: Init Cabal's config file
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal --config-file=/home/runner/.cabal/config user-config -f init"
- name: Update Cabal's database
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal update"
- name: Build Cabal's dependencies
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal build --dependencies-only"
- name: Build
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal build --run-tests"
- name: Haddock
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal haddock"
- name: cabal-docspec
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal-docspec"
- name: Build benchmarks
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "cabal build linear-base:bench:bench"
- name: Run benchmarks in isolation
run: nix-shell --arg ghcVersion '"${{ matrix.ghc-version }}"' --arg installHls 'false' --pure --run "echo $'\n\n=== Benchmarks (isolation) ===\n\n' > benchmark_ghc${{ matrix.ghc-version }}.txt && cabal run -v0 linear-dest:bench:bench -- -l | grep -P 'All\.[^\.]+\.benchmark\.' | while read -r name; do cabal run -v0 linear-dest:bench:bench -- -p '"'$'"0 == \"'\""'$'"name\"'\"' 2>&1 | tee -a benchmark_ghc${{ matrix.ghc-version }}.txt; done"
- name: Upload benchmark results
uses: actions/upload-artifact@v3
with:
name: linear-base_benchmarks_ghc${{ matrix.ghc-version }}
path: |
**/*.dump-simpl
benchmark_ghc${{ matrix.ghc-version }}.txt
retention-days: 90
cabal-test-ghc-dps-compact:
name: cabal test - ghc-dps-compact
runs-on: [self-hosted, Linux, X64]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Build Nix dependencies
run: nix-shell --arg installHls 'false' --pure --run "echo '=== Nix dependencies installed ==='"
- name: Install custom GHC
run: nix-shell --pure --run "rm -rf ${{ env.ghc-name }} ${{ env.ghc-internal-name }} && tar xJf ${{ env.ghc-name }}.tar.xz && mv ${{ env.ghc-internal-name }} ${{ env.ghc-name }}"
- name: Init Cabal's config file
run: nix-shell --arg installHls 'false' --pure --run "cabal --config-file=$HOME/.cabal/config user-config -f init"
- name: Update Cabal's database
run: nix-shell --arg installHls 'false' --pure --run "cabal update"
- name: Build Cabal's dependencies
run: nix-shell --arg installHls 'false' --pure --run "cabal build -w ${{ env.ghc-exe }} --dependencies-only"
- name: Build
run: nix-shell --arg installHls 'false' --pure --run "cabal build -w ${{ env.ghc-exe }} --run-tests"
- name: Haddock
run: nix-shell --arg installHls 'false' --pure --run "cabal haddock -w ${{ env.ghc-exe }}"
- name: cabal-docspec
run: nix-shell --arg installHls 'false' --pure --run "cabal-docspec -w ${{ env.ghc-exe }}"
- name: Build benchmarks
run: nix-shell --arg installHls 'false' --pure --run "cabal build -w ${{ env.ghc-exe }} linear-base:bench:bench"
- name: Run benchmarks in isolation
run: nix-shell --arg installHls 'false' --pure --run "echo $'\n\n=== Benchmarks (isolation) ===\n\n' > benchmark_${{ env.ghc-name }}.txt && cabal run -w ${{ env.ghc-exe }} -v0 linear-dest:bench:bench -- -l | grep -P 'All\.[^\.]+\.benchmark\.' | while read -r name; do cabal run -w ${{ env.ghc-exe }} -v0 linear-dest:bench:bench -- -p '"'$'"0 == \"'\""'$'"name\"'\"' 2>&1 | tee -a benchmark_${{ env.ghc-name }}.txt; done"
- name: Upload benchmark results
uses: actions/upload-artifact@v3
with:
name: linear-base_benchmarks_${{ env.ghc-name }}
path: |
**/*.dump-simpl
benchmark_${{ env.ghc-name }}.txt
retention-days: 90
ormolu:
name: check formatting with ormolu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: false
- uses: cachix/install-nix-action@v15
with:
nix_path: "${{ env.nixpkgs-url }}"
- name: Cache Stack dependencies
uses: actions/cache@v2
with:
path: ~/.stack
key: stack-deps-ormolu-${{ runner.os }}-${{ hashFiles('nix/sources.json') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack.yaml.lock') }}-${{ github.sha }}
restore-keys: stack-deps-ormolu-${{ runner.os }}-${{ hashFiles('nix/sources.json') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack.yaml.lock') }}-
- name: Build Nix dependencies
run: nix-shell --arg installHls 'false' --pure --run "echo '=== Nix dependencies installed ==='"
- name: check formatting
run: nix-shell --arg installHls 'false' --pure --run 'stack build ormolu && stack exec ormolu -- -m check $(find . -type f -name "*.hs-boot" -o -name "*.hs")'
stack-build:
name: stack build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: false
- uses: cachix/install-nix-action@v15
with:
nix_path: "${{ env.nixpkgs-url }}"
- name: Cache Stack dependencies
uses: actions/cache@v2
with:
path: ~/.stack
key: stack-deps-${{ runner.os }}-${{ hashFiles('nix/sources.json') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack.yaml.lock', 'linear-base.cabal') }}-${{ github.sha }}
restore-keys: stack-deps-${{ runner.os }}-${{ hashFiles('nix/sources.json') }}-v${{ env.cache-invalidation-key }}-${{ hashFiles('stack.yaml.lock', 'linear-base.cabal') }}-
- name: Build Nix dependencies
run: nix-shell --arg installHls 'false' --pure --run "echo '=== Nix dependencies installed ==='"
- name: Build
run: nix-shell --arg installHls 'false' --pure --run "stack build --pedantic --test --bench --no-run-benchmarks"