Release Tests #2056
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Tests | |
on: | |
schedule: | |
- cron: 16 6 * * * | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
attest: | |
description: "Attest the created package using GitHub attestations." | |
default: "false" | |
type: string | |
# cancels running CI if new commit is pushed to branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
LATEST_PYTHON_VER: 3.12 | |
LATEST_QBT_VER: v5.0.2 | |
QBITTORRENTAPI_HOST: localhost:8080 | |
QBITTORRENTAPI_USERNAME: admin | |
QBITTORRENTAPI_PASSWORD: adminadmin | |
FORCE_COLOR: 1 | |
jobs: | |
verify: | |
name: Get Ready | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
outputs: | |
python-latest-version: ${{ steps.set-outputs.outputs.python-latest-version }} | |
qbittorrent-latest-version: ${{ steps.set-outputs.outputs.qbittorrent-latest-version }} | |
qbittorrent-host: ${{ steps.set-outputs.outputs.qbittorrent-host }} | |
qbittorrent-username: ${{ steps.set-outputs.outputs.qbittorrent-username }} | |
qbittorrent-password: ${{ steps.set-outputs.outputs.qbittorrent-password }} | |
steps: | |
- name: Declare Outputs | |
id: set-outputs | |
run: | | |
echo "python-latest-version=${{ env.LATEST_PYTHON_VER }}" | tee -a ${GITHUB_OUTPUT} | |
echo "qbittorrent-latest-version=${{ env.LATEST_QBT_VER }}" | tee -a ${GITHUB_OUTPUT} | |
echo "qbittorrent-host=${{ env.QBITTORRENTAPI_HOST }}" | tee -a ${GITHUB_OUTPUT} | |
echo "qbittorrent-username=${{ env.QBITTORRENTAPI_USERNAME }}" | tee -a ${GITHUB_OUTPUT} | |
echo "qbittorrent-password=${{ env.QBITTORRENTAPI_PASSWORD }}" | tee -a ${GITHUB_OUTPUT} | |
- name: Checkout Repo | |
uses: actions/checkout@v4.2.2 | |
- name: Set up Python ${{ env.LATEST_PYTHON_VER }} | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: ${{ env.LATEST_PYTHON_VER }} | |
allow-prereleases: true | |
cache: pip | |
check-latest: true | |
cache-dependency-path: ${{ github.workspace }}/pyproject.toml | |
- name: Install | |
run: python -m pip install .[dev] | |
- name: Lint | |
uses: pre-commit/action@v3.0.1 | |
package: | |
####### | |
# Verify build and packaging is successful | |
####### | |
name: Build & Verify Package | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4.2.2 | |
with: | |
fetch-depth: 0 # Fetch all refs so setuptools_scm can generate the correct version number | |
- name: Build & Upload Package | |
uses: hynek/build-and-inspect-python-package@v2.10.0 | |
with: | |
attest-build-provenance-github: ${{ inputs.attest }} | |
Tests-qBittorrent: | |
name: Release Test ${{ needs.verify.outputs.python-latest-version }} - ${{ matrix.QBT_VER }} | |
needs: [ verify, package ] | |
strategy: | |
matrix: | |
QBT_VER: | |
- v4.6.7 | |
- v4.4.4 | |
- v4.3.9 | |
- v4.3.5 | |
- v4.3.4.1 | |
- v4.3.3 | |
- v4.3.2 | |
- v4.3.1 | |
- v4.3.0.1 | |
- v4.2.5 | |
- v4.2.0 | |
- v4.1.6 | |
- v4.1.0 | |
include: | |
- IS_QBT_DEV: false | |
# test dev versions of qBittorrent | |
- QBT_VER: master | |
IS_QBT_DEV: true | |
- QBT_VER: v5_0_x | |
IS_QBT_DEV: true | |
- QBT_VER: v4_6_x | |
IS_QBT_DEV: true | |
uses: ./.github/workflows/test.yml | |
secrets: inherit | |
with: | |
python-version: ${{ needs.verify.outputs.python-latest-version }} | |
qbittorrent-version: ${{ matrix.QBT_VER }} | |
qbittorrent-host: ${{ needs.verify.outputs.qbittorrent-host }} | |
qbittorrent-username: ${{ needs.verify.outputs.qbittorrent-username }} | |
qbittorrent-password: ${{ needs.verify.outputs.qbittorrent-password }} | |
is-qbt-dev: ${{ matrix.IS_QBT_DEV }} | |
Tests-Python: | |
name: Release Test ${{ matrix.PYTHON_VER }} - ${{ needs.verify.outputs.qbittorrent-latest-version }} | |
needs: [ verify, package ] | |
strategy: | |
matrix: | |
PYTHON_VER: [ "3.14", "3.13", "3.12", "3.11", "3.10", "pypy3.10", "3.9" ] | |
uses: ./.github/workflows/test.yml | |
secrets: inherit | |
with: | |
python-version: ${{ matrix.PYTHON_VER }} | |
qbittorrent-version: ${{ needs.verify.outputs.qbittorrent-latest-version }} | |
qbittorrent-host: ${{ needs.verify.outputs.qbittorrent-host }} | |
qbittorrent-username: ${{ needs.verify.outputs.qbittorrent-username }} | |
qbittorrent-password: ${{ needs.verify.outputs.qbittorrent-password }} | |
is-qbt-dev: false | |
coverage: | |
name: Combine & Check Coverage | |
runs-on: ubuntu-latest | |
needs: [ Tests-qBittorrent, Tests-Python ] | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: 3.x | |
- name: Install dev dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
python -m pip install -e .[dev] | |
- name: Retrieve coverage data | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
pattern: coverage-data-* | |
merge-multiple: true | |
- name: Combine coverage | |
run: python -m coverage combine | |
- name: Generate coverage report | |
id: coverage | |
run: | | |
python -m coverage html --skip-covered --skip-empty | |
python -m coverage report --fail-under=100 | |
- name: Upload HTML coverage report | |
if: always() && steps.coverage.outcome == 'failure' | |
uses: actions/upload-artifact@v4.4.3 | |
with: | |
name: html-coverage-report | |
path: ./htmlcov | |
- name: Upload Coverage to Codecov | |
if: contains(fromJson('["push", "pull_request"]'), github.event_name) | |
uses: codecov/codecov-action@v4.6.0 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
install-dev: | |
####### | |
# Verify package can be installed on all platforms | |
####### | |
name: Verify Dev Install | |
needs: [ verify ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4.2.2 | |
- name: Set up Python ${{ env.LATEST_PYTHON_VER }} | |
uses: actions/setup-python@v5.3.0 | |
with: | |
python-version: ${{ env.LATEST_PYTHON_VER }} | |
allow-prereleases: true | |
cache: pip | |
cache-dependency-path: ${{ github.workspace }}/setup.cfg | |
- name: Install in Dev Mode | |
run: | | |
python -m pip install -U pip wheel setuptools | |
python -m pip install -e .[dev] | |
- name: Import Package | |
run: python -c "from qbittorrentapi import Client; assert Client().host == 'localhost:8080'" |