From c9103e3dd8a813f0af78644c6cb45a6457700534 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Mon, 6 Nov 2023 18:36:36 -0500 Subject: [PATCH] ci: use reusable test workflow (#215) * ci: try resuable * style: [pre-commit.ci] auto fixes [...] * remove x * fix cov * update * update --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/test_and_deploy.yml | 122 +++++++------------------- pyproject.toml | 5 +- 2 files changed, 35 insertions(+), 92 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 2e26b9d4..69176eca 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -6,19 +6,23 @@ concurrency: on: push: - branches: - - main - tags: - - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + branches: [main] + tags: [v*] pull_request: - branches: - - main workflow_dispatch: + schedule: + - cron: "0 0 * * 0" # run weekly jobs: test: - name: ${{ matrix.platform }} py${{ matrix.python-version }} ${{ matrix.backend }} - runs-on: ${{ matrix.platform }} + name: Test + uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v1 + with: + os: ${{ matrix.platform }} + python-version: ${{ matrix.python-version }} + qt: ${{ matrix.backend }} + pip-install-pre-release: ${{ github.event_name == 'schedule' }} + report-failures: ${{ github.event_name == 'schedule' }} strategy: fail-fast: false matrix: @@ -62,96 +66,34 @@ jobs: platform: ubuntu-latest backend: "pyqt5==5.14.*" - steps: - - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - uses: tlambert03/setup-qt-libs@v1.4 - - - name: Linux opengl - if: runner.os == 'Linux' && ( startsWith(matrix.backend, 'pyside6') || startsWith(matrix.backend, 'pyqt6') ) - run: sudo apt-get install -y libopengl0 libegl1-mesa libxcb-xinput0 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -e .[test] - python -m pip install ${{ matrix.backend }} - - - name: Test - uses: aganders3/headless-gui@v1.2 - with: - run: python -m pytest --color=yes --cov=superqt --cov-report=xml - - - name: Coverage - uses: codecov/codecov-action@v3 - - test_old_qtpy: - name: qtpy minreq - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: tlambert03/setup-qt-libs@v1.4 - - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: install - run: | - python -m pip install -U pip - python -m pip install -e .[test,pyqt5] - python -m pip install qtpy==1.1.0 typing-extensions==3.7.4.3 - - - name: Test - uses: aganders3/headless-gui@v1.2 - with: - run: python -m pytest --color=yes + test-qt-minreqs: + uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v1 + with: + python-version: "3.8" + qt: pyqt5 + pip-post-installs: 'qtpy==1.1.0 typing-extensions==3.7.4.3' test_napari: - name: napari tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - path: superqt - - - uses: actions/checkout@v4 - with: - repository: napari/napari - path: napari-repo - fetch-depth: 2 - - - uses: tlambert03/setup-qt-libs@v1 - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: install - run: | - python -m pip install -U pip - python -m pip install ./superqt - python -m pip install ./napari-repo[testing,pyqt5] - - - name: Test napari - uses: aganders3/headless-gui@v1.2 - with: - working-directory: napari-repo - run: python -m pytest --color=yes napari/_qt + uses: pyapp-kit/workflows/.github/workflows/test-dependents.yml@v1 + with: + dependency-repo: napari/napari + dependency-ref: ${{ matrix.napari-version }} + dependency-extras: 'testing' + qt: ${{ matrix.qt }} + pytest-args: 'napari/_qt -k "not async and not qt_dims_2"' + python-version: "3.10" + strategy: + fail-fast: false + matrix: + napari-version: ["", "v0.4.18"] + qt: ["pyqt5", "pyside2"] check-manifest: name: Check Manifest runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - run: pip install check-manifest && check-manifest + - run: pipx run check-manifest deploy: # this will run when you have tagged a commit, starting with "v*" diff --git a/pyproject.toml b/pyproject.toml index 08cf5f68..6d202505 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -186,7 +186,7 @@ allow_redefinition = true # https://coverage.readthedocs.io/en/6.4/config.html [tool.coverage.run] -source = ["src/superqt"] +source = ["superqt"] [tool.coverage.report] exclude_lines = [ @@ -194,7 +194,8 @@ exclude_lines = [ "if TYPE_CHECKING:", "@overload", "except ImportError", - "\\.\\.\\." + "\\.\\.\\.", + "pass" ] # https://github.com/mgedmin/check-manifest#configuration