Skip to content

Commit

Permalink
CI: Sync tooling with inky-frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Feb 7, 2025
1 parent 840c58f commit 9525624
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/micropython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
RELEASE_FILE: ${{ matrix.name }}-${{ github.event.release.tag_name || github.sha }}-micropython
CI_PROJECT_ROOT: ${{ github.workspace }}/src-${{ github.sha }}
CI_BUILD_ROOT: ${{ github.workspace }}
CI_USE_ENV: 1

steps:
- name: Compiler Cache Fixup
Expand Down Expand Up @@ -52,22 +53,22 @@ jobs:
- name: "Prepare tools & dependencies"
shell: bash
run: |
source $CI_PROJECT_ROOT/ci/micropython.sh && ci_debug
source $CI_PROJECT_ROOT/ci/micropython.sh
mkdir -p $CI_BUILD_ROOT
ci_apt_install_build_deps
ci_prepare_all
- name: "MicroPython: Configure"
shell: bash
run: |
source $CI_PROJECT_ROOT/ci/micropython.sh && ci_debug
source $CI_PROJECT_ROOT/ci/micropython.sh
micropython_version
ci_cmake_configure ${{ matrix.name }}
- name: "MicroPython: Build"
shell: bash
run: |
source $CI_PROJECT_ROOT/ci/micropython.sh && ci_debug
source $CI_PROJECT_ROOT/ci/micropython.sh
python3 -m venv "$CI_BUILD_ROOT/.dir2uf2"
source "$CI_BUILD_ROOT/.dir2uf2/bin/activate"
ci_cmake_build ${{ matrix.name }}
Expand Down
26 changes: 15 additions & 11 deletions ci/micropython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ PIMORONI_PICO_VERSION="feature/picovector2-and-layers"
PY_DECL_VERSION="v0.0.3"
DIR2UF2_VERSION="v0.0.9"

if [ -z ${CI_PROJECT_ROOT+x} ]; then
SCRIPT_PATH="$(dirname $0)"
CI_PROJECT_ROOT=$(realpath "$SCRIPT_PATH/..")
fi

if [ -z ${CI_BUILD_ROOT+x} ]; then
CI_BUILD_ROOT=$(pwd)
fi


function log_success {
echo -e "$(tput setaf 2)$1$(tput sgr0)"
Expand Down Expand Up @@ -102,15 +93,16 @@ function ci_cmake_configure {
BOARD=$1
TOOLS_DIR="$CI_BUILD_ROOT/tools"
MICROPY_BOARD_DIR=$CI_PROJECT_ROOT/boards/$BOARD
if [ ! -f "$MICROPY_BOARD_DIR/usermodules.cmake" ]; then
log_warning "Invalid board: $MICROPY_BOARD_DIR"
if [ ! -f "$MICROPY_BOARD_DIR/mpconfigboard.h" ]; then
log_warning "Invalid board: \"$BOARD\". Run with ci_cmake_configure <board_name>."
return 1
fi
BUILD_DIR="$CI_BUILD_ROOT/build-$BOARD"
cmake -S $CI_BUILD_ROOT/micropython/ports/rp2 -B "$BUILD_DIR" \
-DPICOTOOL_FORCE_FETCH_FROM_GIT=1 \
-DPICO_BUILD_DOCS=0 \
-DPICO_NO_COPRO_DIS=1 \
-DPICOTOOL_FETCH_FROM_GIT_PATH="$TOOLS_DIR/picotool" \
-DPIMORONI_PICO_PATH="$CI_BUILD_ROOT/pimoroni-pico" \
-DPIMORONI_TOOLS_DIR="$TOOLS_DIR" \
-DUSER_C_MODULES="$MICROPY_BOARD_DIR/usermodules.cmake" \
Expand All @@ -123,6 +115,10 @@ function ci_cmake_configure {
function ci_cmake_build {
BOARD=$1
MICROPY_BOARD_DIR=$CI_PROJECT_ROOT/boards/$BOARD
if [ ! -f "$MICROPY_BOARD_DIR/mpconfigboard.h" ]; then
log_warning "Invalid board: \"$BOARD\". Run with ci_cmake_build <board_name>."
return 1
fi
BUILD_DIR="$CI_BUILD_ROOT/build-$BOARD"
ccache --zero-stats || true
cmake --build $BUILD_DIR -j 2
Expand All @@ -136,3 +132,11 @@ function ci_cmake_build {
cp "$BUILD_DIR/firmware-with-filesystem.uf2" $BOARD-with-filesystem.uf2
fi
}

if [ -z ${CI_USE_ENV+x} ] || [ -z ${CI_PROJECT_ROOT+x} ] || [ -z ${CI_BUILD_ROOT+x} ]; then
SCRIPT_PATH="$(dirname $0)"
CI_PROJECT_ROOT=$(realpath "$SCRIPT_PATH/..")
CI_BUILD_ROOT=$(pwd)
fi

ci_debug

0 comments on commit 9525624

Please sign in to comment.