Skip to content
Draft
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
14 changes: 14 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
python-lint-test:
name: Python Lint and Test
Expand All @@ -16,6 +19,17 @@ jobs:

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

# tests/test_output.py validates the generated data, which lives in
# napari/plugin-api-data. Only the latest snapshot is needed.
- name: Check out napari/plugin-api-data into public/
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: napari/plugin-api-data
path: public
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ jobs:

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

# The Next.js build reads the generated data, now in napari/plugin-api-data.
- name: Check out napari/plugin-api-data into public/
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: napari/plugin-api-data
path: public
persist-credentials: false

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
Expand Down
33 changes: 29 additions & 4 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
# "every 2 hours"
- cron: 0 */2 * * *

# Two runs must never commit to napari/plugin-api-data at the same time.
concurrency:
group: update-plugin-index-${{ github.event_name == 'pull_request' && github.ref || 'data' }}
cancel-in-progress: false

jobs:
fetch:
name: Fetch
Expand All @@ -20,6 +25,22 @@ jobs:

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

# The generated JSON lives in napari/plugin-api-data. Check it out into
# public/, where every script reads and writes it. DATA_DEPLOY_KEY is a
# deploy key with write access to that repository only; without it (on
# pull requests from forks) the checkout is read-only, which is all a
# pull request needs.
# The deploy key must stay configured for the push at the end of the job.
# Only the built site is uploaded as an artifact, never public/.git.
- name: Check out napari/plugin-api-data into public/
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # zizmor: ignore[artipacked]
with:
repository: napari/plugin-api-data
path: public
ssh-key: ${{ secrets.DATA_DEPLOY_KEY }}
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed

- id: auth
name: Authenticate to Google Cloud
Expand Down Expand Up @@ -55,17 +76,21 @@ jobs:
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}
CODECOV_API_TOKEN: ${{ secrets.CODECOV_API_TOKEN }}

# push changes back to the repo, this will trigger a new vercel build
# Invalid data is never committed or deployed.
- name: Validate the data
run: |
python -m pytest tests/test_output.py -q

# Commit the new data to napari/plugin-api-data. Skip on PRs: they only
# validate.
# https://github.com/stefanzweifel/git-auto-commit-action
# skip on PRs - we only want to validate, not modify the PR
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
if: github.event_name != 'pull_request'
with:
repository: public
commit_message: '[bot] Update Plugin Index'
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# prepare static files for gh-pages deployment
# do this AFTER the vercel commit to make sure we're not messing with anything
- name: Prepare gh-pages
run: |
python scripts/prepare_gh_pages.py
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ yarn-error.log*
# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json
*.pyc

# generated data: a clone of napari/plugin-api-data (see CONTRIBUTING.md)
/public/
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ source .venv/bin/activate
python -m pip install -e ".[dev]"
```

3. Run the development server
3. Get the data. The generated JSON lives in
[napari/plugin-api-data](https://github.com/napari/plugin-api-data). Clone
it into `public/`, where every script expects it. `--depth 1` fetches only
the latest snapshot; leave it out for the full history since 2022 (~230 MB):

```bash
git clone --depth 1 https://github.com/napari/plugin-api-data public
```

4. Run the development server
```bash
npm run dev
```
Expand Down