From ebdbf40344b8b8e96cbc432ceeb832abddc34e7f Mon Sep 17 00:00:00 2001 From: Martin Majlis Date: Fri, 23 Feb 2024 23:09:18 +0100 Subject: [PATCH] Test for more Python versions (#95) * Test for more Python versions * Remove Python 3.13 * Install requirements for building * We have to upgrade setuptools * Also upgrade setuptools for sdist --- .github/workflows/code-quality.yml | 47 ++++++++++++++++++++++++++++-- .github/workflows/deploy.yml | 30 ++++++++++++------- .github/workflows/tox.yml | 3 +- Makefile | 3 ++ requirements-build.txt | 2 ++ tox.ini | 2 +- 6 files changed, 72 insertions(+), 15 deletions(-) create mode 100644 requirements-build.txt diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 602b6b4..306fc2f 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -9,7 +9,8 @@ on: - master jobs: - code-quality-check: + code-quality: + name: Code quality runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -17,7 +18,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.11 - - name: Install pre-commit + cache: "pip" + - name: Install dependencies run: | python -m pip install -U pip make requirements-dev @@ -28,6 +30,47 @@ jobs: - name: Run pre-commit run: | pre-commit run -a + + run-tests: + name: Tests on ${{ matrix.os }} and ${{ matrix.python }} + needs: [code-quality] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: ${{ matrix.python }} + cache: "pip" + - name: Install dependencies + run: | + python -m pip install -U pip + make requirements-dev + make requirements + - name: Code coverage + run: | + make run-tests + + code-coverage: + name: Code coverage + needs: [run-tests, code-quality] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + cache: "pip" + - name: Install dependencies + run: | + python -m pip install -U pip + make requirements-dev + make requirements - name: Code coverage run: | make run-coverage diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 93bbed2..77963ed 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,9 +17,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # os: [windows-latest] os: [ubuntu-latest, windows-latest, macos-latest] - python: ["3.8", "3.9", "3.10", "3.11"] + python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v4 @@ -28,6 +27,7 @@ jobs: name: Install Python with: python-version: ${{ matrix.python }} + cache: "pip" - name: Install Python 3 if: runner.os == 'Windows' @@ -37,17 +37,15 @@ jobs: if: runner.os == 'Windows' run: | choco install visualstudio2019buildtools - # choco install vcredist2015 -f -y - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade setuptools - python -m pip install --upgrade wheel - make requirements-dev + make requirements + make requirements-build + pip install --upgrade setuptools - name: Build wheels run: | pip wheel -w wheelhouse . - # python -m cibuildwheel --output-dir wheelhouse env: CIBW_SKIP: cp27-win* - uses: actions/upload-artifact@v4 @@ -56,8 +54,12 @@ jobs: name: wikipedia-api-${{ matrix.os }}-${{ matrix.python }}.whl build_sdist: - name: Build source distribution - runs-on: ubuntu-latest + name: Build source dist on ${{ matrix.os }} and ${{ matrix.python }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v4 @@ -65,14 +67,20 @@ jobs: name: Install Python with: python-version: ${{ matrix.python }} - + cache: "pip" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + make requirements + make requirements-build + pip install --upgrade setuptools - name: Build sdist run: python setup.py sdist - uses: actions/upload-artifact@v4 with: path: dist/Wikipedia*.tar.gz - name: wikipedia-api-sdist.tar.gz + name: wikipedia-api-${{ matrix.os }}-${{ matrix.python }}.tar.gz upload_pypi: needs: [build_wheels, build_sdist] diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 04771bf..51a11ee 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v4 @@ -15,6 +15,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} + cache: "pip" - name: Install Tox and any other packages run: make requirements-dev - name: Run Tox diff --git a/Makefile b/Makefile index c74b80b..3acb6c5 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,9 @@ requirements: requirements-dev: pip3 install -r requirements-dev.txt +requirements-build: + pip3 install -r requirements-build.txt + pre-release-check: run-type-check run-flake8 run-coverage pypi-html run-tox echo "Pre-release check was successful" diff --git a/requirements-build.txt b/requirements-build.txt new file mode 100644 index 0000000..0392aa4 --- /dev/null +++ b/requirements-build.txt @@ -0,0 +1,2 @@ +setuptools==65.5.0 +wheel==0.42.0 diff --git a/tox.ini b/tox.ini index 8c82528..02b996b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ # Install old pythons # https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa [tox] -envlist = py34, py35, py36, py37, py38, py39, py310, py311 +envlist = py38, py39, py310, py311, py312 [testenv] deps =