-
Notifications
You must be signed in to change notification settings - Fork 22
171 lines (158 loc) · 5.86 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
name: nerves-build
on:
pull_request:
paths-ignore:
- '*.md'
- '**/*.md'
- 'LICENSE*'
- 'examples/**'
- 'test/**'
- 'Makefile.win'
- 'cc_toolchain/**'
- 'checksum.exs'
- '.github/FUNDING.yml'
- '.github/workflows/linux-*'
- '.github/workflows/macos-*'
- '.github/workflows/windows-*'
- '.github/workflows/test-*.yml'
push:
tags:
- 'v*'
branches:
- main
- nerves-*
paths-ignore:
- '*.md'
- '**/*.md'
- 'LICENSE*'
- 'examples/**'
- 'Makefile.win'
- 'cc_toolchain/**'
- 'checksum.exs'
- '.github/FUNDING.yml'
- '.github/workflows/linux-*'
- '.github/workflows/macos-*'
- '.github/workflows/windows-*'
- '.github/workflows/test-*.yml'
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.8.0"
NERVES_LIVEBOOK_VER: "v0.10.1"
ELIXIR_VERSION: "1.15.4"
EVISION_PREFER_PRECOMPILED: "false"
strategy:
matrix:
include:
- 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: mangopi_mq_pro
otp_version: "26"
- pair:
target: grisp2
otp_version: "26"
steps:
- uses: actions/checkout@v3
- 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
mix local.hex --force
mix local.rebar --force
- name: Cache mix packages
id: cache-mix-deps
uses: actions/cache@v3
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@v3
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.9.1/fwup_1.9.1_amd64.deb -O ./fwup_1.9.1_amd64.deb
sudo dpkg -i ./fwup_1.9.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/nx, "~> 0.3.0/nx, "~> 0.4/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
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/[email protected]
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@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: /tmp/firmware/${{ env.NERVES_PROJ_NAME }}_${{ matrix.pair.target }}_${{ env.MIX_ENV }}.fw