-
Notifications
You must be signed in to change notification settings - Fork 37
173 lines (143 loc) · 5.85 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
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
profile:
- dev
include:
- os: ubuntu-latest
ocaml-compiler: 5.2.x
profile: fatalwarnings
- os: macos-latest
ocaml-compiler: 5.2.x
profile: dev
- os: windows-latest
ocaml-compiler: 5.2.x
profile: dev
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@v4
# 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: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-local-packages:
- 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 -- sed -i ' ' tests/sources/*.elpi
& "setup-x86_64.exe" -v -q -P time,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: 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 }}-${{ runner.os }}.exe
opam exec -- cp _build/install/default/bin/elpi-trace-elaborator elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe
- name: Strip binary
run: |
opam exec -- chmod u+w ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe
opam exec -- chmod u+w ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe
opam exec -- strip ${{ env.workspace }}/elpi-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe
opam exec -- strip ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe
# Artifacts 1 ################################################################
- name: Save binary
uses: actions/upload-artifact@v4
with:
name: elpi-${{ matrix.ocaml-compiler }}-${{ runner.os }}
path: elpi*-${{ matrix.ocaml-compiler }}-${{ 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 }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ 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 }}-${{ runner.os }}.exe ${{ env.workspace }}/elpi-trace-elaborator-${{ matrix.ocaml-compiler }}-${{ runner.os }}.exe' TIME=--time=D:/cygwin/bin/time.exe
# Artifacts 2 ################################################################
- name: Save logs
uses: actions/upload-artifact@v4
if: always()
with:
name: .logs-${{ matrix.ocaml-compiler }}-${{ runner.os }}
path: _log
retention-days: 1
- name: Save benchmarking data
uses: actions/upload-artifact@v4
if: always()
with:
name: .benchmark-${{ matrix.ocaml-compiler }}-${{ 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@v4
- name: Install extra stuff
run: |
sudo apt-get update
sudo apt-get install lua5.1 gnuplot
- name: Download all artifacts
uses: actions/download-artifact@v4
- 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@v4
with:
name: benchmark-plot
path: data.csv.svg