2021-01-24 14:52:59 +00:00
|
|
|
name: MicroPython
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
release:
|
|
|
|
types: [created]
|
|
|
|
|
|
|
|
env:
|
|
|
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
2022-01-25 12:05:43 +00:00
|
|
|
MICROPYTHON_VERSION: v1.18
|
2021-01-24 14:52:59 +00:00
|
|
|
BUILD_TYPE: Release
|
2021-04-19 13:02:38 +00:00
|
|
|
BOARD_TYPE: PICO
|
2021-01-24 14:52:59 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: ${{matrix.name}}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- os: ubuntu-20.04
|
|
|
|
name: Linux
|
|
|
|
cache-key: linux
|
|
|
|
cmake-args: '-DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk'
|
|
|
|
apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
|
|
|
|
|
|
|
|
runs-on: ${{matrix.os}}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# Check out MicroPython
|
|
|
|
- name: Checkout MicroPython
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
2021-03-30 13:43:28 +00:00
|
|
|
repository: micropython/micropython
|
2021-04-19 11:40:03 +00:00
|
|
|
ref: ${{env.MICROPYTHON_VERSION}}
|
2021-01-24 14:52:59 +00:00
|
|
|
submodules: false # MicroPython submodules are hideously broken
|
|
|
|
path: micropython
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
2021-03-08 21:23:19 +00:00
|
|
|
submodules: true
|
2021-05-12 10:28:52 +00:00
|
|
|
path: pimoroni-pico-${{ github.sha }}
|
2021-01-24 14:52:59 +00:00
|
|
|
|
2021-07-28 10:21:27 +00:00
|
|
|
# Copy Python module files
|
|
|
|
- name: Copy modules
|
|
|
|
run: |
|
|
|
|
cp -r pimoroni-pico-${GITHUB_SHA}/micropython/modules_py/* micropython/ports/rp2/modules/
|
|
|
|
|
2021-01-24 14:52:59 +00:00
|
|
|
# Linux deps
|
|
|
|
- name: Install deps
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
|
|
|
sudo apt update && sudo apt install ${{matrix.apt-packages}}
|
|
|
|
|
|
|
|
- name: Fetch base MicroPython submodules
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Fetch Pico SDK submodules
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/lib/pico-sdk
|
|
|
|
run: git submodule update --init
|
|
|
|
|
|
|
|
- name: Build mpy-cross
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/mpy-cross
|
|
|
|
run: make
|
|
|
|
|
|
|
|
- name: Build MicroPython
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2
|
2021-05-12 10:28:52 +00:00
|
|
|
run: make USER_C_MODULES=../../../pimoroni-pico-${GITHUB_SHA}/micropython/modules/micropython.cmake -j2
|
2021-01-24 14:52:59 +00:00
|
|
|
|
2021-09-02 09:10:02 +00:00
|
|
|
- name: Rename .uf2 for artifact
|
|
|
|
shell: bash
|
|
|
|
working-directory: micropython/ports/rp2/build-${{env.BOARD_TYPE}}
|
|
|
|
run: cp firmware.uf2 ${{github.event.repository.name}}-${{github.event.release.tag_name}}-micropython-${{env.MICROPYTHON_VERSION}}.uf2
|
|
|
|
|
2021-05-20 13:10:57 +00:00
|
|
|
- name: Store .uf2 as artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{github.event.repository.name}}-${{github.event.release.tag_name}}-micropython-${{env.MICROPYTHON_VERSION}}.uf2
|
2021-09-02 09:10:02 +00:00
|
|
|
path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/${{github.event.repository.name}}-${{github.event.release.tag_name}}-micropython-${{env.MICROPYTHON_VERSION}}.uf2
|
2021-05-20 13:10:57 +00: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:
|
2021-04-19 13:02:38 +00:00
|
|
|
asset_path: micropython/ports/rp2/build-${{env.BOARD_TYPE}}/firmware.uf2
|
2021-01-24 14:52:59 +00:00
|
|
|
upload_url: ${{github.event.release.upload_url}}
|
2021-04-19 11:40:03 +00:00
|
|
|
asset_name: ${{github.event.repository.name}}-${{github.event.release.tag_name}}-micropython-${{env.MICROPYTHON_VERSION}}.uf2
|
2021-03-08 21:23:19 +00:00
|
|
|
asset_content_type: application/octet-stream
|