-
Notifications
You must be signed in to change notification settings - Fork 37
195 lines (163 loc) · 7.15 KB
/
main.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Main workflow
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build and test elpi
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-compiler:
- 4.14.x
- 4.08.x
profile:
- dev
parser:
- menhir
include:
- os: ubuntu-latest
ocaml-compiler: 5.1.x
profile: fatalwarnings
parser: menhir
- os: ubuntu-latest
ocaml-compiler: 4.11.x
profile: dev
parser: menhir-camlp5
runs-on: ${{ matrix.os }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout code
uses: actions/checkout@v2
# Environment setup ###########################################################
#
# We install missing bits and we mae ${{ env.workspace }} points to the current
# working directory in a system agnostic way
#
# Note "opam exec -- stuff" executes stuff in a "system independent way" inside
# the opam root *but* the way "stuff" is parsed is not system independent.
# Hence we use GH's ${{ expressions }} rather than the ones from the shell.
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: avsm/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-local-packages:
# dune-cache: true # does not seem to work
- name: Install opam-depext
run: opam install opam-depext || true # in opam 2.1 there is no depext to install
- name: Extra setup on Linux
if: runner.os == 'Linux'
run: |
opam exec -- echo "workspace=${{ github.workspace }}" >> $GITHUB_ENV
sudo apt-get install wdiff
- name: Extra setup on macOS
if: runner.os == 'macOS'
run: |
brew install gnu-time
brew install wdiff
opam exec -- echo "workspace=${{ github.workspace }}" >> $GITHUB_ENV
- name: Extra setup on Windows
if: runner.os == 'Windows'
run: |
opam exec -- cygpath -m ${{ github.workspace }} | % {$_ -replace "^","workspace=" } | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
opam exec -- cygpath -m "$Env:CYGWIN_ROOT" | % {$_ -replace "^","cygwin_root=" } | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
opam exec -- sed -i ' ' tests/sources/*.elpi
& "$Env:CYGWIN_ROOT/setup-x86_64.exe" -q -P time
& "$Env:CYGWIN_ROOT/setup-x86_64.exe" -q -P which
& "$Env:CYGWIN_ROOT/setup-x86_64.exe" -q -P wdiff
opam exec -- which which
opam exec -- time which
opam exec -- which time
opam exec -- which wdiff
# Build ######################################################################
#
# We generate binaries like elpi-4.07.1-Linux.exe in the working directory
- name: Install real dependencies
run: |
opam install ./elpi.opam --deps-only --with-doc --with-test
- name: Install optional dependencies for menhir-camlp5 parser
if: matrix.parser == 'menhir-camlp5'
run: |
opam depext camlp5 || true # no depext on opam 2.1
sudo apt-get install libstring-shellquote-perl
sudo apt-get install libipc-system-simple-perl
opam install ./elpi-option-legacy-parser.opam
opam exec -- make config LEGACY_PARSER=1
- name: Build elpi with dune profile ${{ matrix.profile }}
run: |
opam exec -- dune subst
opam exec -- make build DUNE_OPTS='--profile ${{ matrix.profile }}'
opam exec -- cp _build/install/default/bin/elpi elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
opam exec -- cp _build/install/default/bin/elpi-trace-elaborator elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
- name: Strip binary
run: |
opam exec -- chmod u+w ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
opam exec -- chmod u+w ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
opam exec -- strip ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
opam exec -- strip ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
# Artifacts 1 ################################################################
- name: Save binary
uses: actions/upload-artifact@v2
with:
name: elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}
path: elpi*-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe
# Test ######################################################################
#
# We run the test suite which also produces data.csf containing benchmarks
- name: Test elpi on Unix
if: runner.os != 'Windows'
run: opam exec -- make tests RUNNERS='dune ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe'
- name: Test elpi on Windows
if: runner.os == 'Windows'
run: |
opam exec -- ls -l tests/sources/*.elpi
opam exec -- make tests PWD=${{ env.workspace }} RUNNERS='dune ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}.exe' TIME=--time=${{ env.cygwin_root }}/bin/time.exe
# Artifacts 2 ################################################################
- name: Save logs
uses: actions/upload-artifact@v2
if: always()
with:
name: .logs-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}
path: _log
retention-days: 1
- name: Save benchmarking data
uses: actions/upload-artifact@v2
if: always()
with:
name: .benchmark-${{ matrix.ocaml-compiler }}-${{ matrix.parser }}-${{ runner.os }}
path: data.csv
retention-days: 1
aggregate:
name: Aggregate and plot benchmarking data
runs-on: ubuntu-latest
needs: build
if: always()
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Install extra stuff
run: |
sudo apt-get update
sudo apt-get install lua5.1 gnuplot
- name: Download all artifacts
uses: actions/download-artifact@v2
- name: Plotting aggregated data
run: |
cat .benchmark-*/data.csv > data.csv
tests/plot data.csv
gnuplot data.csv.plot
- name: Save benchmarking plot
uses: actions/upload-artifact@v2
with:
name: benchmark-plot
path: data.csv.svg