Skip to content

Commit

Permalink
Fix artifact creation, modernise tooling (#51)
Browse files Browse the repository at this point in the history
* Attempt to fix artifact creation

* Even more unique

* Try to test built wheels

* Try again

* Try again

* Pass location of tox.ini

* Minimise test requirements

* Different way of getting test requirements

* Fix typo

* Switch to uv

* Explicitly install uv too

* Don't install pip

* Consolidate configuration into pyproject.toml

* Don't need an issue template

* Consolidate AUTHORS and README

* Ignore uv.lock

* Remove editorconfig and flake8, which wasn't being run

* Simplify post-wheel-build tes

* Sane tracebacks

* Cleaner Makefile

* Try to include C code

* Maybe fix?

* Loosen check for MacOS

* Verbose mode

* Cleaner for `upload_pypi` to depend on the `pass` job

* Try to work around issue

* cleaner

* CONTRIBUTING.rst is too stale

* Add test extra to dev dependencies

* Don't use tox

* Add to history

* `make test` will also sync

* Shouldn't need this extra now

* We don't format with black

* Restore version info to _mt2 module

* Switch to unittest

* Clean up gitignore

* unittest

* See if we can get away without the setuppython step

* Keep $PATH between steps

* Typo

* Try again

* Try to fix windows build

* Try again

* Don't need an author here

* Add pyversions shield
  • Loading branch information
tpgillam committed Aug 20, 2024
1 parent fee3a74 commit 92f15ff
Show file tree
Hide file tree
Showing 20 changed files with 378 additions and 689 deletions.
21 changes: 0 additions & 21 deletions .editorconfig

This file was deleted.

15 changes: 0 additions & 15 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

68 changes: 40 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
name: Build

on: [push, pull_request]
on:
pull_request:
push:
branches: [main]
tags: ["*"]


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


jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -15,22 +21,26 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install & activate
run: |
python -m pip install --upgrade pip
pip install -U -r requirements_dev.txt
pip install tox tox-gh-actions
- name: Test with tox numpy>=2
run: tox -e latestnpy
- name: Test with tox numpy<2
run: tox -e oldestnpy
uv sync --python ${{ matrix.python-version }}
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Test
run: python -m unittest discover tests

- name: Test with oldest-supported-numpy
run: |
uv pip install oldest-supported-numpy
python -m unittest discover tests
build_wheels:
name: Build wheel for ${{ matrix.os }}-cp${{ matrix.python }}-${{ matrix.arch }}
name: Build wheel for ${{ matrix.os }}-${{ matrix.build }}${{ matrix.python }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
# Ensure that a wheel builder finishes even if another fails
Expand All @@ -51,18 +61,20 @@ jobs:
- name: Checkout mt2
uses: actions/checkout@v4

# Used to host cibuildwheel
- name: Setup Python
uses: actions/setup-python@v5
# Needed within cibuildwheel
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- uses: pypa/[email protected]
env:
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_BUILD: "${{ matrix.build }}${{ matrix.python }}*"
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_TEST_COMMAND: python -m unittest discover -t {project} -s {project}/tests

- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
with:
name: "artifact-${{ matrix.os }}-${{ matrix.build }}-${{ matrix.python }}-${{ matrix.arch }}"
path: ./wheelhouse/*.whl

build_sdist:
Expand All @@ -71,20 +83,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.12"
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Install numpy and setuptools
run: python -m pip install numpy setuptools
- name: Install environment & setuptools
run: |
uv sync
uv pip install setuptools
- name: Build sdist
run: python setup.py sdist
run: uv run python setup.py sdist

- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
with:
name: artifact-source
path: dist/*.tar.gz

pass:
Expand All @@ -94,7 +106,7 @@ jobs:
- run: echo "All jobs passed"

upload_pypi:
needs: [build_wheels, build_sdist, test]
needs: [pass]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
Expand All @@ -103,8 +115,8 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
51 changes: 2 additions & 49 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,55 +28,8 @@ wheels/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Rope project settings
.ropeproject

# mypy
.mypy_cache/

# IDE settings
.idea/
.vscode/
# package manager lock file
uv.lock
7 changes: 0 additions & 7 deletions AUTHORS.rst

This file was deleted.

127 changes: 0 additions & 127 deletions CONTRIBUTING.rst

This file was deleted.

1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ History
------------------

* Move support to Python 3.9-3.12. Support numpy 2. Thanks to @lgray
* Various build system & package modernisation.

1.2.0 (2021-05-05)
------------------
Expand Down
11 changes: 0 additions & 11 deletions MANIFEST.in

This file was deleted.

Loading

0 comments on commit 92f15ff

Please sign in to comment.