Skip to content
Closed
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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The versions of the GitHub Actions, one pull request per month for all of them.
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
actions:
patterns: ["*"]
105 changes: 37 additions & 68 deletions .github/workflows/wheels.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,58 @@
# Wheels for Linux (manylinux x86_64 and aarch64), macOS (arm64) and Windows,
# the sdist, tests of the Linux wheel on Fedora and Debian, a source build on Fedora, and the
# msolve build on AlmaLinux 8 (glibc 2.28).
# Documentation goes to Pages from master. A published release builds nothing: it uploads to
# PyPI the wheels and the sdist of the successful push run on the released commit.
# Wheels (manylinux x86_64/aarch64, macOS arm64, Windows) and the sdist, tested by cibuildwheel; the Linux wheel
# also on Fedora and Debian Python, a source build with Fedora compilers, msolve on AlmaLinux 8 (glibc 2.28). Runs
# on build changes, weekly, on demand, and per published release, which uploads the wheels and the sdist to PyPI.
name: wheels

on:
pull_request:
paths:
- cpp/**
- CMakeLists.txt
- pyproject.toml
- src/symident/install.py
- src/symident/tools/**
- .github/workflows/cd.yml
push:
branches: [master]
pull_request:
paths:
- cpp/**
- CMakeLists.txt
- pyproject.toml
- src/symident/install.py
- src/symident/tools/**
- .github/workflows/cd.yml
schedule:
- cron: "0 3 * * 1"
workflow_dispatch:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'release' }}

jobs:
wheels:
name: wheels ${{ matrix.os }}
if: github.event_name != 'release'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- uses: pypa/cibuildwheel@v4.3.5
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl

sdist:
if: github.event_name != 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- run: pipx run build --sdist
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: sdist
path: dist/*.tar.gz
Expand All @@ -46,7 +62,7 @@ jobs:
distro:
needs: wheels
# runs when another platform's wheels failed; it needs only the ubuntu-latest wheel
if: ${{ !cancelled() && github.event_name != 'release' }}
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -62,8 +78,8 @@ jobs:
apt-get update && apt-get install -y --no-install-recommends \
python3 python3-venv ca-certificates
fi
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
name: wheels-ubuntu-latest
path: wheelhouse
Expand All @@ -80,26 +96,24 @@ jobs:

# the msolve build script alone on glibc 2.28, where pthread is not part of libc
msolve-glibc228:
if: github.event_name != 'release'
runs-on: ubuntu-latest
container: almalinux:8
steps:
- name: Install build tools
run: dnf install -y --setopt=install_weak_deps=False gcc make m4 diffutils curl xz tar
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- name: Build msolve
run: SYMIDENT_LIBS_CACHE=/tmp/msolve SYMIDENT_JOBS=4 sh src/symident/tools/build-msolve.sh

# a source install on Fedora's own Python and compilers, as dMod2's CI installs it
fedora:
name: fedora
if: github.event_name != 'release'
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Install Python and the compilers
run: dnf install -y --setopt=install_weak_deps=False python3 python3-devel python3-pip gcc-c++ cmake
- uses: actions/checkout@v5
- uses: actions/checkout@v7
- name: Install from source
run: |
python3 -m venv /opt/venv
Expand All @@ -108,67 +122,22 @@ jobs:
- name: Tests
run: cd /tmp && /opt/venv/bin/python -m pytest -q -n auto "$GITHUB_WORKSPACE/tests"

# the documentation as HTML, built on every run and deployed to Pages from master
docs:
if: github.event_name != 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- run: pip install ".[docs]"
- run: sphinx-build -W -b html docs docs/_build/html
- uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html

pages:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: docs
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- id: deploy
uses: actions/deploy-pages@v4

# the artifacts of this run, uploaded only when every build and test above passed
publish:
needs: [wheels, sdist, distro, msolve-glibc228, fedora]
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
actions: read
steps:
# the successful push run on the released commit, built and tested on every platform
- id: run
env:
GH_TOKEN: ${{ github.token }}
run: |
id=$(gh run list -R "$GITHUB_REPOSITORY" -w wheels.yml -e push -c "$GITHUB_SHA" -s success -L 1 \
--json databaseId -q '.[0].databaseId')
if [ -z "$id" ]; then
echo "::error::no successful push run of wheels.yml on $GITHUB_SHA; rerun it, then this run"
exit 1
fi
echo "id=$id" >> "$GITHUB_OUTPUT"
# the wheels and the sdist only, not the documentation for Pages
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
pattern: wheels-*
path: dist
merge-multiple: true
run-id: ${{ steps.run.outputs.id }}
github-token: ${{ github.token }}
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: sdist
path: dist
run-id: ${{ steps.run.outputs.id }}
github-token: ${{ github.token }}
- uses: pypa/gh-action-pypi-publish@release/v1
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# The pre-commit hooks (ruff, file checks, no em dashes) and the test suite on a source build, on Linux,
# macOS and Windows with the oldest and the newest supported Python.
name: CI

on:
pull_request:
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: pipx run pre-commit run --all-files --show-diff-on-failure

tests:
name: tests ${{ matrix.os }} Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ["3.10", "3.15"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install from source
run: python -m pip install ".[test]"
# outside the checkout, so that the tests import the installed package
- name: Tests
working-directory: ${{ runner.temp }}
run: python -m pytest -q -n auto "${{ github.workspace }}/tests"
54 changes: 54 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# The documentation as HTML with warnings as errors, built on pull requests and deployed to Pages from
# master.
name: docs

on:
pull_request:
paths:
- docs/**
- src/**
- README.md
- pyproject.toml
- .github/workflows/docs.yml
push:
branches: [master]
paths:
- docs/**
- src/**
- README.md
- pyproject.toml
- .github/workflows/docs.yml
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# a deployment to Pages runs to the end
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- run: pip install ".[docs]"
- run: sphinx-build -W -b html docs docs/_build/html
- uses: actions/upload-pages-artifact@v5
with:
path: docs/_build/html

deploy:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- id: deploy
uses: actions/deploy-pages@v5
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# `pre-commit install` runs these on every commit; CI runs them on all files.
exclude: ^tests/data/

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.6
hooks:
- id: ruff-check

- repo: local
hooks:
- id: no-em-dash
name: no em dashes
language: pygrep
entry: "\u2014"
types: [text]
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)
find_package(OpenMP COMPONENTS CXX)
pybind11_add_module(_core cpp/bindings.cpp cpp/kernel.cpp)
pybind11_add_module(_core cpp/bindings.cpp cpp/kernel.cpp cpp/ioproj.cpp)
if(OpenMP_CXX_FOUND)
target_link_libraries(_core PRIVATE OpenMP::OpenMP_CXX)
else()
Expand Down
Loading
Loading