Skip to content

Commit

Permalink
Use uv build (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpgillam committed Sep 5, 2024
1 parent 46dc153 commit ad26e9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 28 deletions.
22 changes: 4 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python: [39, 310, 311, 312]

steps:
- uses: actions/checkout@v4

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

- name: Install & activate
run: |
uv sync --python ${{ matrix.python-version }}
. .venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
- name: Test
run: python -m unittest discover tests
run: uv run --python ${{ matrix.python }} python -m unittest discover tests

- name: Test with oldest-supported-numpy
run: |
uv pip install oldest-supported-numpy
python -m unittest discover tests
uv run python -m unittest discover tests
build_wheels:
name: Build wheel for ${{ matrix.os }}-${{ matrix.build }}${{ matrix.python }}-${{ matrix.arch }}
Expand All @@ -61,7 +55,6 @@ jobs:
- name: Checkout mt2
uses: actions/checkout@v4

# Needed within cibuildwheel
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

Expand All @@ -86,13 +79,8 @@ jobs:
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

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

- uses: actions/upload-artifact@v4
with:
Expand All @@ -110,8 +98,6 @@ jobs:
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')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
Expand Down
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,11 @@ clean-venv:
test: install
uv run --locked python -m unittest discover tests

.PHONY: build
build: install
@# Slightly disgusting; just installing the `build` module into the working venv and
@# removing after we're done.
uv pip install build
uv run python -m build
uv pip uninstall build

.PHONY: test_wheel
test_wheel: clean build
@# Build the wheel, then install it and check that we can import it.
test_wheel: clean
@# Build the wheel
uv build
@# Now install it in an isolated directory and check that we can import it.
rm -rf testdir && mkdir testdir
cd testdir && uv venv
cd testdir && uv pip install `find ../dist/ -name *.whl`
Expand Down

0 comments on commit ad26e9e

Please sign in to comment.