Start of move to owned_data being shared between slices. #332
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- stable | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- '**' | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build ${{ matrix.os.name }} ${{ matrix.python.name }} | |
runs-on: ${{ matrix.os.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: 🐧 | |
runs-on: ubuntu-latest | |
- name: 🍎 | |
runs-on: macos-latest | |
- name: 🪟 | |
runs-on: windows-latest | |
python: | |
- name: CPython 3.11 | |
major_dot_minor: '3.11' | |
action: '3.11' | |
- name: CPython 3.12 | |
major_dot_minor: '3.12' | |
action: '3.12' | |
- name: CPython 3.13 | |
major_dot_minor: '3.13' | |
action: '3.13' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v5 | |
with: | |
# This allows the matrix to specify just the major.minor version while still | |
# expanding it to get the latest patch version including alpha releases. | |
# This avoids the need to update for each new alpha, beta, release candidate, | |
# and then finally an actual release version. | |
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.action), matrix.python.action))[startsWith(matrix.python.action, 'pypy')] }} | |
architecture: x64 | |
- name: Setup environment | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build sdist and wheel | |
run: | | |
# Only build sdist on one combination (ubuntu + py3.11) | |
if [[ "${{ matrix.os.runs-on }}" == "ubuntu-latest" && "${{ matrix.python.action }}" == "3.11" ]]; then | |
python -m build --sdist | |
fi | |
python -m build --wheel | |
- name: Publish package files | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages-${{ matrix.os.runs-on }}-${{ matrix.python.action }} | |
path: dist/* | |
if-no-files-found: error | |
test: | |
name: Test ${{ matrix.os.name }} ${{ matrix.python.name }} | |
needs: | |
- build | |
runs-on: ${{ matrix.os.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: 🐧 | |
runs-on: ubuntu-latest | |
- name: 🍎 | |
runs-on: macos-latest | |
- name: 🪟 | |
runs-on: windows-latest | |
python: | |
- name: CPython 3.11 | |
major_dot_minor: '3.11' | |
action: '3.11' | |
- name: CPython 3.12 | |
major_dot_minor: '3.12' | |
action: '3.12' | |
- name: CPython 3.13 | |
major_dot_minor: '3.13' | |
action: '3.13' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: repo | |
- name: Download package files | |
uses: actions/download-artifact@v3 | |
with: | |
name: packages-${{ matrix.os.runs-on }}-${{ matrix.python.action }} | |
path: dist | |
- uses: actions/setup-python@v4 | |
with: | |
architecture: x64 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "0.5.1" | |
- name: Set up environment | |
run: | | |
cd repo | |
uv venv | |
if [[ "$RUNNER_OS" == "Windows" ]]; then | |
source .venv\\Scripts\\activate | |
else | |
source .venv/bin/activate | |
fi | |
- name: Build and test | |
run: | | |
cd repo | |
./build.sh | |
all: | |
name: All successful | |
runs-on: ubuntu-latest | |
# The always() part is very important. | |
# If not set, the job will be skipped on failing dependencies. | |
if: always() | |
needs: | |
# This is the list of CI job that we are interested to be green before | |
# a merge. | |
- build | |
- test | |
steps: | |
- name: Require all successes | |
uses: re-actors/[email protected] | |
with: | |
jobs: ${{ toJSON(needs) }} | |
publish: | |
name: Publish to PyPI | |
needs: [ all ] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Create dist directory | |
run: mkdir -p dist | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts # Download to a temporary directory first | |
- name: Move distribution files to dist | |
run: | | |
mkdir -p dist | |
find artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec mv {} dist/ \; | |
ls -lR artifacts/ # Let's see what files are actually in the artifacts directories | |
echo "Contents of dist directory:" | |
ls -l dist/ | |
# Optional: Test with TestPyPI first | |
- name: Publish to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
verbose: true | |
# Only publish to PyPI if it's not a prerelease version | |
- name: Check if prerelease | |
id: check_prerelease | |
run: | | |
if [[ ${{ github.ref }} =~ .*-alpha|beta|rc.* ]]; then | |
echo "is_prerelease=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_prerelease=false" >> $GITHUB_OUTPUT | |
fi | |
# Publish to actual PyPI only for non-prerelease versions | |
# Disabled for now while I'm testing | |
# - name: Publish to PyPI | |
# if: steps.check_prerelease.outputs.is_prerelease == 'false' | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# password: ${{ secrets.PYPI_API_TOKEN }} | |
# verbose: true |