Merge pull request #15 from pimoroni/patch-moving-examples #135
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: MicroPython | |
on: | |
push: | |
pull_request: | |
release: | |
types: [created] | |
env: | |
MICROPYTHON_VERSION: feature/psram | |
MICROPYTHON_FLAVOUR: pimoroni | |
PIMORONI_PICO_VERSION: feature/picovector2-and-layers | |
jobs: | |
build: | |
name: ${{ matrix.name }} (${{ matrix.board }} ${{ matrix.variant }} ${{ matrix.modules }}) | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
include: | |
- name: explorer | |
board: explorer | |
modules: default | |
variant: | |
env: | |
# MicroPython version will be contained in github.event.release.tag_name for releases | |
RELEASE_FILE: ${{ matrix.name }}-${{ github.event.release.tag_name || github.sha }}-micropython | |
PIMORONI_PICO_DIR: "${{ github.workspace }}/pimoroni-pico" | |
USER_C_MODULES: "${{ github.workspace }}/src-${{ github.sha }}/modules/${{ matrix.modules }}.cmake" | |
USER_FS_MANIFEST: "${{ github.workspace }}/src-${{ github.sha }}/modules/${{ matrix.modules }}.txt" | |
USER_FS_SOURCE: "${{ github.workspace }}/src-${{ github.sha }}/examples" | |
TAG_OR_SHA: ${{ github.event.release.tag_name || github.sha }} | |
MICROPY_BOARD: ${{ matrix.board }} | |
MICROPY_BOARD_VARIANT: ${{ matrix.variant }} | |
MICROPY_BOARD_DIR: "${{ github.workspace }}/src-${{ github.sha }}/${{ matrix.BOARD }}" | |
MICROPY_FROZEN_MANIFEST: "${{ github.workspace }}/src-${{ github.sha }}/modules/${{ matrix.modules }}.py" | |
BOARD_NAME: ${{ matrix.name }} | |
BUILD_TOOLS: src-${{ github.sha }}/ci/micropython.sh | |
steps: | |
- name: "CCache: Restore saved cache" | |
uses: actions/cache@v4 | |
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: "Src: Checkout" | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
path: src-${{ github.sha }} | |
- name: "Pimoroni Pico: Checkout" | |
uses: actions/checkout@v4 | |
with: | |
repository: pimoroni/pimoroni-pico | |
ref: ${{env.PIMORONI_PICO_VERSION}} | |
submodules: true | |
path: pimoroni-pico | |
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc) | |
uses: carlosperate/arm-none-eabi-gcc-action@v1 | |
with: | |
release: '13.3.Rel1' | |
- name: "CCache: Install" | |
run: | | |
source $BUILD_TOOLS | |
apt_install_build_deps | |
- name: "MicroPython: Checkout" | |
run: | | |
source $BUILD_TOOLS | |
micropython_clone | |
- name: "Py_Decl: Checkout" | |
uses: actions/checkout@v4 | |
with: | |
repository: gadgetoid/py_decl | |
ref: v0.0.3 | |
path: py_decl | |
- name: "dir2uf2: Checkout" | |
uses: actions/checkout@v4 | |
with: | |
repository: gadgetoid/dir2uf2 | |
ref: v0.0.9 | |
path: dir2uf2 | |
- name: "MicroPython: Build MPY Cross" | |
run: | | |
source $BUILD_TOOLS | |
micropython_build_mpy_cross | |
- name: "MicroPython: Configure" | |
shell: bash | |
run: | | |
source $BUILD_TOOLS | |
micropython_version | |
cmake_configure | |
- name: "MicroPython: Build" | |
shell: bash | |
run: | | |
source $BUILD_TOOLS | |
cmake_build | |
- name: "Py_Decl: Verify .uf2" | |
shell: bash | |
run: | | |
python3 py_decl/py_decl.py --to-json --verify build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2 | |
- name: "dir2uf2: Append filesystem to .uf2" | |
shell: bash | |
run: | | |
python3 -m pip install littlefs-python==0.12.0 | |
./dir2uf2/dir2uf2 --fs-compact --sparse --append-to build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2 --manifest ${{env.USER_FS_MANIFEST}} --filename with-filesystem.uf2 ${{env.USER_FS_SOURCE}}/ | |
- name: "Artifacts: Upload .uf2" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.RELEASE_FILE }}.uf2 | |
path: build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2 | |
- name: "Artifacts: Upload .uf2 with filesystem" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.RELEASE_FILE }}-with-filesystem.uf2 | |
path: ${{ env.RELEASE_FILE }}-with-filesystem.uf2 | |
- name: "Release: Upload .uf2" | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
asset_path: build-${{ matrix.name }}/${{ env.RELEASE_FILE }}.uf2 | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_name: ${{ env.RELEASE_FILE }}.uf2 | |
asset_content_type: application/octet-stream | |
- name: "Release: Upload .uf2 with filesystem" | |
if: github.event_name == 'release' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
asset_path: ${{ env.RELEASE_FILE }}-with-filesystem.uf2 | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_name: ${{ env.RELEASE_FILE }}-with-filesystem.uf2 | |
asset_content_type: application/octet-stream |