From 1a7b82e9004b25061e088bae7d448f9a9cd5fbfe Mon Sep 17 00:00:00 2001 From: Oliver Bristow Date: Sun, 16 Nov 2025 16:23:19 +0000 Subject: [PATCH] Align CI workflows with stripzip --- .github/workflows/ci.yml | 64 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 3 +- .github/workflows/test.yml | 34 ------------------- 3 files changed, 65 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..47da777 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI + +on: + push: + branches: + - main + - master + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + strategy: + fail-fast: false + matrix: + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + - "3.14" + - "pypy-3.9" + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y zip p7zip-full + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install . pytest pytest-cov + + - name: Run tests + run: pytest -vv --cov=jsonstore --cov-report=xml --junitxml=test-results.xml + + - name: Upload coverage to Codecov + if: always() && env.CODECOV_TOKEN != '' + uses: codecov/codecov-action@v5 + with: + token: ${{ env.CODECOV_TOKEN }} + files: ./coverage.xml + fail_ci_if_error: true + + - name: Upload test results to Codecov + if: always() && env.CODECOV_TOKEN != '' + uses: codecov/codecov-action@v5 + with: + token: ${{ env.CODECOV_TOKEN }} + files: ./test-results.xml + report_type: test_results + fail_ci_if_error: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 52d9e7c..e789857 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,6 @@ jobs: run: | python -m pip install --upgrade pip build python -m build - # the publishing uses PyPI's trusted publishing, so configured on pypi instead of using secrets + # the publishing uses PyPI's trusted publishing, so configured on pypi instead of using secrets - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index fb1c6e7..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CI - -on: - push: - branches: [master] - pull_request: - -jobs: - test: - runs-on: ubuntu-22.04 - strategy: - matrix: - # the range of versions covered is much less than those claimed to be supported, just - # because it would take getting hands on for CI to cover the old versions that Travis - # previously covered, back when those versions were contemporary. - python-version: ["3.7", "3.13", "3.14-dev"] - 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 - run: | - python -m pip install --upgrade pip - python -m pip install . pytest pytest-cov - - name: Run tests - run: | - pytest -vv --cov=jsonstore - - name: Upload coverage - uses: actions/upload-artifact@v4 - with: - name: coverage-${{ matrix.python-version }} - path: .coverage