Skip to content

CI: Harden GHA configuration #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Build docs
permissions:
contents: read

on:

Expand All @@ -18,12 +20,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- uses: tlambert03/setup-qt-libs@v1
- uses: tlambert03/setup-qt-libs@19e4ef2d781d81f5f067182e228b54ec90d23b76 # v1

- name: Install Dependencies
run: |
Expand All @@ -32,7 +36,7 @@ jobs:
sudo apt install graphviz --yes

- name: Build Docs
uses: aganders3/headless-gui@v2
uses: aganders3/headless-gui@f85dd6316993505dfc5f21839d520ae440c84816 # v2
with:
run: make html
working-directory: ./docs
Expand All @@ -50,12 +54,14 @@ jobs:
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4.3.0
with:
name: docs

- name: Push to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # v4
with:
folder: html
ssh-key: ${{ secrets.DEPLOY_KEY }}
Expand Down
25 changes: 22 additions & 3 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: tests
permissions:
contents: read

on:
push:
Expand All @@ -17,6 +19,19 @@ concurrency:
cancel-in-progress: true

jobs:
pre-commit:
name: precommit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: "3.x"
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
with:
extra_args: --hook-stage manual --all-files
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
Expand All @@ -28,14 +43,16 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# these libraries enable testing on Qt on linux
- uses: tlambert03/setup-qt-libs@v1
- uses: tlambert03/setup-qt-libs@19e4ef2d781d81f5f067182e228b54ec90d23b76 # v1

# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
Expand All @@ -62,7 +79,7 @@ jobs:
if: ${{ always() }}

- name: Coverage
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5
# Don't run coverage on merge queue CI to avoid duplicating reports
# to codecov. See https://github.com/matplotlib/napari-matplotlib/issues/155
if: github.event_name != 'merge_group'
Expand All @@ -84,6 +101,8 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -99,4 +118,4 @@ jobs:
python -m build .

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
Loading