Skip to content
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

🧮 Environment-specific-testing for full frontend dependency control #2073

Draft
wants to merge 24 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
160 changes: 111 additions & 49 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,11 @@ on:
- 'pre/*'

jobs:

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
submodules: 'recursive'
- name: Test pre-commit hooks
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit run # this should be really more agressive

build:
name: Python ${{ matrix.python-version }} - ${{ matrix.platform }}
nox-tests:
name: nox-${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
platform: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
Expand All @@ -42,41 +25,120 @@ jobs:
MPLBACKEND: agg

steps:
- uses: actions/checkout@v4
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python Interpreters
uses: actions/setup-python@v5
with:
python-version: |
3.9
3.10
3.11
3.12

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true
# Have a poetry installation available
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true

# Create virtual environment for the `nox` testing suite
- name: Create virtual environment
run: |
python -m venv .venv
source .venv/bin/activate || .venv\\Scripts\\activate
python -m pip install --upgrade pip
# Note we're installing the test configuration
# in order to pyproject.toml manage these deps
pip install -e .[test]

# Verify installation
- name: Verify installation
run: |
source .venv/bin/activate || .venv\\Scripts\\activate
pip list

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run `nox` testing configuration
run: |
source .venv/bin/activate || .venv\\Scripts\\activate
nox


#pre-commit:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.11"
# submodules: 'recursive'
# - name: Test pre-commit hooks
# run: |
# python -m pip install --upgrade pip
# pip install pre-commit
# pre-commit run # this should be really more agressive

#build:
# name: Test OS ${{ matrix.platform }}
# runs-on: ${{ matrix.platform }}
# strategy:
# matrix:
# platform: [ubuntu-latest, windows-latest, macos-latest]
# defaults:
# run:
# shell: bash
# env: # Set environment variables for the whole job
# PIP_ONLY_BINARY: gdstk
# MPLBACKEND: agg

# steps:
# - uses: actions/checkout@v4

# #----------------------------------------------
# # ----- install & configure poetry -----
# #----------------------------------------------
# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
# version: 1.8.2
# virtualenvs-create: true
# virtualenvs-in-project: true

# - uses: wntrblm/[email protected]
# with:
# python-versions: "3.9, 3.10, 3.11, 3.12"
#
# - name: Install Extra Dependencies
# run: |
# pip install nox-poetry

# - name: Run nox
# run: |
# nox
#
# #----------------------------------------------
# # install your root project, if required
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: |
poetry --version
poetry env use python
poetry env info
poetry run pip install --upgrade pip wheel setuptools
poetry run pip install gdstk --only-binary gdstk
poetry install -E dev
# - name: Install library
# run: |
# poetry --version
# poetry env use python
# poetry env info
# poetry run pip install --upgrade pip wheel setuptools
# poetry run pip install gdstk --only-binary gdstk
# poetry install -E dev

#----------------------------------------------
# add matrix specifics and run test suite
#----------------------------------------------
- name: Run tests
run: |
poetry run ruff format . --check --diff
poetry run ruff check tidy3d --fix --exit-non-zero-on-fix
poetry run pytest -rA tests
poetry run pytest -rA tests/_test_data/_test_datasets_no_vtk.py
#- name: Run tests
# run: |
# poetry run ruff format . --check --diff
# poetry run ruff check tidy3d --fix --exit-non-zero-on-fix
# poetry run pytest -rA tests
# poetry run pytest -rA tests/_test_data/_test_datasets_no_vtk.py
11 changes: 11 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from nox_poetry import session

@session(python=["3.9", "3.10", "3.11", "3.12"])
def tests(session):
session.install('.')
session.run('pytest')

@session
def lint(session):
session.install('flake8')
session.run('flake8', '--import-order-style', 'google')
Loading
Loading