Skip to content

add test for GDSFactory+#192

Open
joamatab wants to merge 19 commits intomainfrom
test_project_in_gfp
Open

add test for GDSFactory+#192
joamatab wants to merge 19 commits intomainfrom
test_project_in_gfp

Conversation

@joamatab
Copy link
Contributor

@joamatab joamatab commented Dec 2, 2025

Summary by Sourcery

Add CI coverage for the gdsfactoryplus (gfp) test command in the GitHub Actions workflow.

CI:

  • Expose GFP_API_KEY from repository secrets as an environment variable for the test workflow.
  • Add a dedicated GitHub Actions job that installs dependencies and runs uv run gfp test on Python 3.12.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 2, 2025

Reviewer's Guide

Updates the GitHub Actions test workflow to inject a GFP API key into the environment and add a dedicated job that installs dependencies and runs the gfp test suite via uv on Python 3.12 Ubuntu runners.

File-Level Changes

Change Details Files
Expose GFP API key in CI environment for subsequent jobs.
  • Define a top-level env block in the test workflow YAML.
  • Map GFP_API_KEY environment variable to the secrets.GFP_API_KEY GitHub secret so jobs can access it.
.github/workflows/test.yml
Add a dedicated GitHub Actions job to run gdsfactoryplus tests via gfp using uv and pytest.
  • Introduce a test_gdsfactoryplus job targeting ubuntu-latest with Python 3.12 in the matrix.
  • Check out the repository and set up Python using actions/setup-python@v6.
  • Install uv via astral-sh/setup-uv@v7.
  • Install project dependencies using make install with a bash login shell.
  • Execute uv run gfp test as the main test command for this job.
.github/workflows/test.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the ci Pull requests that update GitHub Actions code label Dec 2, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Consider scoping GFP_API_KEY to just the test_gdsfactoryplus job (or even a single step) instead of defining it at the workflow level, to minimize exposure of the secret.
  • The matrix definition in test_gdsfactoryplus only has one Python version and one OS; if you don't plan to expand it, you can simplify by inlining python-version: 3.12 and runs-on: ubuntu-latest without a matrix.
  • If test_gdsfactoryplus depends on the other test jobs completing successfully, consider adding a needs: clause so its execution order is explicit and future changes to the workflow don't accidentally change behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider scoping `GFP_API_KEY` to just the `test_gdsfactoryplus` job (or even a single step) instead of defining it at the workflow level, to minimize exposure of the secret.
- The `matrix` definition in `test_gdsfactoryplus` only has one Python version and one OS; if you don't plan to expand it, you can simplify by inlining `python-version: 3.12` and `runs-on: ubuntu-latest` without a matrix.
- If `test_gdsfactoryplus` depends on the other test jobs completing successfully, consider adding a `needs:` clause so its execution order is explicit and future changes to the workflow don't accidentally change behavior.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@joamatab joamatab requested a review from nikosavola December 3, 2025 01:31
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Dec 3, 2025
@joamatab joamatab changed the title add test for gfp add test for GDSFactory+ Dec 3, 2025
Updated Python version handling and improved workflow steps.
@nikosavola nikosavola force-pushed the test_project_in_gfp branch 2 times, most recently from 9135993 to 77f20c9 Compare December 3, 2025 08:57
@github-actions github-actions bot removed the dependencies Pull requests that update a dependency file label Feb 4, 2026
@claude
Copy link
Contributor

claude bot commented Feb 20, 2026

CI Workflow Review

Secret scope too broad

GFP_API_KEY is set at the workflow env level, which makes it available to every job — including pre-commit, test-code, and test-code-result. Code running inside test-code (e.g., just test) could read this secret. Move it to the test-gdsfactoryplus job's own env block.

Job will fail on fork PRs / missing secret

When the secret is not configured (fork PRs, new contributors), uv run gfp test will likely fail with an authentication error rather than being skipped. Add a skip condition using an env var intermediate:

test-gdsfactoryplus:
  env:
    GFP_API_KEY: ${{ secrets.GFP_API_KEY }}
  if: env.GFP_API_KEY != ''

Note: GitHub does not allow direct secret references in if: conditions — the env var intermediary is the standard workaround.

Missing install step

test-code runs just install before testing; test-gdsfactoryplus goes straight to uv run gfp test. If gfp is not a standalone uv tool and requires the project dependencies, the step will fail. Even if it works today, an explicit install step documents the expected environment and keeps the job consistent with test-code.

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Feb 20, 2026
@claude
Copy link
Contributor

claude bot commented Feb 20, 2026

Review notes

Missing result aggregation for the new matrix job

The existing test-code matrix has a companion test-code-result job that fans-in the matrix results into a single status. The new test-gdsfactoryplus matrix job has no equivalent aggregator.

Without this, branch protection rules that require a specific named check to pass will see a per-shard set of statuses rather than one conclusive result. Consider adding a test-gdsfactoryplus-result job mirroring the pattern already used by test-code-result.

@nikosavola
Copy link
Member

nikosavola commented Feb 20, 2026

@joamatab @flaport Have you encountered the following error? Oddly enough this doesn't happen with macOS + Python 3.12, all others fail.

╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /Users/runner/work/quantum-rf-pdk/quantum-rf-pdk/.venv/lib/python3.13/site-p │
│ ackages/gdsfactoryplus/cli_test.py:66 in do_test                             │
│                                                                              │
│    63 │   │   )                                                              │
│    64 │   │   raise typer.Exit(1)                                            │
│    65 │                                                                      │
│ ❱  66 │   gfp_pdk.register_cells()                                           │
│    67 │                                                                      │
│    68 │   # Parse skip list                                                  │
│    69 │   if skip:                                                           │
│                                                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │   exitfirst = False                                                      │ │
│ │     keyword = ''                                                         │ │
│ │  no_capture = False                                                      │ │
│ │ project_dir = PosixPath('/Users/runner/work/quantum-rf-pdk/quantum-rf-p… │ │
│ │        skip = ''                                                         │ │
│ │     verbose = False                                                      │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│                                                                              │
│ in gdsfactoryplus.core.pdk.register_cells:110                                │
│                                                                              │
│ in gdsfactoryplus.core.pdk.get_pdk:51                                        │
│                                                                              │
│ in gdsfactoryplus.core.pdk.get_base_pdk:65                                   │
│                                                                              │
│ in gdsfactoryplus.core.pdk._get_pdk:186                                      │
│                                                                              │
│ /Users/runner/work/quantum-rf-pdk/quantum-rf-pdk/.venv/lib/python3.13/site-p │
│ ackages/gdsfactoryplus/settings.py:48 in get_pdk_name                        │
│                                                                              │
│    45                                                                        │
│    46 def get_pdk_name() -> str:                                             │
│    47 │   """Get the name of the pdk used in the project."""                 │
│ ❱  48 │   pdk_name = get_settings().get("pdk", {}).get("name", "")           │
│    49 │   return pdk_name or "generic"                                       │
│    50                                                                        │
│    51                                                                        │
│                                                                              │
│ /Users/runner/work/quantum-rf-pdk/quantum-rf-pdk/.venv/lib/python3.13/site-p │
│ ackages/gdsfactoryplus/settings.py:28 in get_settings                        │
│                                                                              │
│    25 │   2. pyproject.toml ([tool.gdsfactoryplus])                          │
│    26 │   3. ~/.gdsfactory/gdsfactoryplus.toml                               │
│    27 │   """                                                                │
│ ❱  28 │   return _get_settings_rust()                                        │
│    29                                                                        │
│    30                                                                        │
│    31 def get_wls() -> dict:                                                 │
│                                                                              │
│ in gdsfactoryplus.core.lazy.LazyCallable.__call__:118                        │
│                                                                              │
│ in gdsfactoryplus.core.lazy.LazyCallable.unlazy:110                          │
│                                                                              │
│ /opt/homebrew/Cellar/python@3.13/3.13.12_1/Frameworks/Python.framework/Versi │
│ ons/3.13/lib/python3.13/importlib/__init__.py:88 in import_module            │
│                                                                              │
│    85 │   │   │   if character != '.':                                       │
│    86 │   │   │   │   break                                                  │
│    87 │   │   │   level += 1                                                 │
│ ❱  88 │   return _bootstrap._gcd_import(name[level:], package, level)        │
│    89                                                                        │
│    90                                                                        │
│    91 _RELOADING = {}                                                        │
│                                                                              │
│ ╭───────────────── locals ──────────────────╮                                │
│ │   level = 0                               │                                │
│ │    name = 'gdsfactoryplus.gdsfactoryplus' │                                │
│ │ package = None                            │                                │
│ ╰───────────────────────────────────────────╯                                │
│ in _gcd_import:1387                                                          │
│ ╭───────────────── locals ──────────────────╮                                │
│ │   level = 0                               │                                │
│ │    name = 'gdsfactoryplus.gdsfactoryplus' │                                │
│ │ package = None                            │                                │
│ ╰───────────────────────────────────────────╯                                │
│ in _find_and_load:1360                                                       │
│ ╭───────────────── locals ─────────────────╮                                 │
│ │ module = <object object at 0x104d84050>  │                                 │
│ │   name = 'gdsfactoryplus.gdsfactoryplus' │                                 │
│ ╰──────────────────────────────────────────╯                                 │
│ in _find_and_load_unlocked:1324                                              │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │         child = 'gdsfactoryplus'                                         │ │
│ │          name = 'gdsfactoryplus.gdsfactoryplus'                          │ │
│ │        parent = 'gdsfactoryplus'                                         │ │
│ │ parent_module = <module 'gdsfactoryplus' from                            │ │
│ │                 '/Users/runner/work/quantum-rf-pdk/quantum-rf-pdk/.venv… │ │
│ │   parent_spec = ModuleSpec(name='gdsfactoryplus',                        │ │
│ │                 loader=<_frozen_importlib_external.SourceFileLoader      │ │
│ │                 object at 0x106e07530>,                                  │ │
│ │                 origin='/Users/runner/work/quantum-rf-pdk/quantum-rf-pd… │ │
│ │                 submodule_search_locations=['/Users/runner/work/quantum… │ │
│ │          path = [                                                        │ │
│ │                 │                                                        │ │
│ │                 '/Users/runner/work/quantum-rf-pdk/quantum-rf-pdk/.venv… │ │
│ │                 ]                                                        │ │
│ │          spec = None                                                     │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────╯
ModuleNotFoundError: No module named 'gdsfactoryplus.gdsfactoryplus'
Error: Process completed with exit code 1.

Copilot AI and others added 2 commits February 28, 2026 09:33
@nikosavola
Copy link
Member

Now It's failing on 3.13 but not 3.12

[tool.gdsfactoryplus]
name = "qpdk"

[tool.gdsfactoryplus]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate [tool.gdsfactoryplus] table header. TOML does not allow the same table to be defined more than once — this is a spec violation and will cause parsers (e.g. tomllib, tombi) to error or silently drop one of the entries.

The original [tool.gdsfactoryplus] section already exists at line 65. The duplicate block here should be removed; all keys (name, drc, sim.x, pdk) belong to a single [tool.gdsfactoryplus] table and its sub-tables, which are already present below.

Suggested change
[tool.gdsfactoryplus]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Pull requests that update GitHub Actions code dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants