forked from openshwprojects/OpenBK7231T_App
-
Notifications
You must be signed in to change notification settings - Fork 0
230 lines (220 loc) · 8.95 KB
/
workflow.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
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
name: Build App
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_NAME: ${{ github.event.repository.name }}
jobs:
refs:
name: Prepare CI Environment
runs-on: ubuntu-20.04
outputs:
sha_short: ${{ steps.refs.outputs.sha_short }}
short_ref: ${{ steps.refs.outputs.short_ref }}
version: ${{ steps.refs.outputs.version }}
new_release: ${{ steps.refs.outputs.new_release }}
steps:
- name: Source checkout
uses: actions/checkout@v4
- name: Update SDKs if required
run: make update-submodules
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: true
semantic_version: 21
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits@7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: refs
run: |
export BRANCH=${GITHUB_REF#refs/*/}
echo "branch: ${BRANCH}"
export BRANCHTRANSLATED=$(echo ${BRANCH} | tr '/' '_')
echo "short_ref: ${BRANCHTRANSLATED}"
export VERSION=""
if ${{ steps.semantic.outputs.new_release_published == 'true' }}; then
export VERSION=${{ steps.semantic.outputs.new_release_version }}
else
export VERSION=${BRANCHTRANSLATED}_$(git rev-parse --short=12 HEAD)
fi
echo "new_release=${{ steps.semantic.outputs.new_release_published }}" >> $GITHUB_OUTPUT
echo "short_ref=${BRANCHTRANSLATED}" >> $GITHUB_OUTPUT
echo "sha_short=SHA-$(git rev-parse --short=12 HEAD)" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
build2:
name: Build Simulator
needs: refs
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Checkout simulator repository
run: |
git clone https://github.com/openshwprojects/obkSimulator
mkdir -p ./libs_for_simulator
cp -r ./obkSimulator/simulator/libs_for_simulator/* ./libs_for_simulator
- name: Build project
run: msbuild openBeken_win32_mvsc2017.vcxproj /p:Configuration=Release /p:PlatformToolset=v143
- name: Flatten build assets
run: |
mkdir -p flat
cp ./Release/openBeken_win32.exe flat/
cp ./obkSimulator/simulator/*.dll flat/
cp ./run_*.bat flat/
mkdir -p flat/examples
cp -r ./obkSimulator/examples/* flat/examples/
- name: Run unit tests
run: |
./flat/openBeken_win32.exe -runUnitTests 2
- name: Compress build assets
run: |
Compress-Archive -Path flat/* -DestinationPath obkSimulator_win32_${{ needs.refs.outputs.version }}.zip
- name: Copy build assets
run: |
mkdir -Force output/${{ needs.refs.outputs.version }}
cp obkSimulator_win32_${{ needs.refs.outputs.version }}.zip output/${{ needs.refs.outputs.version }}/obkSimulator_${{ needs.refs.outputs.version }}.zip
- name: Upload build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_sim
path: output/${{ needs.refs.outputs.version }}/obkSimulator_${{ needs.refs.outputs.version }}.zip
build:
name: Build
needs: refs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
platform: [OpenBK7231T, OpenBK7231N, OpenXR809, OpenBL602, OpenW800, OpenW600, OpenLN882H, OpenBK7238, OpenBK7231N_ALT]
steps:
- name: Source checkout
uses: actions/checkout@v4
# with:
# submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: '3.8'
architecture: 'x64'
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install libc6-i386 make cmake gcc-arm-none-eabi
pip3 install pycryptodomex
pip3 install configobj
pip3 install toml
pip3 install fdt
- run: ls -la
- name: Run make
run: make APP_VERSION=${{ needs.refs.outputs.version }} APP_NAME=${{ matrix.platform }} ${{ matrix.platform }}
- name: Save build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_${{ matrix.platform }}
path: |
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_UA_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_UG_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_QIO_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.rbl
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.fls
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_ota.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_gz.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_OTA.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_OTA.bin.xz
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_OTA.bin.xz.ota
if-no-files-found: warn
build_idf:
name: Build IDF
needs: refs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
platform: [OpenESP32, OpenESP32C3, OpenESP32C2, OpenESP32C6, OpenESP32S3, OpenESP32S2]
steps:
- name: Source checkout
uses: actions/checkout@v4
# with:
# submodules: recursive
- name: SDK checkout
uses: actions/checkout@v4
with:
repository: espressif/esp-idf
path: sdk/esp-idf
ref: v5.3.2
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: '3.8'
architecture: 'x64'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install make cmake python3-venv
pip3 install pycryptodomex
pip3 install configobj
pip3 install toml
pip3 install fdt
- name: Run make
run: |
cd sdk/esp-idf
./install.sh > /dev/null
. ./export.sh
. ./add_path.sh
cd ../..
make APP_VERSION=${{ needs.refs.outputs.version }} APP_NAME=${{ matrix.platform }} ${{ matrix.platform }}
- name: Save build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_${{ matrix.platform }}
path: |
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.factory.bin
if-no-files-found: warn
release:
name: Semantic Release Images and Artifacts
runs-on: ubuntu-20.04
needs: [ refs, build, build_idf, build2 ]
if: always() && needs.refs.outputs.new_release == 'true' && (github.ref == 'refs/heads/main' || github.ref_name == 'alpha')
steps:
- name: Source checkout
uses: actions/checkout@v4
- name: Fetch build assets
uses: actions/download-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}
path: output/${{ needs.refs.outputs.version }}
- name: Run Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: false
semantic_version: 21
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits@7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo Semantic Release Versions
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}