-
Notifications
You must be signed in to change notification settings - Fork 109
158 lines (136 loc) · 4.34 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
#
# 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/libAtomVM/**'
- 'tools/packbeam/**'
tags:
- '*'
pull_request:
paths:
- '.github/workflows/esp32-mkimage.yaml'
- 'src/platforms/esp32/**'
- 'src/libAtomVM/**'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
esp32-release:
runs-on: ubuntu-latest
container: espressif/idf:v${{ matrix.idf-version }}
strategy:
matrix:
idf-version: ["4.4.6"]
cc: ["clang-10"]
cxx: ["clang++-10"]
cflags: ["-O3"]
otp: ["24"]
elixir_version: ["1.11"]
compiler_pkgs: ["clang-10"]
soc: ["esp32", "esp32c3", "esp32s2", "esp32s3"]
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
ImageOS: "ubuntu20"
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
- 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 }} with idf.py"
shell: bash
working-directory: ./src/platforms/esp32/
run: |
rm -rf build
. $IDF_PATH/export.sh
idf.py set-target ${{ matrix.soc }}
idf.py reconfigure
idf.py build
- name: "Create a ${{ matrix.soc }} image"
working-directory: ./src/platforms/esp32/build
run: |
./mkimage.sh
ls -l *.img
- name: "Upload ${{ matrix.soc }} artifacts"
uses: actions/upload-artifact@v3
with:
name: atomvm-${{ matrix.soc }}-image
path: ./src/platforms/esp32/build/atomvm-${{ matrix.soc }}.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 }}-${{ github.ref_name }}.img"
mv atomvm-${{ matrix.soc }}.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 }}-${{ github.ref_name }}.img
src/platforms/esp32/build/AtomVM-${{ matrix.soc }}-${{ github.ref_name }}.img.sha256