CI/CD basic implementation based on GitHub Actions #3
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
model: [ "hydrafw" ] | |
fail-fast: true | |
steps: | |
- name: Update package cache | |
run: sudo apt update -y | |
- name: Install packages | |
run: sudo apt install -y --no-install-recommends --no-install-suggests git make python3 python3-pip | |
- name: Install python modules | |
run: python3 -m pip install GitPython intelhex --upgrade | |
- name: Install standalone reference GCC toolchain | |
run: bash scripts/env.sh | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set git ownership | |
run: git config --global --add safe.directory /__w/hydrafw/hydrafw | |
- name: Set git meta info | |
run: echo "GITHUB_CI_PR_SHA=${{github.event.pull_request.head.sha}}" >> "${GITHUB_ENV}" | |
- name: Build ${{ matrix.model }} | |
run: source build.env && make V=1 -j$(nproc) -C src/ | |
- name: Archive ${{ matrix.model }} artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.model }} | |
path: | | |
src/build/${{ matrix.model }}.dfu | |
if-no-files-found: error | |