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 }}
Comment on lines +10 to +13

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.

Since wheels needs sdist, perhaps the wheels job should be underneath sdist?

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 }}
98 changes: 77 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,102 @@ name: Test
on:
push:
branches:
- main
- "**"
pull_request:
workflow_dispatch:
workflow_call:

jobs:
# Build Python package
source-tests:
name: Source 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"
- os: ubuntu-latest
python-version: "3.14"
- os: ubuntu-24.04-arm
python-version: "3.14"
- os: windows-latest
python-version: "3.14"
- os: macos-15-intel
python-version: "3.14"
- os: macos-latest
python-version: "3.14"
steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}

- uses: dtolnay/rust-toolchain@stable

- name: Install from source
run: |
python -m pip install --upgrade pip
python -m pip install --pre -e ".[test]"

- name: Run pytest
run: python -m pytest -v -ra -W error --pyargs ewoksdraw

# Build and test release artifacts only on main.
build:
uses: ewoks-kit/.github/.github/workflows/python-build.yml@main
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/build.yml

# Run tests
tests:
wheel-tests:
if: github.ref == 'refs/heads/main'
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: Wheel 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: ""

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

- os: ubuntu-24.04-arm
python-version: "3.14"

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

- os: macos-15-intel
python-version: "3.14"

- os: macos-latest
python-version: "3.14"
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
Comment thread
LudoBroche marked this conversation as resolved.
shell: bash
run: |
python -m pip install --upgrade pip
pip install --pre "$(ls dist/*.whl)[test]"

- name: Run pytest
run: pytest -v -ra -W error --pyargs ewoksdraw

# Run linter / checks
checks:
Expand All @@ -52,7 +108,7 @@ jobs:
# branch protection never needs updating when jobs/matrix entries change.
ci-gate:
name: CI gate
needs: [build, tests, checks]
needs: [build, source-tests, wheel-tests, checks]
if: always()
runs-on: ubuntu-latest
steps:
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/*
46 changes: 25 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
### General guidelines
# Contributing

<a href="https://github.com/ewoks-kit/.github/blob/main/shared/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>
[General guidelines](https://github.com/ewoks-kit/.github/blob/main/shared/CONTRIBUTING.md)

### Pixi
## Pixi

This project is managed by [Pixi](https://pixi.prefix.dev/) with a single environment (`default`).
### Development setup

We reproduce below the most relevant commands. For more, see [Pixi's Getting Started](https://pixi.prefix.dev/latest/getting_started/)
Prerequisites:

#### Install the project
- Stable [Rust](https://rustup.rs/) with `cargo` and `rustfmt` on `PATH`.
- Native compiler/linker: `build-essential` on Debian/Ubuntu, Xcode Command Line
Tools on macOS, or Visual Studio C++ Build Tools with Windows SDK on Windows.

From the repository root:

```bash
pixi install
pixi update
```

#### Run the tests
Pixi installs the development dependencies and builds the Rust extension in
editable mode. Release wheels are not used for this checkout.

### Run tests and checks

```bash
pixi run test
Expand All @@ -25,25 +31,23 @@ pixi run typecheck
pixi run full-ci
```

#### Run the example
### Run the example

Turn a workflow into a SVG

```
```bash
pixi run graph-to-svg <workflow_path>
```

If `workflow_name` is not given, `ewoksdraw` will use a test workflow.


#### Add dependencies
### Manage dependencies

```bash
pixi add <package_name>
pixi update
pixi add <package_name> # Conda
pixi add --pypi <package_name> # PyPI
```

By default, this will install the conda package (if there is one). To install from PyPI:
## Updating elk-rs

```bash
pixi add --pypi <package_name>
```
When updating the elk-rs revision in `rust/Cargo.toml`, update the revision
and source links in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and the
copies of the upstream [license](LICENSES/elk-rs/LICENSE) and
[attribution notice](LICENSES/elk-rs/NOTICE) together.
Loading
Loading