Improve release building - add checking for uncommitted changes #19
Workflow file for this run
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 Firmware | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ '*' ] | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build firmware | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
submodules: recursive | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install Python dependencies | |
run: | | |
python --version | |
pip --version | |
python3 -m pip install --upgrade pip | |
pip3 install -r scripts/requirements.txt | |
- name: Install nRF Command Line Tools | |
run: | | |
wget -q https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-24-2/nrf-command-line-tools_10.24.2_amd64.deb | |
sudo dpkg -i nrf-command-line-tools_10.24.2_amd64.deb | |
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc) | |
uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
with: | |
release: '7-2018-q2' | |
- name: Create symbolic link for ARM toolchain | |
run: | | |
sudo ln -s /home/runner/gcc-arm-none-eabi-7.2018.2-linux-x64/gcc-arm-none-eabi-7-2018-q2-update \ | |
/usr/local/gcc-arm-none-eabi-7-2018-q2-update | |
- name: Cache nRF5_SDK_15.3.0_59ac345 | |
id: cache-nRF5_SDK | |
uses: actions/cache@v4 | |
with: | |
path: ~/nRF5_SDK_15.3.0_59ac345 | |
key: nRF5_SDK-${{ hashFiles('.github/workflows/build-fw.yml') }} | |
- name: Download and install Nordic SDK nRF5_SDK_15.3.0_59ac345 | |
if: steps.cache-nRF5_SDK.outputs.cache-hit != 'true' | |
run: | | |
wget -q https://developer.nordicsemi.com/nRF5_SDK/nRF5_SDK_v15.x.x/nRF5_SDK_15.3.0_59ac345.zip | |
unzip -q nRF5_SDK_15.3.0_59ac345.zip -d ~ | |
- name: Get short commit hash if no tags | |
id: get-version | |
run: | | |
VERSION=$(git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD) | |
echo "git_version=$VERSION" >> $GITHUB_ENV | |
- name: Run build | |
run: | | |
ln -s ~/nRF5_SDK_15.3.0_59ac345 nRF5_SDK_15.3.0_59ac345 | |
cd src | |
make all | |
- name: Generate artifact names | |
id: artifact-names | |
run: | | |
PREFIX="ruuvigw_nrf_armgcc_ruuvigw_release" | |
VERSION="${{ env.git_version }}" | |
BINNAME="${PREFIX}_${VERSION}" | |
echo "full_hex=${BINNAME}_full.hex" >> $GITHUB_ENV | |
echo "app_hex=${BINNAME}_app.hex" >> $GITHUB_ENV | |
- name: Upload artifact full.hex | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.full_hex }} | |
path: src/targets/ruuvigw_nrf/${{ env.full_hex }} | |
- name: Upload artifact app.hex | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.app_hex }} | |
path: src/targets/ruuvigw_nrf/${{ env.app_hex }} |