-
Notifications
You must be signed in to change notification settings - Fork 95
144 lines (132 loc) · 4.32 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
name: Build with MacOS
on:
workflow_dispatch:
push:
# paths-ignore:
# - '.github/**'
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ghc: ["9.6.5"]
cabal: ["3.10"]
os: ["macos-14-large"]
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 }}-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
with:
path: |
~/.cabal/packages
~/.cabal/store
dist-newstyle
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.*', '*.cabal', 'src/**', 'test/**') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.ghc }}-
- name: Install GHC and Cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Confirm GHC and Cabal installation
run: |
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
- 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 }}
# 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@018b7ae0c480ba3dc4fa0cfa3a0bc1f05b7724b3
with:
bucket: "kadena-cabal-cache"
region: "us-east-1"
folder: "${{ matrix.os }}"
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
- name: Run Tests
run: |
ulimit -n 10000
cabal run tests -- --hide-successes
# 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