-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (131 loc) · 4.57 KB
/
ci.yml
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
name: CI
# Trigger the workflow on push or pull request, but only for the main branch
on:
pull_request:
push:
branches: ["main"]
jobs:
check:
name: Linting and formatting
runs-on: ubuntu-latest
steps:
- name: Checkout base repo
uses: actions/[email protected]
- name: Set up Haskell
id: setup-haskell
uses: haskell/actions/setup@v1
with:
ghc-version: 8.10
cabal-version: latest
- name: Get HLint
uses: actions/[email protected]
with:
repository: ndmitchell/hlint
path: ./hlint
ref: d33b02a6c187f4ca87a434b6c7f111c42da04794
- name: Configure HLint
working-directory: hlint
run: cabal new-configure -w ghc --disable-optimization
- name: Get Ormolu
uses: actions/[email protected]
with:
repository: tweag/ormolu
path: ./ormolu
ref: 807ee05aee2dff2a4222104abc75be3c776ee026
- name: Configure Ormolu
working-directory: ormolu
run: cabal new-configure -w ghc --disable-optimization
- name: Get cabal-fmt
uses: actions/[email protected]
with:
repository: phadej/cabal-fmt
path: ./cabal-fmt
ref: dc1e63bb10ddafd6152fae8f7206c3b201b0f7ab
- name: Configure cabal-fmt
working-directory: cabal-fmt
run: cabal new-configure -w ghc --disable-optimization
- name: Freeze
run: |
cd ./hlint
cabal new-freeze
cd ../ormolu
cabal new-freeze
cd ../cabal-fmt
cabal new-freeze
- name: Cache
uses: actions/[email protected]
env:
V: 0
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
./hlint/dist-newstyle
./ormolu/dist-newstyle
./cabal-fmt/dist-newstyle
key: ${{ env.V }}-${{ hashFiles('./hlint/cabal.project.freeze', './ormolu/cabal.project/freeze', './cabal-fmt/cabal.project.freeze') }}
restore-keys: ${{ env.V }}-
- name: Install HLint
working-directory: hlint
run: cabal new-install --install-method=copy --installdir=${{ runner.temp }} --overwrite-policy=always hlint
- name: Install Ormolu
working-directory: ormolu
run: cabal new-install --install-method=copy --installdir=${{ runner.temp }} --overwrite-policy=always exe:ormolu
- name: Install cabal-fmt
working-directory: cabal-fmt
run: cabal new-install --install-method=copy --installdir=${{ runner.temp }} --overwrite-policy=always cabal-fmt
- name: Run all checks
run: ./.github/check.sh ${{ runner.temp }}
native:
name: "Native: GHC ${{ matrix.ghc }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
ghc: ['8.10', '9.0', '9.2']
steps:
- name: Checkout base repo
uses: actions/[email protected]
- name: Set up Haskell
id: setup-haskell
uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 'latest'
- name: Configure
run: cabal new-configure --enable-tests
- name: Freeze
run: cabal freeze
- name: Cache
uses: actions/[email protected]
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: ${{ runner.os }}-${{ matrix.ghc }}-
- name: Build
run: cabal build
emulated:
name: "Emulated: GHC ${{ matrix.ghc }} on ${{ matrix.arch }}"
runs-on: ubuntu-latest
strategy:
matrix:
arch: ['aarch64', 'armv7', 'i386']
ghc: ['8.10.7', '9.0.1', '9.2.1']
steps:
- name : Checkout base repo
uses: actions/[email protected]
- name: Build
uses: GarnetOS/[email protected]
with:
arch: ${{ matrix.arch }}
distro: 'bullseye'
githubToken: ${{ github.token }}
install: |
apt-get update -q -y
apt-get install -q -y curl libnuma-dev autotools-dev clang llvm-dev make libgmp-dev libtinfo5 git
curl -JL https://downloads.haskell.org/~ghcup/0.1.17.4/${{ matrix.arch }}-linux-ghcup-0.1.17.4 > ghcup
chmod +x ghcup
./ghcup -v install ghc --set ${{ matrix.ghc }}
./ghcup -v install cabal --set
run: |
~/.ghcup/bin/cabal update
~/.ghcup/bin/cabal build -w ~/.ghcup/bin/ghc