Update Readme with build types section #2
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: | |
workflow_call: | |
inputs: | |
checkout_ref: | |
required: true | |
type: string | |
pull_request: | |
types: [opened, reopened, synchronize] | |
push: | |
branches: | |
- "main" | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
# Set work dir to "project" for all 'run' calls. Beware, everything else | |
# (actions, 'with' params, etc.) still needs to reference full path. | |
working-directory: project | |
steps: | |
- name: Checkout last PR commit | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: project | |
- name: Checkout last tag | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.checkout_ref }} | |
path: project | |
- name: Checkout main | |
if: github.event_name == 'push' | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
path: project | |
- name: Install and cache apt packages | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: gcc-multilib | |
# Update this manually when changing the packages above, increment | |
# only minor version to keep APT caches separate. | |
version: 1.0 | |
- name: Retrieve cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-modules | |
with: | |
path: | | |
bootloader | |
modules | |
nrf | |
nrfxlib | |
test | |
tools | |
zephyr | |
~/.local/share/east/downloads/ | |
~/.local/share/east/tooling/nrfutil | |
# Note above two lines, if we are caching entire ~/.local/share/east | |
# folder then cache action fails during download/extract step | |
key: | |
${{ runner.os }}-build-${{ env.cache-name }}-${{ | |
hashFiles('project/west.yml') }} | |
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: "pip" | |
cache-dependency-path: project/scripts/requirements.txt | |
- name: Install Python dependencies | |
run: pip install -r scripts/requirements.txt | |
- name: Install project dependencies | |
run: make install-dep | |
- name: Setup project | |
run: make project-setup | |
- name: Pre-build | |
run: make pre-build | |
- name: Quick build | |
if: github.event_name == 'push' | |
run: make quick-build | |
- name: Release | |
if: | |
github.event_name == 'workflow_dispatch' || github.event_name == | |
'pull_request' | |
run: make release | |
- name: Pre-package | |
if: github.event_name == 'workflow_dispatch' | |
run: make pre-package | |
- name: Package artefacts | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artefacts | |
path: project/artefacts/* |