Skip to content

v2.26.0

v2.26.0 #122

Workflow file for this run

name: Publish Packages
on:
release:
types: [created]
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Require release changelog form
run: |
if grep -q TBD changelog.md; then false; fi
tests:
runs-on: ubuntu-latest
needs: [docs]
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Start MySQL
run: |
sudo /etc/init.d/mysql start
- name: Install dependencies
run: uv sync --all-extras -p ${{ matrix.python-version }}
- name: Wait for MySQL connection
run: |
while ! mysqladmin ping --host=localhost --port=3306 --user=root --password=root --silent; do
sleep 5
done
- name: Pytest / behave
env:
PYTEST_PASSWORD: root
PYTEST_HOST: 127.0.0.1
run: |
uv run tox -e py${{ matrix.python-version }}
# arguably this should be made identical to CI for PRs
- name: Run Style Checks
run: uv run tox -e style
tests-macos:
name: Tests macOS
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up MySQL
run: |
brew install mysql
- name: Start MySQL
run: |
brew services start mysql
- name: Install dependencies
run: uv sync --all-extras -p ${{ matrix.python-version }}
- name: Wait for MySQL connection
run: |
while ! mysqladmin ping --host=localhost --port=3306 --user=root --silent; do
sleep 5
done
- name: Set MySQL test credentials
run: |
$(brew --prefix mysql)/bin/mysqladmin --host=localhost --port=3306 --user=root password root
- name: Pytest / behave
env:
PYTEST_PASSWORD: root
PYTEST_HOST: 127.0.0.1
TERM: xterm
run: |
uv run tox -e py${{ matrix.python-version }}
tests-windows:
name: Tests Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.14']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: 'latest'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: cmd
run: uv sync --all-extras -p ${{ matrix.python-version }}
- name: Set up MySQL
uses: shogo82148/actions-setup-mysql@083ec148d28e62f2b24b8f4541693dfe1d50488d # v1.54.0
with:
mysql-version: '9.7'
root-password: root
- name: Run pytest
env:
PYTEST_PASSWORD: root
PYTEST_HOST: 127.0.0.1
run: |
uv run -- coverage run -m pytest
uv run -- coverage report -m --sort=Miss --skip-covered --skip-empty
tests-wsl:
name: Tests WSL
runs-on: windows-latest
steps:
- uses: vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0
with:
distribution: Ubuntu-24.04
use-cache: 'true'
update: 'false'
additional-packages: |
curl
git
mysql-server
pkg-config
build-essential
python3-pip
- name: Create working directory
shell: wsl-bash {0}
run: |
mkdir -p /root/mycli
- uses: ubuntu/wsl/.github/actions/wsl-checkout@3b7a6b2a43af18aa541eeee1669ac27656630097
with:
distro: Ubuntu-24.04
working-dir: /root/mycli
- name: Install uv
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
env PYTHONPATH=/usr/local/lib/python3.14/site-packages pip install --upgrade --break-system-packages --prefix=/usr uv
- name: Install dependencies
shell: wsl-bash {0}
run: |
export PATH="$HOME/.local/bin:$PATH"
cd /root/mycli
uv sync --all-extras --python 3.14
- name: Start MySQL in WSL
shell: wsl-bash {0}
run: |
sudo service mysql start
- name: Wait for MySQL connection
shell: wsl-bash {0}
run: |
while ! mysqladmin ping --host=localhost --port=3306 --user=root --silent; do
sleep 5
done
- name: Set up MySQL
shell: wsl-bash {0}
run: |
mysqladmin -u root password root
- name: Run pytest
shell: wsl-bash {0}
env:
PYTEST_HOST: 127.0.0.1
PYTEST_USER: root
PYTEST_PASSWORD: root
run: |
export PATH="$HOME/.local/bin:$PATH"
cd /root/mycli
uv run --python 3.14 -- coverage run -m pytest
uv run --python 3.14 -- coverage report -m --sort=Miss --skip-covered --skip-empty
build:
runs-on: ubuntu-latest
needs: [tests, tests-macos, tests-windows, tests-wsl]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.14'
- name: Install dependencies
run: uv sync --all-extras -p 3.14
- name: Build
run: uv build
- name: Store the distribution packages
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: python-packages
path: dist/
publish-pypi:
name: Publish Wheel to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
environment: release
permissions:
id-token: write
steps:
- name: Download distribution packages
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: python-packages
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
publish-image:
name: Publish Image to ghcr.io
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
# doesn't actually need the results of build, but it makes sense to run this
# concurrently with publish-pypi
needs: [build]
environment: release
# some of these permissions are probably not needed since attestations
# were removed
permissions:
contents: read
packages: write
attestations: write
id-token: write
artifact-metadata: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# should be needed for multi-arch images
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
env:
# despite this setting, annotations only seem to appear at the index level
# on "docker buildx imagetools inspect"
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Build and push Docker image
id: push
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
file: docker/Dockerfile
push: true
# the linux/arm64 arch will be very slow to build, so it is only made for
# publication, not testing
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}