Build #553
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |