Skip to content

Bump gitpython from 3.1.43 to 3.1.44 #212

Bump gitpython from 3.1.43 to 3.1.44

Bump gitpython from 3.1.43 to 3.1.44 #212

name: Build MicroPython Native Module
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
branches:
- main
pull_request:
jobs:
build:
# explicitly setting due to iffy GA rollout.
# TODO: Revert to `ubuntu-latest` at a future date.
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
micropython_version: ["1.21.0", "1.22.2", "1.23.0"]
ARCH:
- "x86"
- "x64"
- "armv6m"
- "armv7m"
- "armv7emsp"
- "armv7emdp"
- "xtensa"
- "xtensawin"
env:
ARCH: ${{ matrix.ARCH }}
POETRY_HOME: "~/poetry"
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Fixes some bugs on some platforms?
- name: Replace "static const uint8_t" with "const uint8_t"
run: |
find . -type f -name "*.c" -exec sed -i 's/static const uint8_t/const uint8_t/g' {} +
- name: Set up python ${{ matrix.python-version }}
if: env.ARCH != 'xtensa'
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Xtensa dependencies
if: env.ARCH == 'xtensa'
run: |
sudo apt-get update
sudo apt-get install -y \
gperf \
help2man \
libtool-bin \
python3 \
python3-dev
- name: arm-none-eabi-gcc GNU Arm Embedded Toolchain
if: startsWith(env.ARCH, 'arm')
uses: carlosperate/[email protected]
- name: Install Micropython Build Dependencies
run: |
sudo apt-get update && sudo apt-get install gcc-multilib
pip install pyelftools --break-system-packages
- name: Cache Setup Xtensa Toolchain (ESP8266)
if: env.ARCH == 'xtensa'
uses: actions/cache@v4
with:
path: |
esp-open-sdk/xtensa-lx106-elf
key: xtensa-toolchain-${{ hashFiles('**/Makefile') }}
restore-keys: |
xtensa-toolchain-
- name: Clone and build Xtensa toolchain
if: env.ARCH == 'xtensa'
run: |
if [ ! -d "esp-open-sdk" ]; then
git clone --branch fix-ubuntu-21.10-build --recursive https://github.com/BrianPugh/esp-open-sdk.git
cd esp-open-sdk
unset LD_LIBRARY_PATH
make
cd ..
fi
echo "$PWD/esp-open-sdk/xtensa-lx106-elf/bin" >> $GITHUB_PATH
- name: Cache Setup ESP-IDF (ESP32)
if: env.ARCH == 'xtensawin'
uses: actions/cache@v4
with:
path: |
esp-idf
~/.espressif
!esp-idf/.git
key: esp-idf-${{ hashFiles('**/Makefile') }}
restore-keys: |
esp-idf-
- name: Setup ESP-IDF (ESP32)
if: env.ARCH == 'xtensawin'
run: |
if [ ! -d "esp-idf" ]; then
git clone -b v5.0.6 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
git submodule update --init --recursive
./install.sh
cd ..
fi
cd esp-idf
ENV_BEFORE=$(env)
source export.sh
ENV_AFTER=$(env)
echo "$ENV_AFTER" | grep -vxF "$ENV_BEFORE" | grep '=' | while IFS='=' read -r name value
do
echo "exporting to GITHUB_ENV: ${name}=${value}"
echo "${name}=${value}" >> $GITHUB_ENV
done
- name: Install MicroPython
uses: BrianPugh/install-micropython@v2
with:
reference: v${{ matrix.micropython_version }}
- name: Cache Poetry Install
uses: actions/cache@v4
id: cached-poetry
with:
path: ${{ env.POETRY_HOME }}
key: poetry-cache-${{ runner.os }}-${{ env.PYTHON }}-${{ hashFiles('.github/workflows/tests.yaml') }}
- name: Install poetry
uses: snok/install-poetry@v1
if: steps.cached-poetry.outputs.cache-hit != 'true'
- name: Add Poetry to PATH # Needs to be separate from install-poetry because cache.
run: |
echo "$POETRY_HOME/bin" >> $GITHUB_PATH
- name: Configure Poetry # Needs to be separate from install-poetry because cache.
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry config virtualenvs.create false
poetry config virtualenvs.in-project false
- name: Get Tag or Commit Hash
run: |
poetry dynamic-versioning # in-place updates files with correct version string
VERSION=$(poetry version | sed 's/tamp //; s/\x1b\[[0-9;]*m//g')
echo "Detected version is: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
export MICROPYTHON_VERSION=${{ matrix.micropython_version }}
export MICROPYTHON_VERSION_MAJOR_MINOR=${MICROPYTHON_VERSION%.*}
echo "Detected Micropython Major.Minor: $MICROPYTHON_VERSION_MAJOR_MINOR"
echo "MICROPYTHON_VERSION_MAJOR_MINOR=$MICROPYTHON_VERSION_MAJOR_MINOR" >> $GITHUB_ENV
- name: Install library
if: env.ARCH == 'x64'
run: poetry install --no-interaction
- name: Build MicroPython Native Module
run: |
echo "Building architecture $ARCH Complete"
make clean
make ARCH=$ARCH
if [[ "$ARCH" == "x64" ]]; then
cp tamp.mpy tamp_native.mpy
belay run micropython -X heapsize=200M -m unittest tests/test_*.py
rm tamp_native.mpy
fi
mv tamp.mpy tamp-${VERSION}-mpy${MICROPYTHON_VERSION_MAJOR_MINOR}-${ARCH}.mpy
make clean
echo "Building architecture $ARCH Compressor"
make clean
make ARCH=$ARCH TAMP_DECOMPRESSOR=0
if [[ "$ARCH" == "x64" ]]; then
cp tamp.mpy tamp_native.mpy
belay run micropython -X heapsize=200M -m unittest tests/test_compressor.py
rm tamp_native.mpy
fi
mv tamp.mpy tamp[compressor]-${VERSION}-mpy${MICROPYTHON_VERSION_MAJOR_MINOR}-${ARCH}.mpy
make clean
echo "Building architecture $ARCH Decompressor"
make clean
make ARCH=$ARCH TAMP_COMPRESSOR=0
if [[ "$ARCH" == "x64" ]]; then
cp tamp.mpy tamp_native.mpy
belay run micropython -X heapsize=200M -m unittest tests/test_decompressor.py
rm tamp_native.mpy
fi
mv tamp.mpy tamp[decompressor]-${VERSION}-mpy${MICROPYTHON_VERSION_MAJOR_MINOR}-${ARCH}.mpy
make clean
- name: Upload Native Module MPY Files
uses: actions/upload-artifact@v4
with:
name: mpy-native-module-tamp-${{ env.VERSION }}-mpy${{ env.MICROPYTHON_VERSION_MAJOR_MINOR }}-${{ env.ARCH }}
path: "*.mpy"
release_upload:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download All Native Module Artifacts
uses: actions/download-artifact@v4
with:
path: mpy-native-modules
pattern: mpy-native-module-*
merge-multiple: true
- name: Display All Native Module Artifacts
run: ls -alh mpy-native-modules
- name: Upload Single Native Module MPY Archive
uses: actions/upload-artifact@v4
with:
name: mpy-native-module-all
path: "mpy-native-modules/*.mpy"
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
mpy-native-modules/*