-
Notifications
You must be signed in to change notification settings - Fork 29
188 lines (184 loc) · 7.24 KB
/
build.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
name: Build
on:
push:
branches:
- dev
- main
pull_request:
types:
- opened
- synchronize
- closed
branches:
- dev
- main
workflow_dispatch:
# Run every Monday and Thursday at 04:30
schedule:
- cron: '30 4 * * 1,4'
jobs:
ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
project: [b_u585i_iot02a_ntz, b_u585i_iot02a_tfm]
include:
- os: ubuntu-latest
ide_pkg_name: "st-stm32cubeide_1.12.1_16088_20230420_1057_amd64"
ide_pkg_url: "https://www.st.com/content/ccc/resource/technical/software/sw_development_suite/group0/30/a8/7a/1c/24/19/42/c0/stm32cubeide-lnx/files/st-stm32cubeide_1.12.1_16088_20230420_1057_amd64.sh.zip/jcr:content/translations/en.st-stm32cubeide_1.12.1_16088_20230420_1057_amd64.sh.zip"
apt_pkg_deps: "unzip wget cmake ninja-build python3 python3-pip python3-virtualenv rsync"
user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
env:
IDE_PKG_NAME: ${{ matrix.ide_pkg_name }}
PROJECT_PATH: ${{ github.workspace }}/Projects/${{ matrix.project }}
steps:
- name: Checkout Target Project
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}
- name: Checkout submodules
shell: bash
run: git -C ${GITHUB_WORKSPACE} submodule update --init --depth 1
- name: Fetch package cache
id: cache
uses: actions/cache@v3
with:
path: ~/cache
key: ${{ matrix.os }}-${{ matrix.ide_pkg_name }}-1328
- name: Fetch Packages
shell: bash
run: sudo apt install -y ${{ matrix.apt_pkg_deps }}
- name: Initialize python virtualenv
shell: bash
run: |
cd ${GITHUB_WORKSPACE}
source tools/env_setup.sh
- name: Download and unzip IDE
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
mkdir -p ~/cache
wget "${{ matrix.ide_pkg_url }}" -U "${{ matrix.user_agent }}"
unzip en.${IDE_PKG_NAME}.sh.zip
chmod +x ${IDE_PKG_NAME}.sh
./${IDE_PKG_NAME}.sh --tar -xf ./${IDE_PKG_NAME}.tar.gz
mv ${IDE_PKG_NAME}.tar.gz ~/cache/
- name: Extract IDE
run: |
mkdir -p STM32CubeIDE
tar -xzf ~/cache/${IDE_PKG_NAME}.tar.gz --directory STM32CubeIDE
- name: Import Project and Build with STM32CubeIDE
shell: bash
run: |
export PATH=${PWD}/STM32CubeIDE:${PATH}
stm32cubeide --launcher.suppressErrors -nosplash -verbose \
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
-data "${GITHUB_WORKSPACE}" \
-import "${GITHUB_WORKSPACE}/Projects/${{ matrix.project }}" \
-build "${{ matrix.project }}/.*"
echo "Listing artifacts: "
ls -1 "${{ github.workspace }}/Projects/${{ matrix.project }}/Debug/${{ matrix.project }}"*
- name: Copy Artifacts
shell: bash
run: |
mkdir -p artifacts
rsync -avzh --ignore-missing-args Projects/${{ matrix.project }}/Debug/*.{hex,bin,elf,map,list,sh,ld} artifacts/
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: linux_${{ matrix.project }}
path: |
${{ github.workspace }}/artifacts
retention-days: 5
windows:
runs-on: windows-latest
continue-on-error: true
strategy:
matrix:
project: [b_u585i_iot02a_ntz, b_u585i_iot02a_tfm]
include:
- os: windows-latest
ide_pkg_name: "st-stm32cubeide_1.12.1_16088_20230420_1057_x86_64"
ide_pkg_url: "https://www.st.com/content/ccc/resource/technical/software/sw_development_suite/group0/e8/14/a7/4e/fe/8a/4e/a0/stm32cubeide-win/files/st-stm32cubeide_1.12.1_16088_20230420_1057_x86_64.exe.zip/jcr:content/translations/en.st-stm32cubeide_1.12.1_16088_20230420_1057_x86_64.exe.zip"
scoop_pkg_deps: "cmake wget git python 7zip ninja"
pip_pkg_deps: "virtualenv"
user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
env:
IDE_PKG_NAME: ${{ matrix.ide_pkg_name }}
steps:
- name: Enable windows long path
shell: bash
run: git config --system core.longpaths true
- name: Checkout Target Project
uses: actions/checkout@v2
with:
path: ${{ github.workspace }}
- name: Checkout submodules
shell: bash
run: git -C ${GITHUB_WORKSPACE} submodule update --init --depth 1
- name: Check cache for IDE package
id: cache-ide
uses: actions/cache@v3
with:
path: |
~/cache
~/scoop/cache
key: ${{ matrix.os }}-${{ matrix.ide_pkg_name }}-1057
- name: Install Scoop package manager
shell: pwsh
run: |
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
- name: Fetch Packages
shell: bash
run: |
export PATH="$(realpath ~/scoop)/shims:${PATH}"
for pkg in "${{ matrix.scoop_pkg_deps }}"; do
scoop install $pkg
done
pip install ${{ matrix.pip_pkg_deps }}
- name: Initialize python virtualenv
shell: bash
run: |
export PATH="$(realpath ~/scoop)/shims:${PATH}"
cd ${GITHUB_WORKSPACE}
source tools/env_setup.sh
- name: Download and unzip IDE
shell: bash
if: ${{ steps.cache-ide.outputs.cache-hit != 'true' }}
run: |
export PATH="$(realpath ~/scoop)/shims:${PATH}"
mkdir -p ~/cache
wget "${{ matrix.ide_pkg_url }}" -U "${{ matrix.user_agent }}"
7z x en.${{ matrix.ide_pkg_name }}.exe.zip
mv ${{ matrix.ide_pkg_name }}.exe ~/cache/${{ matrix.ide_pkg_name }}.exe
- name: Extract IDE
shell: bash
run: |
cd $GITHUB_WORKSPACE/../
7z x ~/cache/${{ matrix.ide_pkg_name }}.exe
- name: Import and Build
shell: cmd
run: |
cd %GITHUB_WORKSPACE%
cd ..
set PATH=%CD%\STM32CubeIDE;%PATH%
set PATH=%HOMEDRIVE%%HOMEPATH%\scoop\shims;%PATH%
.venv\Scripts\activate.bat
SET
stm32cubeidec --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data %GITHUB_WORKSPACE% -verbose -no-indexer -importAll %GITHUB_WORKSPACE%\Projects -cleanBuild "${{ matrix.project }}/.*"
- name: Copy Artifacts
shell: bash
run: |
mkdir -p artifacts
file_names=$(ls -1 Projects/${{ matrix.project }}/Debug | grep -E '${{ matrix.project }}.*\.(hex|bin|elf|map|list|sh|ld)' | xargs)
for file_name in ${file_names}; do
cp "Projects/${{ matrix.project }}/Debug/${file_name}" artifacts/
done
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: windows_${{ matrix.project }}
path: |
${{ github.workspace }}\artifacts
retention-days: 5