-
Notifications
You must be signed in to change notification settings - Fork 364
213 lines (203 loc) · 6.51 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
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
name: Builds, tests & co
on: [ push, pull_request ]
env:
OPAMBSVERSION: 2.0.7
OPAMBSROOT: ~/.cache/.opam.cached
OPAM12CACHE: ~/.cache/opam1.2/cache
OPAM_TEST_REPO_SHA: 14bdd2a9acb9bd5bb46b4b44d6d7f59b4321f5d9
OPAM_REPO_SHA: 754c005bee4b198787ffc01f82e6c1f9c6356c2c
# Default ocaml version for some jobs
OCAML_VERSION: 4.12.0
## variables for cache paths
GH_OCAML_CACHE: ~/.cache/ocaml-local/**
defaults:
run:
shell: bash
jobs:
####
# Caches
####
archives-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: src ext archives cache
id: archives
uses: actions/cache@v2
with:
path: src_ext/archives
key: archives-2.0-${{ hashFiles('src_ext/Makefile.sources', 'src_ext/Makefile') }}
- name: Retrieve archives
if: steps.archives.outputs.cache-hit != 'true'
run: |#bash -exu .github/scripts/caches.sh archives
rm -rf src_ext/archives
export PATH=~/.cache/ocaml-local/bin:$PATH
which ocaml && export OCAML=`which ocaml` || true
make -C src_ext cache-archives
ls src_ext/archives -al
####
# Build
####
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
ocamlv: [ 4.02.3, 4.03.0, 4.04.2, 4.05.0, 4.06.1, 4.07.1, 4.08.1, 4.09.1, 4.10.2, 4.11.2, 4.12.0 ]
include:
- os: macos-latest
ocamlv: 4.12.0
# Intentionnaly fail fast, no need to run all build if there is a
# problem in a given version; usually it is functions not defined in lower
# versions of caml
# fail-fast: false
steps:
- name: install deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- uses: actions/checkout@v2
- name: ocaml ${{ matrix.ocamlv }} cache
id: ocaml-cache
uses: actions/cache@v2
with:
path: ${{ env.GH_OCAML_CACHE }}
key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }}
- name: Building ocaml ${{ matrix.ocamlv }} cache
if: steps.ocaml-cache.outputs.cache-hit != 'true'
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
run: bash -exu .github/scripts/ocaml-cache.sh ocaml
- name: Build
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
run: bash -exu .github/scripts/main.sh
####
# Opam tests
####
test:
needs: [ build ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
ocamlv: [ 4.12.0 ]
fail-fast: false
env:
OPAM_TEST: 1
steps:
- uses: actions/checkout@v2
- name: install deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- name: ocaml ${{ matrix.ocamlv }} cache - test
id: ocaml-cache-test
uses: actions/cache@v2
with:
path: ${{ env.GH_OCAML_CACHE }}
key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }}-test
- name: Building ocaml ${{ env.OCAML_VERSION }} cache - test
if: steps.ocaml-cache-test.outputs.cache-hit != 'true'
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
run: bash -exu .github/scripts/ocaml-cache.sh ocaml
- name: opam bootstrap cache
id: opam-bootstrap
uses: actions/cache@v2
with:
path: |
${{ env.OPAMBSROOT }}/**
~/.cache/opam-local/bin/**
key: opam-2.0-${{ runner.os }}-${{ env.OPAMBSVERSION }}-${{ matrix.ocamlv }}-${{ env.OPAM_REPO_SHA }}-${{ hashFiles ('.github/scripts/opam-bs-cache.sh', '.github/scripts/preamble.sh') }}
- name: opam root cache
if: steps.opam-bootstrap.outputs.cache-hit != 'true'
run: bash -exu .github/scripts/opam-bs-cache.sh
- name: opam-rt cache
id: opam-rt
uses: actions/cache@v2
with:
path: ~/.cache/opam-rt/**
key: ${{ runner.os }}-opam-rt-2.0-${{ matrix.ocamlv }}
- name: Test
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
run: bash -exu .github/scripts/main.sh
cold:
needs: [ build, archives-cache ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ ubuntu-latest, macos-latest ]
os: [ ubuntu-latest ]
ocamlv: [ 4.12.0 ]
fail-fast: false
steps:
- name: install deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- uses: actions/checkout@v2
- name: src ext archives cache
uses: actions/cache@v2
with:
path: src_ext/archives
key: archives-2.0-${{ hashFiles('src_ext/Makefile.sources', 'src_ext/Makefile') }}
- name: Cold
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
OPAM_COLD: 1
run: |
make compiler
make lib-pkg
bash -exu .github/scripts/main.sh
upgrade:
needs: [ build ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
ocamlv: [ 4.12.0 ]
fail-fast: false
steps:
- name: install deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- uses: actions/checkout@v2
- name: opam 1.2 root cache
uses: actions/cache@v2
with:
path: ${{ env.OPAM12CACHE }}
key: ${{ runner.os }}-opam1.2-root
- name: ocaml ${{ matrix.ocamlv }} cache
id: ocaml-cache
uses: actions/cache@v2
with:
path: ${{ env.GH_OCAML_CACHE }}
key: ${{ runner.os }}-ocaml-${{ matrix.ocamlv }}-${{ hashFiles ('.github/scripts/ocaml-cache.sh', '.github/scripts/preamble.sh') }}
- name: Building ocaml ${{ matrix.ocamlv }} cache
if: steps.ocaml-cache.outputs.cache-hit != 'true'
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
run: bash -exu .github/scripts/ocaml-cache.sh ocaml
- name: Upgrade
env:
OCAML_VERSION: ${{ matrix.ocamlv }}
OPAM_UPGRADE: 1
run: bash -exu .github/scripts/main.sh
####
# Around opam tests
###
hygiene:
needs: [ archives-cache ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: src ext archives cache
uses: actions/cache@v2
with:
path: src_ext/archives
key: archives-2.0-${{ hashFiles('src_ext/Makefile.sources', 'src_ext/Makefile') }}
- name: Hygiene
env:
# Defined only on pull request jobs
BASE_REF_SHA: ${{ github.event.pull_request.base.sha }}
PR_REF_SHA: ${{ github.event.pull_request.head.sha }}
run: bash -exu .github/scripts/hygiene.sh