-
Notifications
You must be signed in to change notification settings - Fork 26
171 lines (144 loc) · 5.67 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
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
160
161
162
163
164
165
166
167
168
169
170
171
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull requests to master
push:
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
cogent-ci:
name: Cogent compiler CI
env:
COGENT_FULL_FEATURE: '+builtin-arrays +refinement-types +docgent +haskell-backend +llvm-backend'
COGENT_NOLLVM: '+builtin-arrays +refinement-types +docgent +haskell-backend -llvm-backend'
COGENT_NO_FEATURE: '-builtin-arrays -refinement-types -docgent -haskell-backend -llvm-backend'
# The type of runner that the job will run on
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
ghc-ver: [8.6.5, 8.8.4, 8.10.4]
feature-flags: [ full ]
include:
- ghc-ver: 9.0.1
feature-flags: no
- ghc-ver: 9.0.1
feature-flags: no-llvm
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out the repository
uses: actions/checkout@v2
with:
submodules: true
- name: Cache cabal package dependencies
id: cache-cabal-store
uses: actions/cache@v2
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-cache-${{ matrix.ghc-ver }}-${{ matrix.feature-flags }}-${{ github.run_number }}
restore-keys: |
cabal-cache-${{ matrix.ghc-ver }}-${{ matrix.feature-flags }}
cabal-cache-${{ matrix.ghc-ver }}
- name: Cache z3 build
id: cache-z3
uses: actions/cache@v2
with:
path: ~/z3
key: z3-cache-${{ matrix.ghc-ver }}-${{ matrix.feature-flags }}-${{ hashFiles('.git/modules/z3/HEAD') }}
- name: Show git log
run: git log
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:hvr/ghc
sudo apt-get update
sudo apt-get install cabal-install-3.4 ghc-${{ matrix.ghc-ver }} alex-3.1.7 happy-1.19.5
sudo apt-get install python3-setuptools python3-dev python3-wheel -y
pip3 install ruamel.yaml termcolor
sudo apt-get install llvm-9-dev
wget https://trustworthy.systems/projects/TS/autocorres/autocorres-1.6.1.tar.gz
tar -xf autocorres-1.6.1.tar.gz -C $GITHUB_WORKSPACE
- name: Set environement variables
run: |
echo "/opt/ghc/bin" >> $GITHUB_PATH
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "$HOME/z3/bin" >> $GITHUB_PATH
echo "AC_DIR=$GITHUB_WORKSPACE/autocorres-1.6.1" >> $GITHUB_ENV
- name: Install z3
if: matrix.feature-flags != 'no' && steps.cache-z3.outputs.cache-hit != 'true'
run: |
mkdir -p ~/z3
# build z3
cd $GITHUB_WORKSPACE/z3
python scripts/mk_make.py --prefix="$HOME/z3"
cd build
make
make install
- name: Validate setup
run: |
echo "\$PATH=$PATH"
echo "\$AC_DIR=$AC_DIR"
ghc-${{ matrix.ghc-ver }} --version
cabal --version
if ${{matrix.feature-flags != 'no-llvm'}}; then
sudo ln -s `which llvm-config-9` /usr/bin/llvm-config
llvm-config --version
fi
if ${{matrix.feature-flags != 'no'}}; then
ls -l ~/z3
ls -l ~/z3/bin
z3 --version
fi
- name: Initialise cabal
if: steps.cache-cabal-store.outputs.cache-hit != 'true'
run: cabal init
- name: Build Cogent compiler
run: |
cd $GITHUB_WORKSPACE/cogent
cabal new-update
if ${{ matrix.feature-flags == 'full'}}; then
COGENT_FLAGS="${{ env.COGENT_FULL_FEATURE }}"
elif ${{ matrix.feature-flags == 'no-llvm' }}; then
COGENT_FLAGS="${{ env.COGENT_NOLLVM }}"
else
COGENT_FLAGS="${{ env.COGENT_NO_FEATURE }}"
fi
cabal new-configure --flags="$COGENT_FLAGS" --enable-tests -w ghc-${{ matrix.ghc-ver }}
echo "::group::[cabal.project.local]"
cat cabal.project.local
echo "::endgroup::"
cabal new-install --install-method=copy --installdir=$HOME/.cabal/bin --overwrite-policy=always
echo "::group::[cogent --version]"
cogent --version
echo "::endgroup::"
- name: Run Cogent tests
run: |
cd $GITHUB_WORKSPACE/cogent
echo "::group::Cogent QuickCheck"
cabal new-test test-quickcheck # the other test is rarely affacted, so not enabled / zilinc
echo "::endgroup::"
echo "::group::Haddock"
cabal new-haddock
echo "::endgroup::"
echo "::group::test-suite"
make test-compiler
echo "::endgroup::"
echo "::group::libgum"
make test-libgum
echo "::endgroup::"
echo "::group::examples"
make examples
echo "::endgroup::"
echo "::group::ext2-linux"
cd $GITHUB_WORKSPACE/impl/fs/ext2/cogent && make .c-gen
echo "::endgroup::"
echo "::group::bilby-linux"
cd $GITHUB_WORKSPACE/impl/fs/bilby/cogent && make .c-gen
echo "::endgroup::"