From 2f798b9cb1c698f33eb40f5007097c11d5255233 Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Tue, 29 Aug 2023 16:40:36 +0100 Subject: [PATCH] Check wheel build in test --- .github/workflows/tests.yml | 40 ++++++++++++++++++---- .github/workflows/wheels.yml | 22 +++--------- requirements/CI-tests-pip/requirements.txt | 5 ++- 3 files changed, 42 insertions(+), 25 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3f8fdfb..17edaa9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,8 +19,9 @@ jobs: with: python-version: '3.10' - uses: pre-commit/action@v3.0.0 + test: - name: Python + name: Unit tests runs-on: ubuntu-latest strategy: matrix: @@ -39,17 +40,42 @@ jobs: - name: Install dependencies run: | python3 -m pip install --upgrade pip - pip install pytest - pip install pytest-cov - pip install pytest-xdist - pip install -r requirements/CI-tests-pip/requirements.txt + python3 -m pip install -r requirements/CI-tests-pip/requirements.txt - name: Test with pytest run: | pytest --cov=tstrait --cov-report=xml --cov-branch -n 0 tests - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 - env: + env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Delete coverage run: | - rm .coverage \ No newline at end of file + rm .coverage + + dist: + name: Distribution + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10"] + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install build twine + - name: Build sdist and wheel + python -m build + - name: Check distribution artefacts + python3 -m twine check dist/* + - name: Install wheel and import + python3 -m pip install dist/*.whl + python3 -c "import tstrait" diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index e9f1fde..e04a76b 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -24,26 +24,14 @@ jobs: with: python-version: 3.8 - - name: Build sdist + - name: Build wheel and sdist shell: bash run: | - python setup.py sdist + python -m build - - name: Upload sdist + - name: Upload wheel and sdist uses: actions/upload-artifact@v2 with: - name: sdist - path: dist - - - name: Build wheels in docker - shell: bash - run: | - docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2010_x86_64 bash .github/workflows/docker/buildwheel.sh - - - name: Upload Wheels - uses: actions/upload-artifact@v2 - with: - name: wheels path: dist OSX-test: @@ -51,7 +39,7 @@ jobs: runs-on: macos-latest strategy: matrix: - python: [3.7, 3.8, 3.9] + python: [3.8, 3.9, "3.10", "3.11"] steps: - name: Download wheels uses: actions/download-artifact@v2 @@ -73,7 +61,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python: [3.7, 3.8, 3.9] + python: [3.8, 3.9, "3.10", "3.11"] wordsize: [64] steps: - name: Download wheels diff --git a/requirements/CI-tests-pip/requirements.txt b/requirements/CI-tests-pip/requirements.txt index 4660244..e5bd405 100644 --- a/requirements/CI-tests-pip/requirements.txt +++ b/requirements/CI-tests-pip/requirements.txt @@ -3,4 +3,7 @@ numba numpy pandas scipy -tskit>=0.5.5 \ No newline at end of file +tskit>=0.5.5 +pytest +pytest-cov +pytest-xdist