Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build

on:
workflow_call:

jobs:
# Build every wheel from the source distribution that will be published.
# The wheels are abi3 (cp310-abi3): they work with any Python >= 3.10,
# so they do not need to be built per Python version.
wheels:
name: Wheel from sdist (${{ matrix.os }})
needs: sdist
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest # x86_64
manylinux: auto
- os: ubuntu-24.04-arm # aarch64
manylinux: auto
- os: windows-latest
manylinux: "off"
- os: macos-15-intel # x86_64
manylinux: "off"
- os: macos-latest # arm64
manylinux: "off"
steps:
- uses: actions/setup-python@v7
with:
python-version: "3.12"

- uses: actions/download-artifact@v8
with:
name: dist-sdist
path: sdist

- name: Extract source distribution
shell: bash
run: |
mkdir source
tar -xzf sdist/*.tar.gz --directory source --strip-components=1

- uses: PyO3/maturin-action@v1
with:
command: build
working-directory: source
args: --release --out dist
manylinux: ${{ matrix.manylinux }}

- uses: actions/upload-artifact@v7
with:
name: dist-wheel-${{ matrix.os }}
path: source/dist/
if-no-files-found: error

sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist

- uses: actions/upload-artifact@v7
with:
name: dist-sdist
path: dist/

# All wheels + sdist in one artifact, as published to PyPI.
dist:
name: Collect distribution
needs: [wheels, sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
pattern: dist-*
merge-multiple: true
path: dist

- run: ls -l dist

- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
34 changes: 21 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ on:
workflow_dispatch:

jobs:
# Build Python package
build:
uses: ewoks-kit/.github/.github/workflows/python-build.yml@main

# Run tests
# Build the wheels + sdist and run the tests on them
tests:
needs: build
uses: ewoks-kit/.github/.github/workflows/python-tests.yml@main

uses: ./.github/workflows/test.yml
secrets: inherit

# Publish package to TestPyPI
publish-testpypi:
Expand All @@ -23,7 +18,10 @@ jobs:
permissions:
id-token: write
steps:
- uses: ewoks-kit/.github/.github/actions/setup-python-package@main
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
Expand All @@ -37,17 +35,27 @@ jobs:
permissions:
id-token: write
steps:
- uses: ewoks-kit/.github/.github/actions/setup-python-package@main
- uses: actions/download-artifact@v8
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1

# Tag
# Tag (the version is read from the installed Linux wheel)
tag-release:
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: ewoks-kit/.github/.github/actions/setup-python-package@main
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- uses: actions/download-artifact@v8
with:
name: dist-wheel-ubuntu-latest
path: dist
- run: pip install --pre dist/*.whl
- uses: ewoks-kit/.github/.github/actions/tag-release@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
78 changes: 60 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,84 @@ on:
pull_request:
workflow_dispatch:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false

jobs:
# Build Python package
# Build the native wheels and the sdist
build:
uses: ewoks-kit/.github/.github/workflows/python-build.yml@main
uses: ./.github/workflows/build.yml

# Run tests
# Run tests on the wheel built for the platform of each job
tests:
needs: build
uses: ewoks-kit/.github/.github/workflows/python-tests.yml@main
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
enable-coverage: ${{ matrix.enable-coverage }}
jupyter-platform-dirs: "1"
codecov-flags: "unit"
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
env:
JUPYTER_PLATFORM_DIRS: "1"
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: "3.10"
enable-coverage: "false"
extra-pytest-warnings: ""
enable-coverage: false

- os: ubuntu-latest
python-version: "3.14"
enable-coverage: "true"
extra-pytest-warnings: ""
enable-coverage: true

- os: ubuntu-24.04-arm
python-version: "3.14"
enable-coverage: false

- os: windows-latest
python-version: "3.14"
enable-coverage: "false"
extra-pytest-warnings: ""
enable-coverage: false

- os: macos-15-intel
python-version: "3.14"
enable-coverage: false

- os: macos-latest
python-version: "3.14"
enable-coverage: false
steps:
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}

- uses: actions/download-artifact@v8
with:
name: dist-wheel-${{ matrix.os }}
path: dist

# No checkout and no Rust toolchain: only the wheel is tested
- name: Install wheel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not testing the test from the sources anymore?

shell: bash
run: |
python -m pip install --upgrade pip
pip install --pre "$(ls dist/*.whl)[test]"

- name: Run pytest
if: ${{ !matrix.enable-coverage }}
run: pytest -v -ra -W error --pyargs ewoksdraw

- name: Run pytest with coverage
if: ${{ matrix.enable-coverage }}
run: |
pip install pytest-cov "coverage[toml]"
pytest -v -ra -W error --cov=ewoksdraw --cov-report=term --cov-report=xml --pyargs ewoksdraw

- name: Upload coverage to Codecov
if: ${{ matrix.enable-coverage }}
uses: codecov/codecov-action@v7
with:
files: coverage.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

# Run linter / checks
checks:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ __pycache__/
# Distribution / packaging
/build/
/dist/
/rust/target/
*.egg-info/
.eggs/
/doc/_generated
.svg
# pixi environments
.pixi/*
.pixi/*
Loading
Loading