forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
208 lines (195 loc) · 7.55 KB
/
dune.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
196
197
198
199
200
201
202
203
204
205
206
207
208
# Dune tests
# ==========
# Build the compiler using dune
name: dune
# Configure when to run the workflows. Currently only when
# it affects the `flambda2.0-stable` branch (either pushes to the branch,
# or pull request against it).
on:
push:
branches:
- flambda2.0-stable
pull_request:
branches:
- flambda2.0-stable
jobs:
# Dune-base: compile only
# =======================
build:
runs-on: ${{ matrix.os }}
# Build Matrix
# ------------
strategy:
matrix:
# Operating system to run tests on. TODO: add macos-latest and windows-latest
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
# Build ENV
# ---------
env:
# Paralellism for builds
J: "3"
# disable flambda invariants else everything takes forever to compile
OCAMLPARAM: "_,flambda-invariants=0"
# Build/test steps
# ----------------
steps:
# ### STEP 0 ###
# Setup the env
- name: Setup PATH
run: echo "$GITHUB_WORKSPACE/install/bin" >> $GITHUB_PATH
# Checkout the branch to test
- name: Checkout the repo
uses: actions/checkout@master
with:
path: 'test'
# Install dependencies
- name: Install dependencies
run: sudo apt-get install parallel
# Cache the install directory
- name: Cache install directory
uses: actions/cache@v1
id: cache
with:
path: ${{ github.workspace }}/install
key: ${{ matrix.os }}-cache-install-ocaml4120-flambda-dune213
# ### STEP 1 ###
# Get a working 4.12 statmemprof ocaml install, with dune
#
# For that, checkout the relevant repo, build and install ocaml in
# a dedicated directory, and build and install dune in that directory
#
# Additionally, a cache of the install directory is used, so that the
# checkout and build of 4.12 is skipped if the cache is hit.
# If cache is hit, then restore backup ocamlopt.opt
- name: Restore ocamlopt backup
if: steps.cache.outputs.cache-hit == 'true'
run: |
cp install/bin/ocamlopt.opt.backup install/bin/ocamlopt.opt
# If cache is not hit: checkout a 4.12 branch
- name: Checkout ocaml.4.12
uses: actions/checkout@master
if: steps.cache.outputs.cache-hit != 'true'
with:
repository: 'ocaml/ocaml'
path: 'base'
ref: '4.12'
# Apply ocamltest patch to 4.12 repo
- name: Apply ocamltest patch
if: steps.cache.outputs.cache-hit != 'true'
working-directory: base
run: git apply ../test/.github/workflows/ocamltest_dune.patch
# Build&install the base compiler (with flambda1 to avoid some warnings)
- name: Build&install the base compiler
if: steps.cache.outputs.cache-hit != 'true'
working-directory: base
run: |
./configure --enable-flambda --prefix=$GITHUB_WORKSPACE/install --without-ocamldoc
make -j $J
make install
# Build&install ocamltest
- name: Build&install ocamltest
if: steps.cache.outputs.cache-hit != 'true'
working-directory: base
run: |
make ocamltest
cp ocamltest/ocamltest $GITHUB_WORKSPACE/install/bin/
# Checkout dune repo
- name: Checkout dune github repo
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@master
with:
repository: 'ocaml/dune'
ref: '2.8.0'
path: 'dune'
# Build and install dune
- name: Build and install dune
if: steps.cache.outputs.cache-hit != 'true'
working-directory: dune
run: |
ocaml bootstrap.ml
cp dune.exe $GITHUB_WORKSPACE/install/bin/dune
# ### STEP 2 ###
# Build the flambda2-enabled compiler using the 4.12
# compiler and dune.
# Configure the flambda2 compiler
- name: Configure the flambda compiler (stage 1)
working-directory: test
run: ./configure --enable-flambda --without-ocamldoc
# Build ocamlc, ocamlopt.opt using dune
- name: Build the flambda compiler (stage 1)
working-directory: test
run: dune build --profile release --display quiet @world
# Output full dune log in case of build failure
- name: Dump dune log if build failed
working-directory: test
if: failure()
run: cat _build/log
# Override vanilla ocamlopt with the flmabda ocamlopt
- name: Override the vanilla ocamlopt
run: |
cp install/bin/ocamlopt.opt install/bin/ocamlopt.opt.backup
cp test/_build/default/ocamlopt.opt install/bin/ocamlopt.opt
# Cleanup the test repo just to be sure
- name: Cleanup test repo
working-directory: test
run: git clean -dfx
# ### STEP 3 ###
# Build the flambda2 compiler again, this time using the flambda2 compiler.
# Build ocamlc, ocamlopt.opt using dune
#
# Apply some patch
- name: Patch the repo (stage 2)
working-directory: test
run: git apply .github/workflows/testsuite_makefile.patch
# Configure the flambda compiler
- name: Configure the flambda compiler (stage 2)
working-directory: test
run: ./configure --enable-flambda --without-ocamldoc
# Build the flambda compiler and stdlib
- name: Build the flambda compiler (stage 2)
working-directory: test
run: dune build --profile=release --display quiet @world
# Output full dune log in case of build failure
- name: Dump dune log if build failed
working-directory: test
if: failure()
run: cat _build/log
# Running the testsuite is disabled because it currently does not work:
# - ocamlc.byte as built by dune fails to run because of some runtime errors
# - ocamlopt.opt always segfaults because of the Map.remove bug
#
## Build the testing lib
#- name: Build the testing lib (stage 2)
# working-directory: test
# run: dune build --profile=release --display quiet @testing || (cat _build/log; exit 1)
## Build the expect test tool
#- name: Build the expect test tool (stage 2)
# working-directory: test
# run: dune build --profile=release --display quiet testsuite/tools/expect_test.exe || (cat _build/log; exit 1)
## Generate list of tests to run
#- name: Generate test list
# working-directory: test
# run: grep -v '#' .github/workflows/test-list > .github/workflows/dune.list
## Setup test env (copy artefacts built by dune).
#- name: Set up testing stage
# working-directory: test
# run: |
# cp $GITHUB_WORKSPACE/install/bin/ocamltest ./ocamltest/
# cp _build/default/ocamlc ./
# cp _build/default/ocamlopt.opt ./
# cp -r _build/default/runtime/* ./runtime/
# cp _build/default/stdlib/stdlib.* ./stdlib/
# cp _build/default/stdlib/.stdlib.objs/byte/* ./stdlib/
# cp _build/default/stdlib/.stdlib.objs/native/* ./stdlib/
# cp _build/default/testsuite/lib/testing.* ./testsuite/lib/
# cp _build/default/testsuite/lib/.testing.objs/byte/* ./testsuite/lib/
# cp _build/default/testsuite/lib/.testing.objs/native/* ./testsuite/lib/
# cp _build/default/testsuite/tools/expect_test.exe ./testsuite/tools/expect_test
## Set the OCAMLSRCDIR env variable
#- name: Setup testing env
# run: echo "::set-env name=OCAMLSRCDIR::$GITHUB_WORKSPACE/test"
## Run the tests
#- name: Running the testsuite
# working-directory: test
# run: cd testsuite && make list-parallel FILE=../.github/workflows/dune.list