From acf0e568bd81b8021bc878c963d8f4c20be88055 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 28 Mar 2023 13:04:54 +0100 Subject: [PATCH] CI: Tidyup and combine MicroPython builds. --- .github/workflows/micropython-picow.yml | 153 ------------------------ .github/workflows/micropython.yml | 35 ++++-- 2 files changed, 27 insertions(+), 161 deletions(-) delete mode 100644 .github/workflows/micropython-picow.yml diff --git a/.github/workflows/micropython-picow.yml b/.github/workflows/micropython-picow.yml deleted file mode 100644 index 16f80cb8..00000000 --- a/.github/workflows/micropython-picow.yml +++ /dev/null @@ -1,153 +0,0 @@ -name: MicroPython - -on: - push: - pull_request: - release: - types: [created] - -env: - MICROPYTHON_VERSION: 38e7b842c6bc8122753cbf0845eb141f28fbcb72 - -jobs: - deps: - runs-on: ubuntu-20.04 - name: Dependencies - steps: - - name: Workspace Cache - id: cache - uses: actions/cache@v3 - with: - path: ${{runner.workspace}} - key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs - restore-keys: | - workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs - - # Check out MicroPython - - name: Checkout MicroPython - if: steps.cache.outputs.cache-hit != 'true' - uses: actions/checkout@v3 - with: - repository: micropython/micropython - ref: ${{env.MICROPYTHON_VERSION}} - submodules: false # MicroPython submodules are hideously broken - path: micropython - - # Check out MicroPython Libs - - name: Checkout MicroPython Libs - if: steps.cache.outputs.cache-hit != 'true' - uses: actions/checkout@v3 - with: - repository: micropython/micropython-lib - path: micropython-lib - - - 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 ${{matrix.name}} (${{matrix.board}}) - runs-on: ubuntu-20.04 - strategy: - matrix: - include: - - name: picow - board: PICO_W - - name: picow_enviro - board: PICO_W_ENVIRO - - name: picow_galactic_unicorn - board: PICO_W - - name: picow_cosmic_unicorn - board: PICO_W - - name: picow_inky_frame - board: PICO_W_INKY - - 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 - - steps: - - name: Compiler Cache - uses: actions/cache@v3 - 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 - uses: actions/cache@v3 - with: - path: ${{runner.workspace}} - key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs - restore-keys: | - workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs - - - name: Install Compiler & CCache - if: runner.os == 'Linux' - run: | - sudo apt update && sudo apt install ccache gcc-arm-none-eabi - - - uses: actions/checkout@v3 - 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}} - run: | - cp firmware.uf2 $RELEASE_FILE.uf2 - - - name: Store .uf2 as artifact - uses: actions/upload-artifact@v3 - with: - name: ${{env.RELEASE_FILE}}.uf2 - path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}.uf2 - - - 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}} - asset_name: ${{env.RELEASE_FILE}}.uf2 - asset_content_type: application/octet-stream diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 02ec938c..e1963f8e 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -19,9 +19,9 @@ jobs: uses: actions/cache@v3 with: path: ${{runner.workspace}} - key: workspace-micropython-${{env.MICROPYTHON_VERSION}} + key: workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs restore-keys: | - workspace-micropython-${{env.MICROPYTHON_VERSION}} + workspace-micropython-${{env.MICROPYTHON_VERSION}}-with-libs # Check out MicroPython - name: Checkout MicroPython @@ -33,6 +33,14 @@ jobs: submodules: false # MicroPython submodules are hideously broken path: micropython + # Check out MicroPython Libs + - name: Checkout MicroPython Libs + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + repository: micropython/micropython-lib + path: micropython-lib + - name: Fetch base MicroPython submodules if: steps.cache.outputs.cache-hit != 'true' shell: bash @@ -53,7 +61,7 @@ jobs: build: needs: deps - name: Build ${{matrix.board}} + name: Build ${{matrix.name}} (${{matrix.board}}) runs-on: ubuntu-20.04 strategy: matrix: @@ -68,10 +76,20 @@ jobs: board: PIMORONI_PICOLIPO_16MB - name: tufty2040 board: PIMORONI_TUFTY2040 + - name: picow + board: PICO_W + - name: picow_enviro + board: PICO_W_ENVIRO + - name: picow_galactic_unicorn + board: PICO_W + - name: picow_cosmic_unicorn + board: PICO_W + - name: picow_inky_frame + board: PICO_W_INKY 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 + RELEASE_FILE: pimoroni-${{matrix.name}}-${{github.event.release.tag_name || github.sha}}-micropython steps: - name: Compiler Cache @@ -124,13 +142,14 @@ jobs: - name: Rename .uf2 for artifact shell: bash working-directory: micropython/ports/rp2/build-${{matrix.board}} - run: cp firmware.uf2 $RELEASE_FILE + run: | + cp firmware.uf2 $RELEASE_FILE.uf2 - name: Store .uf2 as artifact uses: actions/upload-artifact@v3 with: - name: ${{env.RELEASE_FILE}} - path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}} + name: ${{env.RELEASE_FILE}}.uf2 + path: micropython/ports/rp2/build-${{matrix.board}}/${{env.RELEASE_FILE}}.uf2 - name: Upload .uf2 if: github.event_name == 'release' @@ -140,5 +159,5 @@ jobs: with: asset_path: micropython/ports/rp2/build-${{matrix.board}}/firmware.uf2 upload_url: ${{github.event.release.upload_url}} - asset_name: ${{env.RELEASE_FILE}} + asset_name: ${{env.RELEASE_FILE}}.uf2 asset_content_type: application/octet-stream