Skip to content

Added shift_field and outer_dot_shifted function to ElectroMagneticFi… #6463

Added shift_field and outer_dot_shifted function to ElectroMagneticFi…

Added shift_field and outer_dot_shifted function to ElectroMagneticFi… #6463

Workflow file for this run

name: "tidy3d-frontend-tests"
on:
workflow_dispatch:
push:
branches: [ develop, latest ]
pull_request:
branches:
- latest
- develop
- '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.10"
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
test-latest-submodules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
# This fetches only a single branch by default, so additional fetch is needed
fetch-depth: 0 # Optionally, set to 0 to fetch all history for all branches and tags
- name: Determine current branch or PR ref
id: get_branch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "BRANCH_NAME=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
else
echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
fi
echo $BRANCH_NAME
shell: bash
- name: Initialize and update submodule
run: |
git submodule update --init --recursive
- name: Check if submodules are up to date
shell: bash
run: |
NOTEBOOKS_PATH=docs/notebooks
FAQ_PATH=docs/faq
# Checking out Notebooks submodule with the same branch as the main project
echo "Checking $NOTEBOOKS_PATH for updates..."
cd $NOTEBOOKS_PATH
echo $(git fetch --all --verbose)
echo $(git remote get-url origin)
git checkout origin/$BRANCH_NAME
if git show-ref --verify refs/remotes/origin/$BRANCH_NAME; then
echo "Branch $BRANCH_NAME exists."
else
echo "::error::Branch $BRANCH_NAME does not exist on remote."
exit 1
fi
NOTEBOOKS_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/${{ env.BRANCH_NAME }})
NOTEBOOKS_CURRENT_COMMIT=$(git rev-parse HEAD)
cd ../..
if [ "$NOTEBOOKS_LATEST_COMMIT" != "$NOTEBOOKS_CURRENT_COMMIT" ]; then
echo "::error ::Submodule $NOTEBOOKS_PATH is not up to date with the ${{ env.BRANCH_NAME }} branch. Please update it."
exit 1
else
echo "Submodule $NOTEBOOKS_PATH is up to date with the ${{ env.BRANCH_NAME }} branch."
fi
# Checking FAQs only on the develop branch.
echo "Checking $FAQ_PATH for updates..."
cd $FAQ_PATH
FAQ_LATEST_COMMIT=$(git rev-parse origin/develop)
FAQ_CURRENT_COMMIT=$(git rev-parse HEAD)
cd ../..
if [ "$FAQ_LATEST_COMMIT" != "$FAQ_CURRENT_COMMIT" ]; then
echo "::error ::Submodule $FAQ_PATH is not up to date. Please update it."
exit 1
else
echo "Submodule $FAQ_PATH is up to date."
fi
build:
name: test ${{ matrix.python-version }} - ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
platform: [ubuntu-latest, macos-latest, windows-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: abatilo/actions-poetry@v2
with:
version: 1.7.1
# After installing Poetry add to PATH
- name: Add Poetry's bin directory to PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo $(which poetry)
echo $(poetry --version)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry" # caching poetry dependencies
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: |
poetry --version
poetry install -E dev
#----------------------------------------------
# add matrix specifics and run test suite
#----------------------------------------------
- name: Run tests
run: |
poetry run black . --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