Skip to content

Publish update for micropython.const #45

Publish update for micropython.const

Publish update for micropython.const #45

Workflow file for this run

# workflow to build packages for PyPI
########################################################################################################################################
# This will attempt to retrieve and generate stubs from MicroPython documentation
########################################################################################################################################
# Check out repos in this structure
# micropython-stubs
# +-- stubs
# +-- repos
# +-- micropython
# -- micropython-lib
# repro structure needed to allow automatic PR creation to work
########################################################################################################################################
name: publish-stubs
on:
workflow_dispatch:
# schedule:
# - cron: "0 1 * * 5" # Run every Friday at 01:00
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
jobs:
########################################################################################################################################
list-versions-pub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# no need to install python
- run: echo Running in folder $(pwd)
- run: pip install pygithub packaging
- run: python .github/workflows/list_versions.py --latest
id: dynamic
outputs:
job_versions: ${{ steps.dynamic.outputs.versions }}
########################################################################################################################################
build-stubs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: list-versions-pub
strategy:
matrix: ${{ fromJSON(needs.list-versions-pub.outputs.job_versions) }}
max-parallel: 1
continue-on-error: true
steps:
- name: Checkout stubs repo
uses: actions/checkout@v3
- name: Install pip and tools to allow to run under ACT for testing
run: |
apt update
# apt upgrade -y
apt install -y python3-pip mc
if: ${{ env.ACT }}
- run: |
pip install wheel
pip install -U micropython-stubber
- run: |
echo Running in folder $(pwd)
stubber --version
stubber clone --no-stubs
- name: Install Poetry
run: pipx install poetry==1.3.1
- run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config --list
# run the build steps for this mpy version
- run: echo "Building stubs for ${{matrix.version}}"
- run: stubber switch ${{matrix.version}}
- run: stubber get-frozen
- run: stubber get-docstubs
- run: stubber merge --version ${{matrix.version}}
- run: |
stubber build --version ${{matrix.version}} --port auto --board GENERIC
stubber build --version ${{matrix.version}} --port esp32 --board UM_TINYPICO
- name: update all_modules.json
run: |
echo "Updating all_modules.json"
# pip install tomli
python3 update_all_modules.py
- name: commit
uses: ./.github/actions/commit
with:
message: "Build stubs for ${{matrix.version}}"
########################################################################################################################################
publish-stubs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: [build-stubs, list-versions-pub]
strategy:
matrix: ${{ fromJSON(needs.list-versions-pub.outputs.job_versions) }}
max-parallel: 1
continue-on-error: true
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
POETRY_PYPI_TOKEN_TEST_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_TEST_PYPI }}
steps:
- name: Checkout stubs repo
uses: actions/checkout@v3
- name: Install pip and tools to allow to run under ACT for testing
if: env.ACT
run: |
apt update
# apt upgrade -y
apt install -y python3-pip
python3 -m pip install --user pipx
python3 -m pipx ensurepath
- name: Install Poetry
run: pipx install poetry~=1.3
- run: |
pip install wheel
pip install -U micropython-stubber
- run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config --list
- run: |
stubber clone
stubber switch ${{matrix.version}}
- name: pull in other changes from the repo
run: git pull origin main
- run: |
stubber publish --version ${{matrix.version}} --port auto --board GENERIC --test-pypi
stubber publish --version ${{matrix.version}} --port esp32 --board UM_TINYPICO --test-pypi
if: env.ACT
- run: |
stubber publish --version ${{matrix.version}} --port auto --board GENERIC --pypi
stubber publish --version ${{matrix.version}} --port esp32 --board UM_TINYPICO --pypi
if: env.ACT == ''
- name: update all_modules.json
run: |
echo "Updating all_modules.json"
# pip install tomli
python3 update_all_modules.py
- name: commit
uses: ./.github/actions/commit
with:
message: "Published stubs for ${{matrix.version}}"