Skip to content

Hacky way to get Python3.8 compatability #5396

Hacky way to get Python3.8 compatability

Hacky way to get Python3.8 compatability #5396

Workflow file for this run

name: CI/CD
on: push
env:
TERM: linux
TERMINFO: /etc/terminfo
PYTHONIOENCODING: utf-8
jobs:
client-test:
name: Unit tests on ${{ matrix.python-version }} and ${{ matrix.os }} (protobuf=${{ matrix.proto-version }})
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-20.04"]
proto-version: ["latest"]
include:
- os: "macos-12" # x86-64
python-version: "3.10"
proto-version: "latest"
- os: "macos-14" # ARM64 (M1)
python-version: "3.10"
proto-version: "latest"
- os: "windows-latest"
python-version: "3.10"
proto-version: "latest"
- os: "ubuntu-20.04"
python-version: "3.8"
proto-version: "3.19"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-cached-python
with:
version: ${{ matrix.python-version }}
- if: matrix.proto-version != 'latest'
name: Install protobuf
run: pip install protobuf==${{ matrix.proto-version }}
- name: Build protobuf
run: inv protoc
- name: Build client package (installs all dependencies)
run: pip install -e .
- name: Run client tests
run: pytest -v -s
- name: Run docstring tests
run: pytest -s --markdown-docs -m markdown-docs modal
publish-base-images:
name: |
Publish base images for ${{ matrix.image-name }} ${{ matrix.python-version }}
if: github.ref == 'refs/heads/main'
needs: [client-test]
runs-on: ubuntu-20.04
env:
MODAL_LOGLEVEL: DEBUG
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
image-name: ["debian_slim", "conda", "micromamba"]
exclude:
# Exclude base images that currently fail to build becasue multidict,
# a transitive dependency, has not published wheels for Python 3.12:
# https://github.com/aio-libs/multidict/issues/887
- python-version: 3.12
image-name: conda
- python-version: 3.12
image-name: micromamba
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-cached-python
with:
version: ${{ matrix.python-version }}
- name: Build protobuf
run: inv protoc
- name: Build client package (installs all dependencies)
run: pip install -e .
- name: Set the Modal environment
run: modal config set-environment main
- name: Publish base images
run: |
python -m modal_base_images.${{ matrix.image-name }} ${{ matrix.python-version }}
publish-client:
name: Publish client package
# Prevent it from going into an infinite loop.
if: github.actor != 'modal-pr-review-automation[bot]' && github.ref == 'refs/heads/main'
needs: [client-test]
runs-on: ubuntu-20.04
concurrency: publish-client
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Generate token for Github PR Bot
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.GH_PRBOT_APP_ID }}
private_key: ${{ secrets.GH_PRBOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
with:
token: ${{ steps.generate_token.outputs.token }}
- uses: ./.github/actions/setup-cached-python
with:
version: "3.10"
- name: Bump the version number
run: inv update-build-number
- name: Update the changelog
run: inv update-changelog
- uses: EndBug/add-and-commit@v9
with:
add: modal_version/_version_generated.py CHANGELOG.md
message: "[auto-commit] [skip ci] Bump the build number"
pull: "--rebase --autostash"
default_author: github_actions
- name: Build protobuf
run: inv protoc
- name: Install all dependencies
run: pip install -e .
- name: Build type stubs
run: inv type-stubs
- name: Build wheel
run: python setup.py bdist_wheel
- name: Create alias package
run: inv create-alias-package
- name: Build alias package
working-directory: alias-package
run: python setup.py bdist_wheel
- name: Set the Modal environment
run: modal config set-environment main
- name: Publish client mount
env:
MODAL_LOGLEVEL: DEBUG
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}
run: python -m modal_base_images.base_mounts
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/* --non-interactive
- name: Upload alias package to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
working-directory: alias-package
run: twine upload dist/* --non-interactive