-
Notifications
You must be signed in to change notification settings - Fork 38
243 lines (241 loc) · 9.17 KB
/
native.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
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
name: native
'on':
push:
branches:
- main
- ci-sandbox
pull_request:
branches:
- '**'
env:
ccache_basedir: ${{ github.workspace }}
ccache_dir: "${{ github.workspace }}/.ccache"
ccache_compilercheck: content
ccache_compress: 'true'
ccache_compresslevel: 9
ccache_maxsize: 200M
ccache_cmake: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
jobs:
ubuntu:
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu 22.04 full
os: ubuntu-22.04
identifier: ubuntu_2204_full
cmake: -DCOMPILE_TESTS=on
brt_tags: ""
unittests: 'true'
- name: Ubuntu 22.04 minimal
os: ubuntu-22.04
identifier: ubuntu_2204_minimal
cmake: -DCOMPILE_TESTS=on -DUSE_WASM_COMPATIBLE_SOURCE=on
brt_tags: "'#wasm'"
unittests: 'false'
- name: Ubuntu 20.04 full
os: ubuntu-20.04
identifier: ubuntu_2004_full
cmake: -DCOMPILE_TESTS=on
brt_tags: ""
unittests: 'true'
- name: Ubuntu 20.04 minimal
os: ubuntu-20.04
identifier: ubuntu_2004_minimal
cmake: -DCOMPILE_TESTS=on -DUSE_WASM_COMPATIBLE_SOURCE=on
brt_tags: "'#wasm'"
unittests: 'false'
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Dependencies
run: |-
sudo apt-get update
sudo apt-get install -y libprotobuf-dev protobuf-compiler libboost-all-dev ccache libunwind-dev libgoogle-perftools-dev
- name: Install MKL
run: |-
wget -qO- "https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB" | sudo apt-key add -
sudo sh -c "echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list"
sudo apt-get update -o Dir::Etc::sourcelist="/etc/apt/sources.list.d/intel-mkl.list"
sudo apt-get install -y --no-install-recommends intel-mkl-64bit-2020.0-088
- name: Generate ccache_vars for ccache based on machine
shell: bash
id: ccache_vars
run: |-
echo "::set-output name=hash::$(echo ${{ env.ccache_compilercheck }})"
echo "::set-output name=timestamp::$(date '+%Y-%m-%dT%H.%M.%S')"
- name: Cache-op for build-cache through ccache
uses: actions/cache@v2
with:
path: ${{ env.ccache_dir }}
key: ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }}
restore-keys: |-
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}
ccache-${{ matrix.identifier }}
- name: ccache environment setup
run: |-
echo "CCACHE_COMPILER_CHECK=${{ env.ccache_compilercheck }}" >> $GITHUB_ENV
echo "CCACHE_BASEDIR=${{ env.ccache_basedir }}" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=${{ env.ccache_compress }}" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=${{ env.ccache_compresslevel }}" >> $GITHUB_ENV
echo "CCACHE_DIR=${{ env.ccache_dir }}" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=${{ env.ccache_maxsize }}" >> $GITHUB_ENV
- name: ccache prolog
run: |-
ccache -s # Print current cache stats
ccache -z # Zero cache entry
- name: cmake
run: |-
mkdir -p build
cd build
cmake -L .. ${{ matrix.cmake }} ${{ env.ccache_cmake }}
- name: Build from source
working-directory: build
run: make -j2
- name: ccache epilog
run: 'ccache -s # Print current cache stats'
- name: Print Versions
working-directory: build
run: ./app/bergamot --version
- name: Run unit tests
working-directory: build
run: make test
if: ${{ matrix.unittests == 'true' }}
- name: Install regression-test framework (BRT)
working-directory: bergamot-translator-tests
run: make install
- name: Run regression-tests (BRT)
working-directory: bergamot-translator-tests
id: brt_run
run: MARIAN=../build ./run_brt.sh ${{ matrix.brt_tags }}
- name: Print logs of unsuccessful BRTs
working-directory: bergamot-translator-tests
run: |-
grep "tests.*.sh" previous.log \
| sed 's/^\s*-\s*//' \
| xargs -I% bash -c 'echo %; tail -n20 %.log'
if: ${{ always() && steps.brt_run.outcome == 'failure' }}
- name: Upload regression-tests artifacts
uses: actions/upload-artifact@v2
if: ${{ always() && steps.brt_run.outcome != 'skipped' }}
with:
name: brt-${{ matrix.identifier }}
path: |-
bergamot-translator-tests/**/*.expected
bergamot-translator-tests/**/*.log
bergamot-translator-tests/**/*.out
- name: Confirm native-run example script works
run: |-
bash examples/run-native.sh
mac:
strategy:
fail-fast: false
matrix:
include:
- name: MacOS 12 full
os: macos-12
identifier: mac_12_full
cmake: -DCOMPILE_TESTS=on -DUSE_APPLE_ACCELERATE=off -DUSE_FBGEMM=off -DUSE_STATIC_LIBS=off
brt_tags: ""
unittests: 'true'
- name: MacOS 12 minimal
os: macos-12
identifier: mac_12_minimal
cmake: -DCOMPILE_TESTS=on -DUSE_APPLE_ACCELERATE=off -DUSE_FBGEMM=off -DUSE_STATIC_LIBS=on -DUSE_WASM_COMPATIBLE_SOURCE=on
brt_tags: "'#wasm'"
unittests: 'false'
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Dependencies
run: |-
brew update
brew install openblas protobuf ccache
brew install coreutils findutils
- name: Setup path with gnu
run: |-
echo "/usr/local/opt/coreutils/libexec/gnubin" >> $GITHUB_PATH
echo "/usr/local/opt/findutils/libexec/gnubin" >> $GITHUB_PATH
- name: Setup BLAS
run: |-
echo "LDFLAGS=-L/usr/local/opt/openblas/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/usr/local/opt/openblas/include" >> $GITHUB_ENV
- name: Generate ccache_vars for ccache based on machine
shell: bash
id: ccache_vars
run: |-
echo "::set-output name=hash::$(echo ${{ env.ccache_compilercheck }})"
echo "::set-output name=timestamp::$(date '+%Y-%m-%dT%H.%M.%S')"
- name: Cache-op for build-cache through ccache
uses: actions/cache@v2
with:
path: ${{ env.ccache_dir }}
key: ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }}
restore-keys: |-
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}
ccache-${{ matrix.identifier }}
- name: ccache environment setup
run: |-
echo "CCACHE_COMPILER_CHECK=${{ env.ccache_compilercheck }}" >> $GITHUB_ENV
echo "CCACHE_BASEDIR=${{ env.ccache_basedir }}" >> $GITHUB_ENV
echo "CCACHE_COMPRESS=${{ env.ccache_compress }}" >> $GITHUB_ENV
echo "CCACHE_COMPRESSLEVEL=${{ env.ccache_compresslevel }}" >> $GITHUB_ENV
echo "CCACHE_DIR=${{ env.ccache_dir }}" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=${{ env.ccache_maxsize }}" >> $GITHUB_ENV
- name: ccache prolog
run: |-
ccache -s # Print current cache stats
ccache -z # Zero cache entry
- name: cmake
run: |-
mkdir -p build
cd build
cmake -L .. ${{ matrix.cmake }} ${{ env.ccache_cmake }}
- name: Build from source
working-directory: build
run: make -j2
- name: ccache epilog
run: 'ccache -s # Print current cache stats'
- name: Print Versions
working-directory: build
run: ./app/bergamot --version
- name: Run unit tests
working-directory: build
run: make test
if: ${{ matrix.unittests == 'true' }}
- name: Install regression-test framework (BRT)
working-directory: bergamot-translator-tests
run: make install
- name: Run regression-tests (BRT)
working-directory: bergamot-translator-tests
id: brt_run
run: MARIAN=../build ./run_brt.sh ${{ matrix.brt_tags }}
- name: Print logs of unsuccessful BRTs
working-directory: bergamot-translator-tests
run: |-
grep "tests.*.sh" previous.log \
| sed 's/^\s*-\s*//' \
| xargs -I% bash -c 'echo %; tail -n20 %.log'
if: ${{ always() && steps.brt_run.outcome == 'failure' }}
- name: Upload regression-tests artifacts
uses: actions/upload-artifact@v2
if: ${{ always() && steps.brt_run.outcome != 'skipped' }}
with:
name: brt-${{ matrix.identifier }}
path: |-
bergamot-translator-tests/**/*.expected
bergamot-translator-tests/**/*.log
bergamot-translator-tests/**/*.out
- name: Confirm native-run example script works
run: |-
bash examples/run-native.sh