-
Notifications
You must be signed in to change notification settings - Fork 95
155 lines (142 loc) · 4.83 KB
/
macos.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build with MacOS
on:
workflow_dispatch:
push:
# paths-ignore:
# - '.github/**'
jobs:
# Note that cabal-cache-action only support arm64 for macos
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["9.8.2"]
cabal: ["3.12"]
os: ["macos-latest"]
cabalcache: ["true"]
steps:
# Setup
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/cache/restore@v4
name: Restore ghc & cabal binaries cache
id: ghc-cabal-cache
env:
key: ${{ runner.os }}-${{ runner.arch }}-ghc-cabal
with:
path: |
/Users/runner/.ghcup
key: ${{ env.key }}-${{ hashFiles('bin/cabal', 'bin/ghc') }}
restore-keys: ${{ env.key }}-
- uses: actions/cache/restore@v4
name: Restore dist-newstyle cache
id: cabal-dist-cache
env:
key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.ghc }}-dist
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ env.key }}-${{ hashFiles('cabal.*', '*.cabal', 'src/**', 'test/**', 'bench/**', 'tools/**') }}
restore-keys: |
${{ env.key }}
- name: Install GHC and Cabal
id: setup
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Confirm GHC and Cabal installation
run: |
echo "setup ghc-version: ${{ steps.setup.outputs.ghc-version }}"
echo "setup cabal-version: ${{ steps.setup.outputs.cabal-version }}"
echo "setup cabal-store: ${{ steps.setup.outputs.cabal-store }}"
ghc --version
cabal --version
ghc --version
cabal --version
- uses: actions/cache/save@v4
name: Cache ghc & cabal binaries
if: steps.ghc-cabal-cache.outputs.cache-hit != 'true'
with:
path: |
/Users/runner/.ghcup
key: ${{ steps.ghc-cabal-cache.outputs.cache-primary-key }}
- name: Install non-Haskell dependencies (macOS)
run: |
brew update && brew install gflags llvm snappy || true
- name: Create cabal.project.local
run: |
cat > cabal.project.local <<EOF
package *
documentation: False
package chainweb
documentation: False
benchmarks: True
tests: True
package pact
documentation: False
EOF
# Build
- name: Delete Freeze file if it exists
run: rm -f cabal.project.freeze
- name: Update package database
run: cabal update
- name: Display outdated packages
run: cabal outdated
- name: Configure build
run: |
cabal build all --dry-run
cabal freeze
- name: Sync from cabal cache
if: matrix.cabalcache == 'true'
uses: larskuhtz/cabal-cache-action@4b537195b33898fcd9adc62cee2a44986fd7b1b6
with:
bucket: "kadena-cabal-cache"
region: "us-east-1"
folder: "packages/${{ matrix.os }}"
store_path: ${{ steps.setup.outputs.cabal-store }}
aws_access_key_id: "${{ secrets.kadena_cabal_cache_aws_access_key_id }}"
aws_secret_access_key: "${{ secrets.kadena_cabal_cache_aws_secret_access_key }}"
- name: Install build dependencies
run: cabal build chainweb --only-dependencies
- name: Build chainweb library
run: cabal build lib:chainweb
- name: Build chainweb applications
run: cabal build exe:chainweb-node test:chainweb-tests exe:cwtool chainweb:bench:bench
- uses: actions/cache/save@v4
name: Save dist-newstyle cache
if: steps.cabal-dist-cache.outputs.cache-hit != 'true'
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ steps.cabal-dist-cache.outputs.cache-primary-key }}
- name: Run Tests
run: |
ulimit -n 10000
cabal run tests -- --hide-successes -p '!/chainweb216Test/'
# Checks
- name: Check that working directory tree is clean
run: |
mv cabal.project.freeze cabal.project.freeze.backup
git checkout -- cabal.project.freeze || true
if ! git diff --exit-code; then
echo "Git working tree is not clean. The build changed some file that is checked into git." 1>&2
exit 1
fi
mv cabal.project.freeze.backup cabal.project.freeze
- name: Run ea and verify consistency of genesis headers
run: |
cabal run cwtool -- ea
mv cabal.project.freeze cabal.project.freeze.backup
git checkout -- cabal.project.freeze || true
if ! git diff --exit-code; then
echo "Inconsistent genesis headers detected. Did you forget to run ea?" 1>&2
exit 1
fi
mv cabal.project.freeze.backup cabal.project.freeze