-
Notifications
You must be signed in to change notification settings - Fork 22
303 lines (264 loc) · 12.1 KB
/
linux-precompile-gnu.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
name: linux-precompile-gnu
on:
push:
tags:
- 'v*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
mix_compile:
runs-on: ubuntu-20.04
env:
OPENCV_VER: "4.10.0"
MIX_ENV: prod
ELIXIR_VERSION: "1.16.1"
EVISION_PREFER_PRECOMPILED: "false"
EVISION_GENERATE_LANG: "erlang,elixir"
strategy:
fail-fast: false
matrix:
include:
- pair:
arch: x86_64-linux-gnu
cmake_toolchain_file: ""
c_compiler: gcc
cpp_compiler: g++
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: i686-linux-gnu
cmake_toolchain_file: cc_toolchain/i686-linux-gnu.cmake
c_compiler: gcc-i686-linux-gnu
cpp_compiler: g++-i686-linux-gnu
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: aarch64-linux-gnu
cmake_toolchain_file: cc_toolchain/aarch64-linux-gnu.cmake
c_compiler: gcc-aarch64-linux-gnu
cpp_compiler: g++-aarch64-linux-gnu
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: armv7l-linux-gnueabihf
cmake_toolchain_file: cc_toolchain/armv7l-linux-gnueabihf.cmake
c_compiler: gcc-arm-linux-gnueabihf
cpp_compiler: g++-arm-linux-gnueabihf
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: armv6-linux-gnueabihf
cmake_toolchain_file: cc_toolchain/armv6-nerves-linux-gnueabihf.cmake
c_compiler: armv6-nerves-linux-gnueabihf-gcc
cpp_compiler: armv6-nerves-linux-gnueabihf-g++
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: ppc64le-linux-gnu
cmake_toolchain_file: cc_toolchain/ppc64le-linux-gnu.cmake
c_compiler: gcc-powerpc64le-linux-gnu
cpp_compiler: g++-powerpc64le-linux-gnu
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: s390x-linux-gnu
cmake_toolchain_file: cc_toolchain/s390x-linux-gnu.cmake
c_compiler: gcc-s390x-linux-gnu
cpp_compiler: g++-s390x-linux-gnu
OTP_VERSION: "25"
NIF_VERSION: "2.16"
- pair:
arch: riscv64-linux-gnu
cmake_toolchain_file: cc_toolchain/riscv64-linux-gnu.cmake
c_compiler: gcc-riscv64-linux-gnu
cpp_compiler: g++-riscv64-linux-gnu
OTP_VERSION: "25"
NIF_VERSION: "2.16"
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.pair.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get update -q
sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip curl git gzip python3 ca-certificates libncurses5-dev libssl-dev libeigen3-dev
if [ "${{ matrix.pair.arch }}" = "armv6-linux-gnueabihf" ]; then
curl -fSL https://github.com/nerves-project/toolchains/releases/download/v13.2.0/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-13.2.0-363664F.tar.xz -o nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-13.2.0-363664F.tar.xz
tar -xf nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-13.2.0-363664F.tar.xz
sudo mv nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-13.2.0 /usr/local/bin/nerves_toolchain_armv6_nerves_linux_gnueabihf-linux_x86_64-13.2.0
else
sudo apt-get install -y ${{ matrix.pair.c_compiler }} ${{ matrix.pair.cpp_compiler }}
fi
- name: Cache mix packages
id: cache-mix-deps
uses: actions/cache@v4
with:
key: deps-${{ hashFiles('mix.lock') }}-${{ matrix.pair.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}
path: |
./deps
- name: Get mix deps
if: steps.cache-mix-deps.outputs.cache-hit != 'true'
run: |
mix deps.get
- name: Cache OpenCV source code
id: cache-opencv
uses: actions/cache@v4
with:
key: opencv-with-contrib-${{ env.OPENCV_VER }}
path: |
./3rd_party
- name: Download OpenCV source code
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
bash scripts/download_opencv.sh ${OPENCV_VER} 3rd_party/cache 3rd_party/opencv/
bash scripts/download_opencv_contrib.sh ${OPENCV_VER} 3rd_party/cache 3rd_party/opencv/
- name: Compile OpenCV (without contrib modules)
run: |
export EVISION_ENABLE_CONTRIB=false
if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then
export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}"
fi
if [ "${{ matrix.pair.arch }}" = "armv6-linux-gnueabihf" ]; then
export TARGET_GCC_FLAGS="-mabi=aapcs-linux -mfpu=vfp -marm -fstack-protector-strong -mfloat-abi=hard -mcpu=arm1176jzf-s -fPIE -pie -Wl,-z,now -Wl,-z,relro"
fi
echo "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
rm -rf "./_build/${{ env.MIX_ENV }}/lib/evision"
mix compile_opencv
- name: Mix compile (without contrib modules)
run: |
export EVISION_ENABLE_CONTRIB=false
if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then
export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}"
fi
echo "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
rm -f _build/${MIX_ENV}/lib/evision/priv/evision.so
rm -rf lib/generated && rm -rf src/generated
mkdir -p lib/generated && mkdir -p src/generated
mix compile
- name: Create precompiled library (without contrib modules)
run: |
export PKG_NAME=evision-nif_${{ matrix.pair.NIF_VERSION }}-${{ matrix.pair.arch }}-${GITHUB_REF##*/v}
mkdir -p "${PKG_NAME}"
export PRIV_DIR="$(pwd)/_build/${MIX_ENV}/lib/evision/priv"
mv "${PRIV_DIR}/include" /tmp/include
cp -a "${PRIV_DIR}" "${PKG_NAME}"
cp -a lib/generated "${PKG_NAME}/elixir_generated"
cp -a src/generated "${PKG_NAME}/erlang_generated"
tar -czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
rm -rf "${PKG_NAME}"
ls -lah "${PKG_NAME}.tar.gz"
mkdir -p artifacts
mv "${PKG_NAME}.tar.gz" artifacts
cd artifacts
sha256sum "${PKG_NAME}.tar.gz" | tee "${PKG_NAME}.tar.gz.sha256"
mv /tmp/include "${PRIV_DIR}/include"
- name: Mix compile (without contrib modules) for Gleam (experimental)
run: |
export EVISION_ENABLE_CONTRIB=false
export GLEAM_EVISION=true
if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then
export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}"
fi
echo "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
rm -f _build/${MIX_ENV}/lib/evision/priv/evision.so
rm -rf lib/generated && rm -rf src/generated
mix compile
unset GLEAM_EVISION
- name: Create precompiled library (without contrib modules) for Gleam (experimental)
run: |
export PKG_NAME=gleam_evision-nif_${{ matrix.pair.NIF_VERSION }}-${{ matrix.pair.arch }}-${GITHUB_REF##*/v}
mkdir -p "${PKG_NAME}"
export PRIV_DIR="$(pwd)/_build/${MIX_ENV}/lib/evision/priv"
mv "${PRIV_DIR}/include" /tmp/include
cp -a "${PRIV_DIR}" "${PKG_NAME}"
cp -a gleam_src "${PKG_NAME}/gleam_generated"
cp -a src/evision_highgui.erl "${PKG_NAME}/gleam_generated/"
cp -a src/evision_internal_structurise.erl "${PKG_NAME}/gleam_generated/"
cp -a src/evision_windows_fix.erl "${PKG_NAME}/gleam_generated/"
tar -czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
rm -rf "${PKG_NAME}"
ls -lah "${PKG_NAME}.tar.gz"
mkdir -p artifacts
mv "${PKG_NAME}.tar.gz" artifacts
cd artifacts
sha256sum "${PKG_NAME}.tar.gz" | tee "${PKG_NAME}.tar.gz.sha256"
mv /tmp/include "${PRIV_DIR}/include"
- name: Compile OpenCV (with contrib modules)
run: |
export EVISION_ENABLE_CONTRIB=true
if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then
export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}"
fi
if [ "${{ matrix.pair.arch }}" = "armv6-linux-gnueabihf" ]; then
export TARGET_GCC_FLAGS="-mabi=aapcs-linux -mfpu=vfp -marm -fstack-protector-strong -mfloat-abi=hard -mcpu=arm1176jzf-s -fPIE -pie -Wl,-z,now -Wl,-z,relro"
fi
echo "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
rm -rf "./_build/${{ env.MIX_ENV }}/lib/evision"
mix compile_opencv
- name: Mix compile (with contrib modules)
run: |
export EVISION_ENABLE_CONTRIB=true
if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then
export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}"
fi
echo "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
rm -f _build/${MIX_ENV}/lib/evision/priv/evision.so
rm -rf lib/generated && rm -rf src/generated
mkdir -p lib/generated && mkdir -p src/generated
mix compile
- name: Create precompiled library (with contrib modules)
run: |
export PKG_NAME=evision-nif_${{ matrix.pair.NIF_VERSION }}-${{ matrix.pair.arch }}-contrib-${GITHUB_REF##*/v}
mkdir -p "${PKG_NAME}"
export PRIV_DIR="$(pwd)/_build/${MIX_ENV}/lib/evision/priv"
mv "${PRIV_DIR}/include" /tmp/include
cp -a "${PRIV_DIR}" "${PKG_NAME}"
cp -a lib/generated "${PKG_NAME}/elixir_generated"
cp -a src/generated "${PKG_NAME}/erlang_generated"
tar -czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
rm -rf "${PKG_NAME}"
ls -lah "${PKG_NAME}.tar.gz"
mkdir -p artifacts
mv "${PKG_NAME}.tar.gz" artifacts
cd artifacts
sha256sum "${PKG_NAME}.tar.gz" | tee "${PKG_NAME}.tar.gz.sha256"
mv /tmp/include "${PRIV_DIR}/include"
- name: Mix compile (with contrib modules) for Gleam (experimental)
run: |
export EVISION_ENABLE_CONTRIB=true
export GLEAM_EVISION=true
if [ "${{ matrix.pair.cmake_toolchain_file }}" != "" ]; then
export CMAKE_TOOLCHAIN_FILE="$(pwd)/${{ matrix.pair.cmake_toolchain_file }}"
fi
echo "CMAKE_TOOLCHAIN_FILE: ${CMAKE_TOOLCHAIN_FILE}"
rm -f _build/${MIX_ENV}/lib/evision/priv/evision.so
rm -rf lib/generated && rm -rf src/generated
mix compile
- name: Create precompiled library (with contrib modules)
run: |
export PKG_NAME=gleam_evision-nif_${{ matrix.pair.NIF_VERSION }}-${{ matrix.pair.arch }}-contrib-${GITHUB_REF##*/v}
mkdir -p "${PKG_NAME}"
export PRIV_DIR="$(pwd)/_build/${MIX_ENV}/lib/evision/priv"
mv "${PRIV_DIR}/include" /tmp/include
cp -a "${PRIV_DIR}" "${PKG_NAME}"
cp -a gleam_src "${PKG_NAME}/gleam_generated"
cp -a src/evision_highgui.erl "${PKG_NAME}/gleam_generated/"
cp -a src/evision_internal_structurise.erl "${PKG_NAME}/gleam_generated/"
cp -a src/evision_windows_fix.erl "${PKG_NAME}/gleam_generated/"
tar -czf "${PKG_NAME}.tar.gz" "${PKG_NAME}"
rm -rf "${PKG_NAME}"
ls -lah "${PKG_NAME}.tar.gz"
mkdir -p artifacts
mv "${PKG_NAME}.tar.gz" artifacts
cd artifacts
sha256sum "${PKG_NAME}.tar.gz" | tee "${PKG_NAME}.tar.gz.sha256"
mv /tmp/include "${PRIV_DIR}/include"
- uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*.tar.gz
artifacts/*.sha256