-
Notifications
You must be signed in to change notification settings - Fork 17
160 lines (140 loc) · 5.05 KB
/
linux.yaml
File metadata and controls
160 lines (140 loc) · 5.05 KB
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
156
157
158
159
name: Linux CI
on:
push:
branches: [ master, gh-actions ]
pull_request:
branches: [ master ]
schedule:
- cron: '13 9 * * *'
jobs:
Build_and_Test:
name: ${{ matrix.os }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
cabal: ["3.4"]
ghc: ["8.10"]
os: [ubuntu-latest]
env:
CAIDE_CMAKE_CONFIGURE_ARGS: "-GNinja,-DCMAKE_CXX_COMPILER_LAUNCHER=ccache,-DCMAKE_C_COMPILER_LAUNCHER=ccache"
# TODO: --enable-coverage (https://github.com/haskell/cabal/issues/6440)
CONFIG: "--enable-tests --enable-benchmarks"
steps:
- name: Install prerequisites
env:
runner_os: ${{ runner.os }}
shell: python
run: |
import os, subprocess
runner_os = os.environ['runner_os']
if runner_os == 'Linux':
commands = ['sudo apt-get install ccache ninja-build', 'which ccache', 'which ninja']
elif runner_os == 'macOS':
commands = ['brew install ccache ninja', 'which ccache', 'which ninja']
else:
commands = ['choco install ccache ninja', 'where ccache', 'where ninja']
for cmd in commands:
subprocess.check_call(cmd.split())
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Set environment variables
run: |
ghc --version | grep -E --only-matching '[0-9\.]+' \
| awk '{ print "GHCVER="$0 }' >> $GITHUB_ENV
- name: Set environment variables
run: |
grep -i '^version:' "libcaide/libcaide.cabal" \
| awk '{ print "CAIDE_EXE_RELATIVE_PATH=dist-newstyle/build/x86_64-linux/ghc-${{ env.GHCVER }}/libcaide-"$2"/build/caide/caide" }' \
>> $GITHUB_ENV
- name: Create key for ccache
shell: bash
run: |
echo >common.txt
g++ --version >>common.txt
ls -l --time-style=long-iso $(readlink -f $(which g++)) >>common.txt
gcc --version >>common.txt
ls -l --time-style=long-iso $(readlink -f $(which g++)) >>common.txt
cpp --version >>common.txt
ls -l --time-style=long-iso $(readlink -f $(which cpp)) >>common.txt
cmake --version >>common.txt
ls -l --time-style=long-iso $(readlink -f $(which cmake)) >>common.txt
ninja --version >>common.txt
ls -l --time-style=long-iso $(readlink -f $(which ninja)) >>common.txt
cp common.txt llvm-submodule.txt
git -C libcaide/cbits/cpp-inliner submodule status >>llvm-submodule.txt
cp common.txt submodules.txt
git submodule status >>submodules.txt
cat llvm-submodule.txt submodules.txt
- name: ccache cache
uses: actions/cache@v3
env:
cache-name: ccache
cache-version: 4
with:
path: ~/.cache/ccache
key: ${{ runner.os }}-build-${{ env.cache-name }}${{ env.cache-version }}-${{ hashFiles('llvm-submodule.txt') }}-${{ hashFiles('submodules.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}${{ env.cache-version }}-${{ hashFiles('llvm-submodule.txt') }}-
- name: Update cabal index, resolve dependencies and create freeze file
shell: bash
run: |
cd libcaide
cabal update $CONFIG
cabal freeze $CONFIG
cat cabal.project.freeze
- name: Cabal cache
uses: actions/cache@v3
env:
cache-name: cabal
cache-version: 3
with:
path: |
${{ steps.setup-haskell-cabal.outputs.cabal-store }}
libcaide/dist-newstyle
key: ${{ runner.os }}-${{ env.cache-name }}${{ env.cache-version }}-${{ env.GHCVER }}-${{ hashFiles('libcaide/cabal.project.freeze') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}${{ env.cache-version }}-${{ env.GHCVER }}-
- name: Install dependencies
shell: bash
run: |
cd libcaide
cabal build --only-dependencies $CONFIG
- name: Build
shell: bash
run: |
ccache --show-config
ccache --show-stats
cd libcaide
# Force recompilation due to https://github.com/haskell/cabal/issues/4746
echo "--$RANDOM" >> libcaide.cabal
cabal build $CONFIG all
strip $CAIDE_EXE_RELATIVE_PATH
ccache --show-stats
- name: Publish the executable
uses: actions/upload-artifact@v1
with:
name: caide
path: libcaide/${{ env.CAIDE_EXE_RELATIVE_PATH }}
# Disable until https://github.com/haskell/actions/issues/128 is fixed.
# - name: Set up HLint
# uses: haskell/actions/hlint-setup@v2
# - name: Copy HLint config
# run: cp libcaide/.hlint.yaml .
# - name: Run HLint
# uses: haskell/actions/hlint-run@v2
# with:
# path: libcaide/
# fail-on: never
- name: Run tests
shell: bash
run: |
cd libcaide
export CAIDE=$(pwd)/$CAIDE_EXE_RELATIVE_PATH
MONO=mono CSC=csc tests/run-tests.sh
cabal test $CONFIG