Trying a release workflow. #295
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 | |
python: | |
- name: CPython 3.11 | |
major_dot_minor: '3.11' | |
action: '3.11' | |
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: | | |
python -m build | |
- name: Publish package files | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
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 | |
# Removing Windows for now - just need to get the uv venv activated I think. | |
# - 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 | |
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 | |
source .venv/bin/activate | |
- 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/alls-green@v1.2.2 | |
with: | |
jobs: ${{ toJSON(needs) }} |