Compile Firmware #82
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: Compile Firmware | |
on: | |
schedule: | |
- cron: '0 0 */3 * *' | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Configure Software | |
run: | | |
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get install -y cmake gcc g++ automake autoconf libtool make build-essential wget git xz-utils | |
wget -q https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | |
- name: Install Compiler | |
run: | | |
tar -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | |
mv arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi ./gcc-arm-none-eabi | |
rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz | |
- name: Configure CMake | |
run: | | |
export compiler_path=$(pwd)/gcc-arm-none-eabi/bin | |
export TZ='Asia/Shanghai' | |
PATH=$PATH:$compiler_path | |
mkdir build -p && cd build && cmake .. | |
- name: Build Hex | |
run: | | |
export compiler_path=$(pwd)/gcc-arm-none-eabi/bin | |
export TZ='Asia/Shanghai' | |
PATH=$PATH:$compiler_path | |
cd build && cmake --build . --target power_manager.elf -- -j $(nproc) | |
- name: Upload Hex | |
uses: actions/upload-artifact@v3 | |
with: | |
name: power_manager_hex | |
path: build/power_manager.hex |