2021-01-24 14:52:59 +00:00
|
|
|
name: MicroPython
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
env:
|
2023-01-25 12:13:26 +00:00
|
|
|
MICROPYTHON_VERSION: 67fac4ebc53db6337008ba06df7932faec80f57c
|
2021-01-24 14:52:59 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-03-10 22:38:49 +00:00
|
|
|
deps:
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
name: Dependencies
|
2021-01-24 14:52:59 +00:00
|
|
|
steps:
|
2022-03-11 00:53:39 +00:00
|
|
|
- name: Workspace Cache
|
|
|
|
id: cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-03-11 00:53:39 +00:00
|
|
|
with:
|
|
|
|
path: ${{runner.workspace}}
|
2022-03-11 01:06:19 +00:00
|
|
|
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
2022-03-11 00:53:39 +00:00
|
|
|
restore-keys: |
|
2022-03-11 01:06:19 +00:00
|
|
|
workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
2022-03-11 00:53:39 +00:00
|
|
|
|
2021-01-24 14:52:59 +00:00
|
|
|
# Check out MicroPython
|
|
|
|
- name: Checkout MicroPython
|
2022-03-11 00:53:39 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-01-24 14:52:59 +00:00
|
|
|
with:
|
2021-03-30 14:43:28 +01:00
|
|
|
repository: micropython/micropython
|
2021-04-19 12:40:03 +01:00
|
|
|
ref: ${{env.MICROPYTHON_VERSION}}
|
2021-01-24 14:52:59 +00:00
|
|
|
submodules: false # MicroPython submodules are hideously broken
|
|
|
|
path: micropython
|
|
|
|
|
|
|
|
- name: Fetch base MicroPython submodules
|
2022-03-11 00:53:39 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2021-01-24 14:52:59 +00:00
|
|
|
shell: bash
|
|
|
|
working-directory: micropython
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Fetch Pico SDK submodules
|
2022-03-11 00:53:39 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2021-01-24 14:52:59 +00:00
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/lib/pico-sdk
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Build mpy-cross
|
2022-03-11 00:53:39 +00:00
|
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
2021-01-24 14:52:59 +00:00
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/mpy-cross
|
|
|
|
run: make
|
|
|
|
|
2022-03-10 22:38:49 +00:00
|
|
|
build:
|
|
|
|
needs: deps
|
2022-03-10 23:44:01 +00:00
|
|
|
name: Build ${{matrix.board}}
|
2022-03-10 22:38:49 +00:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-03-10 23:44:01 +00:00
|
|
|
include:
|
|
|
|
- name: pico
|
|
|
|
board: PICO
|
|
|
|
- name: tiny2040
|
|
|
|
board: PIMORONI_TINY2040
|
2022-03-11 09:33:51 +00:00
|
|
|
- name: picolipo_4mb
|
|
|
|
board: PIMORONI_PICOLIPO_4MB
|
2022-03-10 23:44:01 +00:00
|
|
|
- name: picolipo_16mb
|
|
|
|
board: PIMORONI_PICOLIPO_16MB
|
2022-06-17 11:29:24 +01:00
|
|
|
- name: tufty2040
|
|
|
|
board: PIMORONI_TUFTY2040
|
2022-03-10 23:44:01 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
# MicroPython version will be contained in github.event.release.tag_name for releases
|
|
|
|
RELEASE_FILE: pimoroni-${{matrix.name}}-${{github.event.release.tag_name || github.sha}}-micropython.uf2
|
2022-03-10 22:38:49 +00:00
|
|
|
|
|
|
|
steps:
|
2022-03-10 23:44:01 +00:00
|
|
|
- name: Compiler Cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-03-10 22:38:49 +00:00
|
|
|
with:
|
|
|
|
path: /home/runner/.ccache
|
2022-03-11 00:29:47 +00:00
|
|
|
key: ccache-micropython-${{matrix.name}}-${{github.ref}}-${{github.sha}}
|
2022-03-10 22:38:49 +00:00
|
|
|
restore-keys: |
|
2022-03-11 00:29:47 +00:00
|
|
|
ccache-micropython-${{matrix.name}}-${{github.ref}}
|
|
|
|
ccache-micropython-${{matrix.name}}-
|
2022-03-10 22:38:49 +00:00
|
|
|
|
2022-03-10 23:44:01 +00:00
|
|
|
- name: Workspace Cache
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/cache@v3
|
2022-03-10 22:38:49 +00:00
|
|
|
with:
|
|
|
|
path: ${{runner.workspace}}
|
2022-03-11 01:06:19 +00:00
|
|
|
key: workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
2022-03-10 22:38:49 +00:00
|
|
|
restore-keys: |
|
2022-03-11 01:06:19 +00:00
|
|
|
workspace-micropython-${{env.MICROPYTHON_VERSION}}
|
2022-03-10 22:38:49 +00:00
|
|
|
|
|
|
|
- name: Install Compiler & CCache
|
|
|
|
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-11 00:57:56 +00:00
|
|
|
|
2022-12-19 12:34:20 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-11 00:57:56 +00:00
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
path: pimoroni-pico-${{ github.sha }}
|
2022-06-17 11:29:24 +01:00
|
|
|
|
|
|
|
- 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
|
2022-03-11 00:57:56 +00:00
|
|
|
|
2022-03-10 23:44:01 +00:00
|
|
|
- name: Configure MicroPython
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
|
|
|
run: |
|
2022-05-27 11:12:44 +01:00
|
|
|
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
|
2022-03-10 23:44:01 +00:00
|
|
|
|
2021-01-24 14:52:59 +00:00
|
|
|
- name: Build MicroPython
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
2022-03-10 22:38:49 +00:00
|
|
|
run: |
|
2022-03-10 23:44:01 +00:00
|
|
|
ccache --zero-stats || true
|
|
|
|
cmake --build build-${{matrix.board}} -j 2
|
|
|
|
ccache --show-stats || true
|
2021-01-24 14:52:59 +00:00
|
|
|
|
2021-09-02 10:10:02 +01:00
|
|
|
- name: Rename .uf2 for artifact
|
|
|
|
shell: bash
|
2022-03-10 22:38:49 +00:00
|
|
|
working-directory: micropython/ports/rp2/build-${{matrix.board}}
|
2022-03-10 23:44:01 +00:00
|
|
|
run: cp firmware.uf2 $RELEASE_FILE
|
2021-09-02 10:10:02 +01:00
|
|
|
|
2021-05-20 14:10:57 +01:00
|
|
|
- name: Store .uf2 as artifact
|
2022-12-19 12:34:20 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-05-20 14:10:57 +01:00
|
|
|
with:
|
2022-03-10 23:44:01 +00:00
|
|
|
name: ${{env.RELEASE_FILE}}
|
|
|
|
path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}
|
2021-05-20 14:10:57 +01:00
|
|
|
|
2021-01-24 14:52:59 +00:00
|
|
|
- name: Upload .uf2
|
|
|
|
if: github.event_name == 'release'
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
with:
|
2022-03-10 22:38:49 +00:00
|
|
|
asset_path: micropython/ports/rp2/build-${{matrix.board}}/firmware.uf2
|
2021-01-24 14:52:59 +00:00
|
|
|
upload_url: ${{github.event.release.upload_url}}
|
2022-03-10 23:44:01 +00:00
|
|
|
asset_name: ${{env.RELEASE_FILE}}
|
2021-03-08 21:23:19 +00:00
|
|
|
asset_content_type: application/octet-stream
|