-
Notifications
You must be signed in to change notification settings - Fork 106
175 lines (153 loc) · 5.21 KB
/
esp32-mkimage.yaml
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
#
# Copyright 2022 Fred Dushin <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: esp32-mkimage
on:
push:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'CMakeLists.txt'
- 'libs/**'
- 'src/platforms/esp32/**'
- 'src/platforms/esp32/**/**'
- 'src/libAtomVM/**'
- 'tools/packbeam/**'
pull_request:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'src/platforms/esp32/**'
- 'src/platforms/esp32/**/**'
- 'src/libAtomVM/**'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
esp32-release:
runs-on: ubuntu-22.04
container: espressif/idf:v${{ matrix.idf-version }}
strategy:
matrix:
idf-version: ["5.3.1"]
cc: ["clang-14"]
cxx: ["clang++-14"]
cflags: ["-O3"]
otp: ["27"]
elixir_version: ["1.17"]
compiler_pkgs: ["clang-14"]
soc: ["esp32", "esp32c2", "esp32c3", "esp32s2", "esp32s3", "esp32c6", "esp32h2"]
flavor: ["", "-elixir"]
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
ImageOS: "ubuntu22"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: "APT update"
run: apt update -y
- name: "Install deps"
run: DEBIAN_FRONTEND=noninteractive apt install -y ${{ matrix.compiler_pkgs}} git cmake gperf zlib1g-dev
# needed for generating AtomVM version when running in a docker container
- name: "Configure Git"
run: |
git config --global --add safe.directory /__w/AtomVM/AtomVM
echo -n "git rev-parse: "
git rev-parse --short HEAD
# Builder info
- name: "System info"
run: |
echo "**uname:**"
uname -a
echo "**libc version:**"
ldd --version
echo "**C Compiler version:**"
$CC --version
$CXX --version
echo "**Linker version:**"
ld --version
echo "**CMake version:**"
cmake --version
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true
- name: "Build: create build dir"
run: mkdir build
- name: "Build: run cmake"
working-directory: build
run: |
cmake ..
# git clone will use more recent timestamps than cached beam files
# touch them so we can benefit from the cache and avoid costly beam file rebuild.
find . -name '*.beam' -exec touch {} \;
- name: "Build erlang and Elixir libs"
working-directory: build/libs
run: |
make
- name: "Use release defaults"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: ./src/platforms/esp32/
run: |
cp sdkconfig.release-defaults sdkconfig.defaults
- name: "Build ${{ matrix.soc }}${{ matrix.flavor }} with idf.py"
shell: bash
working-directory: ./src/platforms/esp32/
run: |
rm -rf build
. $IDF_PATH/export.sh
if [ ! -z "${{ matrix.flavor }}" ]
then
mv partitions${{ matrix.flavor }}.csv partitions.csv
fi
idf.py set-target ${{ matrix.soc }}
idf.py reconfigure
idf.py build
- name: "Create a ${{ matrix.soc }}${{ matrix.flavor }} image"
working-directory: ./src/platforms/esp32/build
run: |
if [ -z "${{ matrix.flavor }}" ]
then
./mkimage.sh
else
FLAVOR_SUFFIX=$(echo "${{ matrix.flavor }}" | sed 's/-//g')
BOOT_FILE="../../../../build/libs/esp32boot/${FLAVOR_SUFFIX}_esp32boot.avm"
./mkimage.sh --boot "$BOOT_FILE"
mv atomvm-${{ matrix.soc }}.img atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img
fi
ls -l *.img
- name: "Upload ${{ matrix.soc }} artifacts"
uses: actions/upload-artifact@v4
with:
name: atomvm-${{ matrix.soc }}${{ matrix.flavor }}-image
path: ./src/platforms/esp32/build/atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img
if-no-files-found: error
- name: "Rename and write sha256sum"
if: startsWith(github.ref, 'refs/tags/')
shell: bash
working-directory: src/platforms/esp32/build
run: |
ATOMVM_IMG="AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img"
mv atomvm-${{ matrix.soc }}${{ matrix.flavor }}.img "${ATOMVM_IMG}"
sha256sum "${ATOMVM_IMG}" > "${ATOMVM_IMG}.sha256"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
files: |
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}${{ matrix.flavor }}-${{ github.ref_name }}.img.sha256