-
Notifications
You must be signed in to change notification settings - Fork 26
244 lines (236 loc) · 8.47 KB
/
ci.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# This is set up to build both reopt, reopt-vcg, and the VSCode extension, as
# well as upload artifacts to relevant locations. However, currently we are
# only supporting reopt, so the other tasks are temporarily commented out to
# ease development.
name: CI
on: [push]
jobs:
# This task builds the Docker "reopt-dev" image used to build reopt.
dev-img:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Export DEV_HASH
run: echo "DEV_HASH=`shasum containers/dev/Dockerfile | cut -d' ' -f1`" >> $GITHUB_ENV
- name: Cache Developer environment
id: cache
uses: actions/cache@v3
with:
path: cache
key: reopt-dev-${{ env.DEV_HASH }}
- name: Build
run: docker build -t galoisbinaryanalysis/reopt-dev containers/dev
if: steps.cache.outputs.cache-hit != 'true'
- name: Push to Docker hub
run: |
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u galoisbinaryanalysisbot --password-stdin
docker push galoisbinaryanalysis/reopt-dev
if: steps.cache.outputs.cache-hit != 'true'
- name: Create dummy directory for cache
run: mkdir -p cache
if: steps.cache.outputs.cache-hit != 'true'
# This task builds reopt on the reopt-dev container and
# generates the reopt artifact with the binary.
build:
needs: [dev-img]
runs-on: ubuntu-20.04
container: galoisbinaryanalysis/reopt-dev
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set env.home and env.ghc
run: |
echo "home=$HOME" >> $GITHUB_ENV
echo "ghc=`ghc --numeric-version`" >> $GITHUB_ENV
- name: Restore cabal cache and dist-newstyle
uses: actions/cache/restore@v3
id: haskell-cache
with:
path: |
${{ env.home }}/.local/state/cabal/store/ghc-${{ env.ghc }}
dist-newstyle
# Per-commit cache
key: haskell-cache-${{ env.ghc }}-${{ github.ref }}-${{ github.sha }}
# Per-branch and per-commit caches
restore-keys: |
haskell-cache-${{ env.ghc }}-${{ github.ref }}
haskell-cache-${{ env.ghc }}
- name: Cabal freeze and enable werror.
run: |
ln -s cabal.project.freeze.ghc.${{ env.ghc }} cabal.project.freeze
ln -s cabal.project.werror cabal.project.local
- name: Cabal update
run: cabal update
- name: Install
run: cabal install -j exe:reopt
- name: Unit Tests
run: cabal test -j reopt-tests
- name: CentOS7 reopt executable tests
run: |
./scripts/test_reopt.sh
./scripts/test_reopt.sh getopt
- name: CentOS7 reopt-explore executable tests
run: |
./scripts/test_reopt_explore.sh small
# ./scripts/test_reopt_explore.sh all-debug-info
# Disabled temporarily so we can update reopt
#- name: CentOS7 reopt-explore executable tests (long)
# run: ./scripts/test_reopt_explore.sh all
- name: reopt-explore CentOS7 Summary Artifact
uses: actions/upload-artifact@v2
with:
name: centos7-bin-summary.txt
path: deps/reopt-benchmark-binaries/centos7-dev/centos7-bin-summary.txt
- name: Create archive
run: |
mkdir -p dist/reopt/bin
cp $HOME/.local/bin/reopt dist/reopt/bin
cp $HOME/.local/bin/reopt-explore dist/reopt/bin
cp $HOME/.local/bin/reopt-relink dist/reopt/bin
cd dist
tar cvfz reopt.tgz reopt
- name: Make reopt
uses: actions/upload-artifact@v2
with:
name: reopt
path: dist/reopt.tgz
- name: Unconditionally save cabal store
uses: actions/cache/save@v3
# c.f. https://github.com/actions/cache/issues/1154
if: always() && !steps.haskell-cache.outputs.cache-hit
with:
path: |
${{ env.home }}/.local/state/cabal/store/ghc-${{ env.ghc }}
dist-newstyle
key: haskell-cache-${{ env.ghc }}-${{ github.ref }}-${{ github.sha }}
# # This builds the VSCode extension
# vscode-extension:
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - name: Install npm
# run: |
# sudo apt-get update
# sudo apt-get install --no-install-recommends -y npm
# - name: Install vsce
# run: sudo npm install -g --no-optional vsce
# - name: Install dependencies
# working-directory: vscode-plugin
# run: npm install
# - name: Package extension
# working-directory: vscode-plugin
# run: |
# vsce package
# mv reopt-0.0.1.vsix reopt.vsix
# - name: Upload extension artifact
# uses: actions/upload-artifact@v2
# with:
# name: vscode-extension
# path: vscode-plugin/reopt.vsix
# reopt-vcg:
# runs-on: ubuntu-20.04
# steps:
# - name: Get reopt
# uses: actions/checkout@v3
# - name: Dependencies
# run: sudo apt-get install -y --no-install-recommends llvm-8 llvm-8-dev clang-8
# - name: Clone reopt-vcg
# run: |
# sed -i -e 's|[email protected]:|https://github.com/|' .gitmodules
# git submodule update --init --depth 1 deps/reopt-vcg
# cd deps/reopt-vcg
# sed -i -e 's|[email protected]:|https://github.com/|' .gitmodules
# git submodule update --init --depth 1
# - name: Build
# working-directory: deps/reopt-vcg
# run: ./build.sh
# - name: Test
# working-directory: deps/reopt-vcg
# run: .github/ci.sh run-tests
# - name: Create archive
# run: |
# mkdir -p dist/reopt-vcg/bin
# cp deps/reopt-vcg/build/bin/reopt-vcg dist/reopt-vcg/bin/reopt-vcg
# cp deps/reopt-vcg/deps/cvc4-2020-09-16-x86_64-linux-opt dist/reopt-vcg/bin/cvc4
# cd dist
# tar cvfz reopt-vcg.tgz reopt-vcg
# - name: Make reopt-vcg
# uses: actions/upload-artifact@v2
# with:
# name: reopt-vcg
# path: dist/reopt-vcg.tgz
# integration-tests:
# needs: [build, reopt-vcg]
# runs-on: ubuntu-20.04
# steps:
# - name: Install dependencies
# run: sudo apt-get update && sudo apt-get install -y gdb llvm-8
# - name: Checkout
# uses: actions/checkout@v3
# - name: Download reopt artifact
# uses: actions/download-artifact@v2
# with:
# name: reopt
# path: dist
# - name: Download reopt-vcg artifact
# uses: actions/download-artifact@v2
# with:
# name: reopt-vcg
# path: dist
# - name: Unpack and add executables to PATH
# run: |
# tar xvfz reopt.tgz
# tar xvfz reopt-vcg.tgz
# echo "$PWD/reopt/bin" >> $GITHUB_PATH
# echo "$PWD/reopt-vcg/bin" >> $GITHUB_PATH
# working-directory: dist
# - name: Test nweb
# run: ./integration_test.sh
# working-directory: vcg-test-programs/nweb
# upload:
# needs: [build, vscode-extension, reopt-vcg]
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# submodules: true
# - name: Download reopt artifact
# uses: actions/download-artifact@v2
# with:
# name: reopt
# path: dist
# - name: Download reopt-vcg artifact
# uses: actions/download-artifact@v2
# with:
# name: reopt-vcg
# path: dist
# - name: Copy files
# run: |
# cd containers/eval
# tar xvfz ../../dist/reopt.tgz
# tar xvfz ../../dist/reopt-vcg.tgz
# - name: Download extension artifact
# uses: actions/download-artifact@v2
# with:
# name: vscode-extension
# path: containers/eval
# - name: Build docker image
# run: |
# docker build -t galoisbinaryanalysis/reopt:head -t galoisbinaryanalysis/reopt:latest containers/eval
# - name: Push to Docker hub
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# run: |
# echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u galoisbinaryanalysisbot --password-stdin
# docker push galoisbinaryanalysis/reopt --all-tags
# - name: Build docker image with examples
# run: |
# docker build -t galoisbinaryanalysis/reopt:latest-with-examples -f containers/eval-with-examples/Dockerfile .
# - name: Push to Docker hub
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# run: |
# echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u galoisbinaryanalysisbot --password-stdin
# docker push galoisbinaryanalysis/reopt:latest-with-examples