2022-06-30 08:55:15 +01:00
|
|
|
name: MicroPython
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
env:
|
2023-02-20 10:56:39 +00:00
|
|
|
MICROPYTHON_VERSION: 294098d28e2bad0ac0aad0d72595d11a82798096
|
2022-06-30 08:55:15 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
deps:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
name: Dependencies
|
|
|
|
steps:
|
|
|
|
- name: Workspace Cache
|
|
|
|
id: cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-06-30 08:55:15 +01:00
|
|
|
with:
|
|
|
|
path: ${{runner.workspace}}
|
2022-07-27 10:11:22 +01:00
|
|
|
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
|
2022-06-30 08:55:15 +01:00
|
|
|
restore-keys: |
|
2022-07-27 10:11:22 +01:00
|
|
|
workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
|
2022-06-30 08:55:15 +01:00
|
|
|
|
|
|
|
# Check out MicroPython
|
|
|
|
- name: Checkout MicroPython
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-06-30 08:55:15 +01:00
|
|
|
with:
|
|
|
|
repository: micropython/micropython
|
|
|
|
ref: ${{env.MICROPYTHON_VERSION}}
|
|
|
|
submodules: false # MicroPython submodules are hideously broken
|
|
|
|
path: micropython
|
|
|
|
|
2022-07-27 10:11:22 +01:00
|
|
|
# Check out MicroPython Libs
|
|
|
|
- name: Checkout MicroPython Libs
|
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-07-27 10:11:22 +01:00
|
|
|
with:
|
|
|
|
repository: micropython/micropython-lib
|
|
|
|
path: micropython-lib
|
|
|
|
|
2022-06-30 08:55:15 +01: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
|
2022-10-13 14:43:02 +01:00
|
|
|
name: Build ${{matrix.name}} (${{matrix.board}})
|
2022-06-30 08:55:15 +01:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: picow
|
|
|
|
board: PICO_W
|
2022-08-02 14:28:43 +01:00
|
|
|
- name: picow_enviro
|
|
|
|
board: PICO_W_ENVIRO
|
2022-10-13 14:43:02 +01:00
|
|
|
- name: picow_galactic_unicorn
|
|
|
|
board: PICO_W
|
2023-02-02 12:36:07 +00:00
|
|
|
- name: picow_cosmic_unicorn
|
|
|
|
board: PICO_W
|
2022-12-08 11:04:14 +00:00
|
|
|
- name: picow_inky_frame
|
2022-12-08 12:02:46 +00:00
|
|
|
board: PICO_W_INKY
|
2022-06-30 08:55:15 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
# MicroPython version will be contained in github.event.release.tag_name for releases
|
2022-07-07 11:25:34 +01:00
|
|
|
RELEASE_FILE: pimoroni-${{matrix.name}}-${{github.event.release.tag_name || github.sha}}-micropython
|
2022-06-30 08:55:15 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Compiler Cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-06-30 08:55:15 +01:00
|
|
|
with:
|
|
|
|
path: /home/runner/.ccache
|
|
|
|
key: ccache-micropython-${{matrix.name}}-${{github.ref}}-${{github.sha}}
|
|
|
|
restore-keys: |
|
|
|
|
ccache-micropython-${{matrix.name}}-${{github.ref}}
|
|
|
|
ccache-micropython-${{matrix.name}}-
|
|
|
|
|
|
|
|
- name: Workspace Cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-06-30 08:55:15 +01:00
|
|
|
with:
|
|
|
|
path: ${{runner.workspace}}
|
2022-07-27 10:11:22 +01:00
|
|
|
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
|
2022-06-30 08:55:15 +01:00
|
|
|
restore-keys: |
|
2022-07-27 10:11:22 +01:00
|
|
|
workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs
|
2022-06-30 08:55:15 +01:00
|
|
|
|
|
|
|
- name: Install Compiler & CCache
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
2022-07-07 11:25:34 +01:00
|
|
|
sudo apt update && sudo apt install ccache gcc-arm-none-eabi
|
2022-06-30 08:55:15 +01:00
|
|
|
|
2022-12-19 12:34:20 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-30 08:55:15 +01:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
path: pimoroni-pico-${{ github.sha }}
|
|
|
|
|
|
|
|
- name: "HACK: MicroPython Board Fixups"
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
|
|
|
../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board/board-fixup.sh ${{matrix.name}} ${{matrix.board}} ../../../pimoroni-pico-${GITHUB_SHA}/micropython/_board
|
|
|
|
|
|
|
|
- name: Configure MicroPython
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
|
|
|
cmake -S . -B build-${{matrix.board}} -DPICO_BUILD_DOCS=0 -DUSER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/micropython-${{matrix.name}}.cmake -DMICROPY_BOARD=${{matrix.board}} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
|
|
|
|
|
|
- name: Build MicroPython
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
|
|
|
ccache --zero-stats || true
|
|
|
|
cmake --build build-${{matrix.board}} -j 2
|
|
|
|
ccache --show-stats || true
|
|
|
|
|
|
|
|
- name: Rename .uf2 for artifact
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2/build-${{matrix.board}}
|
2022-07-07 11:25:34 +01:00
|
|
|
run: |
|
|
|
|
cp firmware.uf2 $RELEASE_FILE.uf2
|
2022-06-30 08:55:15 +01:00
|
|
|
|
|
|
|
- name: Store .uf2 as artifact
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-06-30 08:55:15 +01:00
|
|
|
with:
|
2022-07-07 11:25:34 +01:00
|
|
|
name: ${{env.RELEASE_FILE}}.uf2
|
|
|
|
path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}.uf2
|
|
|
|
|
2022-06-30 08:55:15 +01:00
|
|
|
- name: Upload .uf2
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
with:
|
|
|
|
asset_path: micropython/ports/rp2/build-${{matrix.board}}/firmware.uf2
|
|
|
|
upload_url: ${{github.event.release.upload_url}}
|
2022-07-07 11:25:34 +01:00
|
|
|
asset_name: ${{env.RELEASE_FILE}}.uf2
|
2022-06-30 08:55:15 +01:00
|
|
|
asset_content_type: application/octet-stream
|