-
Notifications
You must be signed in to change notification settings - Fork 22
189 lines (175 loc) · 6.4 KB
/
nerves-build.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
name: nerves-build
on:
pull_request:
paths-ignore:
- 'assets/**'
- '*.md'
- '**/*.md'
- 'LICENSE*'
- 'examples/**'
- 'gleam_src/**'
- 'test/**'
- 'Makefile.win'
- 'cc_toolchain/**'
- 'c_src/windows_fix/windows_fix.cpp'
- 'checksum.exs'
- 'do_release.sh'
- '.github/FUNDING.yml'
- '.github/workflows/linux-*'
- '.github/workflows/macos-*'
- '.github/workflows/windows-*'
- '.github/workflows/test-*.yml'
- '.github/*manylinux*.sh'
push:
tags:
- 'v*'
branches:
- main
- nerves-*
paths-ignore:
- 'assets/**'
- '*.md'
- '**/*.md'
- 'LICENSE*'
- 'examples/**'
- 'Makefile.win'
- 'cc_toolchain/**'
- 'c_src/windows_fix/windows_fix.cpp'
- 'checksum.exs'
- '.github/FUNDING.yml'
- '.github/workflows/linux-*'
- '.github/workflows/macos-*'
- '.github/workflows/windows-*'
- '.github/workflows/test-*.yml'
- '.github/*manylinux*.sh'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
mix_compile:
runs-on: ubuntu-20.04
env:
MIX_ENV: prod
NERVES_PROJ_NAME: nerves_evision
OPENCV_VER: "4.10.0"
NERVES_LIVEBOOK_VER: "v0.12.1"
ELIXIR_VERSION: "1.16.1"
EVISION_PREFER_PRECOMPILED: "false"
strategy:
matrix:
include:
- pair:
target: rpi5
otp_version: "26"
- pair:
target: rpi4
otp_version: "26"
- pair:
target: rpi3a
otp_version: "26"
- pair:
target: rpi3
otp_version: "26"
- pair:
target: rpi2
otp_version: "26"
- pair:
target: rpi0
otp_version: "26"
- pair:
target: rpi
otp_version: "26"
- pair:
target: bbb
otp_version: "26"
- pair:
target: osd32mp1
otp_version: "26"
- pair:
target: npi_imx6ull
otp_version: "26"
- pair:
target: grisp2
otp_version: "26"
- pair:
target: mangopi_mq_pro
otp_version: "26"
- pair:
target: srhub
otp_version: "26"
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 nerves and system dependencies
run: |
mkdir -p ~/.ssh
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCulZpVE/JdpWX53C35n45RSIMtaIIiTMnmRo5oDEMbyh0NnKI5byikkOvGnGLOO2KTlq4We+MF5iKx72B1Ixl8RY7L6Kc/h3R6jG4uOWBhw/WBhIebteJVYDzrlU8fHTewquWYT6tJ7v7g54Qe5vofsDeKBDqTJqJPlwNSxP8AjPZ0vQ4O4IhG0CXaDzU/G50sqzquKckgGWURLN9LcsA+kzciKJRhKw4Q7kpOiTNG/fzYxBpgpNrnyyr7bhj0jdOsg9KoG57aLSqbmEVCOyWa6yh6lOTp37S6ijBfQORxUu3I+6B04zUBSEvN4wgqslHU9pbIio8Szz1vbnlqsgO0tG1yqALfs6RVSjW81AujKefeH/8seE7q0yiHJXkE4tejIcewJT+2e6p/fP2pVSwyRqZ1bObtRUCMG3Pwdi0IpfsyBSa02Qc7eT9VB1WN7XD1vpfMDQ/nIWmoA40VkX3F3v5Mht5PZwVmlRyM8BrLtCYTreUP5xl6ZZCSX2IfOI8= nerves-ci-build' > ~/.ssh/id_rsa.pub
sudo apt-get update && sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip curl git libssl-dev libncurses5-dev python3 ca-certificates squashfs-tools ssh-askpass libmnl-dev libeigen3-dev
mix local.hex --force
mix local.rebar --force
- 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
id: cache-opencv
uses: actions/cache@v4
with:
key: opencv-${{ env.OPENCV_VER }}
path: |
./3rd_party
- name: Download OpenCV
if: steps.cache-opencv.outputs.cache-hit != 'true'
run: |
bash scripts/download_opencv.sh ${OPENCV_VER} 3rd_party/cache 3rd_party/opencv/
- name: Make a nerves project
run: |
mix archive.install hex nerves_bootstrap --force || true
wget -k https://github.com/fwup-home/fwup/releases/download/v1.10.1/fwup_1.10.1_amd64.deb -O ./fwup_1.10.1_amd64.deb
sudo dpkg -i ./fwup_1.10.1_amd64.deb
cd ../
git clone https://github.com/livebook-dev/nerves_livebook.git
cd nerves_livebook
git checkout "${NERVES_LIVEBOOK_VER}"
git checkout mix.exs
LINE="$(grep -n 'toolshed' mix.exs | awk -F: '{print $1+1}')"
head -n "${LINE}" mix.exs > mix.exs.tmp
echo ' {:evision, path: "../evision"},' >> mix.exs.tmp
tail -n "+${LINE}" mix.exs >> mix.exs.tmp
mv mix.exs.tmp mix.exs
sed -i 's/kino, "~> 0.7/kino, "~> 0.11/g' mix.exs
cat mix.exs
export MIX_TARGET=${{ matrix.pair.target }}
mix deps.get
mix deps.update nx
mix deps.update kino
cp -a ../evision/examples ./priv/evision_examples
sed -i 's/"welcome.livemd"\,/"welcome.livemd"\, "evision_examples",/g' lib/nerves_livebook/application.ex
export MAKE_BUILD_FLAGS="-j$(nproc)"
mix deps.compile
export PRIV_DIR="_build/${MIX_TARGET}_${MIX_ENV}/lib/evision/priv"
rm -rf "${PRIV_DIR}/include"
mix firmware
mkdir -p "/tmp/firmware"
cp "./_build/${MIX_TARGET}_${MIX_ENV}/nerves/images/nerves_livebook.fw" "/tmp/firmware/${NERVES_PROJ_NAME}_${{ matrix.pair.target }}_${MIX_ENV}.fw"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw
path: /tmp/firmware/${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: /tmp/firmware/${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw