2022-02-24 16:49:28 +00:00
|
|
|
name: MicroPython for Badger2040
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
env:
|
2023-01-09 15:30:33 +00:00
|
|
|
MICROPYTHON_VERSION: 699477d12d1aa1cb57ff6cfc3f5dc5e97524dbe6
|
2022-06-23 16:34:21 +01:00
|
|
|
BOARD_TYPE: PIMORONI_BADGER2040
|
2022-03-11 10:00:27 +00:00
|
|
|
# MicroPython version will be contained in github.event.release.tag_name for releases
|
2022-07-27 09:58:44 +01:00
|
|
|
RELEASE_FILE: pimoroni-badger2040-${{github.event.release.tag_name || github.sha}}-micropython
|
2022-02-24 16:49:28 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-03-11 10:00:27 +00:00
|
|
|
deps:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
name: Dependencies
|
2022-02-24 16:49:28 +00:00
|
|
|
steps:
|
2022-03-11 10:00:27 +00:00
|
|
|
- name: Workspace Cache
|
|
|
|
id: cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-03-11 10:00:27 +00:00
|
|
|
with:
|
|
|
|
path: ${{runner.workspace}}
|
|
|
|
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
|
|
|
restore-keys: |
|
|
|
|
workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
|
|
|
|
2022-02-24 16:49:28 +00:00
|
|
|
# Check out MicroPython
|
|
|
|
- name: Checkout MicroPython
|
2022-03-11 10:00:27 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-02-24 16:49:28 +00:00
|
|
|
with:
|
|
|
|
repository: micropython/micropython
|
|
|
|
ref: ${{env.MICROPYTHON_VERSION}}
|
|
|
|
submodules: false # MicroPython submodules are hideously broken
|
|
|
|
path: micropython
|
|
|
|
|
2022-03-11 10:00:27 +00:00
|
|
|
- name: Fetch base MicroPython submodules
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Fetch Pico SDK submodules
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/lib/pico-sdk
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Build mpy-cross
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/mpy-cross
|
|
|
|
run: make
|
|
|
|
|
|
|
|
build:
|
|
|
|
needs: deps
|
|
|
|
name: Build Badger 2040
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Compiler Cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-03-11 10:00:27 +00:00
|
|
|
with:
|
|
|
|
path: /home/runner/.ccache
|
|
|
|
key: ccache-micropython-badger2040-${{github.ref}}-${{github.sha}}
|
|
|
|
restore-keys: |
|
|
|
|
ccache-micropython-badger2040-${{github.ref}}
|
|
|
|
ccache-micropython-badger2040-
|
|
|
|
|
|
|
|
- name: Workspace Cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-03-11 10:00:27 +00:00
|
|
|
with:
|
|
|
|
path: ${{runner.workspace}}
|
|
|
|
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
|
|
|
restore-keys: |
|
|
|
|
workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
|
|
|
|
2022-12-19 12:34:20 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-24 16:49:28 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
path: pimoroni-pico-${{ github.sha }}
|
|
|
|
|
2022-06-23 16:34:21 +01:00
|
|
|
- name: "HACK: MicroPython Board Fixups"
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
2022-02-24 16:49:28 +00:00
|
|
|
run: |
|
2022-06-23 16:34:21 +01:00
|
|
|
../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh badger2040 ${{env.BOARD_TYPE}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board
|
2022-02-24 16:49:28 +00:00
|
|
|
|
|
|
|
# Linux deps
|
2022-03-11 10:00:27 +00:00
|
|
|
- name: Install Compiler & CCache
|
2022-02-24 16:49:28 +00:00
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
2022-07-22 14:17:52 +01:00
|
|
|
sudo apt update && sudo apt install ccache gcc-arm-none-eabi
|
2022-03-04 11:21:53 +00:00
|
|
|
python3 -m pip install pillow
|
2022-02-24 16:49:28 +00:00
|
|
|
|
2022-07-27 09:58:44 +01:00
|
|
|
# Build without BadgerOS
|
|
|
|
- name: Configure MicroPython (No BadgerOS)
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
2022-08-04 11:39:30 +01:00
|
|
|
cmake -S . -B build-${{env.BOARD_TYPE}}-without-badger-os -DBADGER2040_NO_MODULES=1 -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/badger2040-micropython.cmake -DMICROPY_BOARD=${{env.BOARD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
2022-07-27 09:58:44 +01:00
|
|
|
|
|
|
|
- name: Build MicroPython (No BadgerOS)
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
|
|
|
ccache --zero-stats || true
|
2022-08-04 11:39:30 +01:00
|
|
|
cmake --build build-${{env.BOARD_TYPE}}-without-badger-os -j 2
|
2022-07-27 09:58:44 +01:00
|
|
|
ccache --show-stats || true
|
|
|
|
|
|
|
|
- name: Rename .uf2 for artifact (No BadgerOS)
|
|
|
|
shell: bash
|
2022-08-04 11:39:30 +01:00
|
|
|
working-directory: micropython/ports/rp2/build-${{env.BOARD_TYPE}}-without-badger-os
|
2022-07-27 09:58:44 +01:00
|
|
|
run: |
|
|
|
|
cp firmware.uf2 ${{env.RELEASE_FILE}}-without-badger-os.uf2
|
|
|
|
|
|
|
|
- name: Store .uf2 as artifact (No BadgerOS)
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-07-27 09:58:44 +01:00
|
|
|
with:
|
|
|
|
name: ${{env.RELEASE_FILE}}-without-badger-os.uf2
|
2022-08-04 11:39:30 +01:00
|
|
|
path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}-without-badger-os/${{env.RELEASE_FILE}}-without-badger-os.uf2
|
2022-07-27 09:58:44 +01:00
|
|
|
|
|
|
|
- name: Upload .uf2 (No BadgerOS)
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
with:
|
2022-08-04 11:39:30 +01:00
|
|
|
asset_path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}-without-badger-os/${{env.RELEASE_FILE}}-without-badger-os.uf2
|
2022-07-27 09:58:44 +01:00
|
|
|
upload_url: ${{github.event.release.upload_url}}
|
|
|
|
asset_name: ${{env.RELEASE_FILE}}-without-badger-os.uf2
|
|
|
|
asset_content_type: application/octet-stream
|
|
|
|
|
|
|
|
# Build with BadgerOS
|
2022-03-11 10:00:27 +00:00
|
|
|
- name: Configure MicroPython
|
2022-02-24 16:49:28 +00:00
|
|
|
shell: bash
|
2022-03-11 10:00:27 +00:00
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
|
|
|
cmake -S . -B build-${{env.BOARD_TYPE}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/badger2040-micropython.cmake -DMICROPY_BOARD=${{env.BOARD_TYPE}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
2022-02-24 16:49:28 +00:00
|
|
|
|
|
|
|
- name: Build MicroPython
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
2022-03-11 10:00:27 +00:00
|
|
|
run: |
|
|
|
|
ccache --zero-stats || true
|
|
|
|
cmake --build build-${{env.BOARD_TYPE}} -j 2
|
|
|
|
ccache --show-stats || true
|
2022-02-24 16:49:28 +00:00
|
|
|
|
|
|
|
- name: Rename .uf2 for artifact
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2/build-${{env.BOARD_TYPE}}
|
2022-02-24 17:53:05 +00:00
|
|
|
run: |
|
2022-07-27 09:58:44 +01:00
|
|
|
cp firmware.uf2 ${{env.RELEASE_FILE}}.uf2
|
2022-02-24 16:49:28 +00:00
|
|
|
|
|
|
|
- name: Store .uf2 as artifact
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-02-24 16:49:28 +00:00
|
|
|
with:
|
2022-07-27 09:58:44 +01:00
|
|
|
name: ${{env.RELEASE_FILE}}.uf2
|
|
|
|
path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{env.RELEASE_FILE}}.uf2
|
2022-02-24 16:49:28 +00:00
|
|
|
|
|
|
|
- name: Upload .uf2
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
with:
|
2022-07-27 09:58:44 +01:00
|
|
|
asset_path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{env.RELEASE_FILE}}.uf2
|
2022-02-24 16:49:28 +00:00
|
|
|
upload_url: ${{github.event.release.upload_url}}
|
2022-07-27 09:58:44 +01:00
|
|
|
asset_name: ${{env.RELEASE_FILE}}.uf2
|
2022-02-24 16:49:28 +00:00
|
|
|
asset_content_type: application/octet-stream
|