Skip to content

Commit 8a77486

Browse files
committed
Merge branch 'pre/2.6' into develop
2 parents 722ebe6 + d7be8da commit 8a77486

File tree

290 files changed

+19845
-37167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+19845
-37167
lines changed

.binder/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
tidy3d
2+
tmm
3+
nlopt
4+
tqdm
5+
gdspy

.gitattributes

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
# Linguist-vendored files
12
docs/* linguist-vendored
23
notebooks/* linguist-vendored
34
tests/* linguist-vendored
45

6+
# Disable linguist detection for IPython notebooks
57
*.ipynb linguist-detectable=false
8+
9+
# Mark IPython notebooks as generated files
610
*.ipynb linguist-generated=true
711

8-
CHANGELOG.md merge=union
12+
# Specify merge attributes for CHANGELOG.md
13+
CHANGELOG.md merge=union
14+
15+
# Specify diff and merge attributes for IPython notebooks
16+
*.ipynb diff=jupyternotebook
17+
*.ipynb merge=jupyternotebook

.gitconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[diff "jupyternotebook"]
2+
command = git-nbdiffdriver diff
3+
[merge "jupyternotebook"]
4+
driver = git-nbmergedriver merge %O %A %B %L %P
5+
name = jupyter notebook merge driver
6+
[difftool "nbdime"]
7+
cmd = git-nbdifftool diff \"$LOCAL\" \"$REMOTE\" \"$BASE\"
8+
[difftool]
9+
prompt = false
10+
[mergetool "nbdime"]
11+
cmd = git-nbmergetool merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
12+
[mergetool]
13+
prompt = false

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
name: Tidy3d Release
1+
name: "tidy3d-release"
2+
3+
permissions:
4+
contents: write
25

36
on:
47
push:
@@ -12,6 +15,8 @@ jobs:
1215
- uses: actions/checkout@master
1316
- name: Release
1417
uses: softprops/action-gh-release@v1
18+
with:
19+
generate_release_notes: true
1520
env:
1621
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1722
pypi-release:

.github/workflows/run_tests.yml

Lines changed: 124 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tidy3dTests
1+
name: "tidy3d-frontend-tests"
22

33
on:
44
workflow_dispatch:
@@ -10,23 +10,137 @@ on:
1010
- 'pre/*'
1111

1212
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.10"
21+
submodules: 'recursive'
22+
- name: Test pre-commit hooks
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pre-commit
26+
pre-commit run # this should be really more agressive
27+
test-latest-submodules:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository with submodules
31+
uses: actions/checkout@v4
32+
with:
33+
submodules: 'recursive'
34+
# This fetches only a single branch by default, so additional fetch is needed
35+
fetch-depth: 0 # Optionally, set to 0 to fetch all history for all branches and tags
36+
37+
- name: Determine current branch or PR ref
38+
id: get_branch
39+
run: |
40+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
41+
echo "BRANCH_NAME=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
42+
else
43+
echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's|refs/heads/||')" >> $GITHUB_ENV
44+
fi
45+
echo $BRANCH_NAME
46+
shell: bash
47+
48+
- name: Initialize and update submodule
49+
run: |
50+
git submodule update --init --recursive
51+
52+
- name: Check if submodules are up to date
53+
shell: bash
54+
run: |
55+
NOTEBOOKS_PATH=docs/notebooks
56+
FAQ_PATH=docs/faq
57+
58+
# Checking out Notebooks submodule with the same branch as the main project
59+
echo "Checking $NOTEBOOKS_PATH for updates..."
60+
cd $NOTEBOOKS_PATH
61+
echo $(git fetch --all --verbose)
62+
echo $(git remote get-url origin)
63+
git checkout origin/$BRANCH_NAME
64+
if git show-ref --verify refs/remotes/origin/$BRANCH_NAME; then
65+
echo "Branch $BRANCH_NAME exists."
66+
else
67+
echo "::error::Branch $BRANCH_NAME does not exist on remote."
68+
exit 1
69+
fi
70+
NOTEBOOKS_LATEST_COMMIT=$(git rev-parse refs/remotes/origin/${{ env.BRANCH_NAME }})
71+
NOTEBOOKS_CURRENT_COMMIT=$(git rev-parse HEAD)
72+
73+
74+
cd ../..
75+
if [ "$NOTEBOOKS_LATEST_COMMIT" != "$NOTEBOOKS_CURRENT_COMMIT" ]; then
76+
echo "::error ::Submodule $NOTEBOOKS_PATH is not up to date with the ${{ env.BRANCH_NAME }} branch. Please update it."
77+
exit 1
78+
else
79+
echo "Submodule $NOTEBOOKS_PATH is up to date with the ${{ env.BRANCH_NAME }} branch."
80+
fi
81+
82+
# Checking FAQs only on the develop branch.
83+
echo "Checking $FAQ_PATH for updates..."
84+
cd $FAQ_PATH
85+
FAQ_LATEST_COMMIT=$(git rev-parse origin/develop)
86+
FAQ_CURRENT_COMMIT=$(git rev-parse HEAD)
87+
cd ../..
88+
if [ "$FAQ_LATEST_COMMIT" != "$FAQ_CURRENT_COMMIT" ]; then
89+
echo "::error ::Submodule $FAQ_PATH is not up to date. Please update it."
90+
exit 1
91+
else
92+
echo "Submodule $FAQ_PATH is up to date."
93+
fi
1394
build:
1495
name: test ${{ matrix.python-version }} - ${{ matrix.platform }}
1596
runs-on: ${{ matrix.platform }}
1697
strategy:
1798
matrix:
18-
python-version: ['3.8', '3.9', '3.10', '3.11']
99+
python-version: ['3.9', '3.10', '3.11']
19100
platform: [ubuntu-latest, macos-latest, windows-latest]
101+
defaults:
102+
run:
103+
shell: bash
104+
env: # Set environment variables for the whole job
105+
PIP_ONLY_BINARY: gdstk
106+
MPLBACKEND: agg
20107
steps:
21-
- uses: actions/checkout@v1
108+
- uses: actions/checkout@v4
109+
110+
#----------------------------------------------
111+
# ----- install & configure poetry -----
112+
#----------------------------------------------
113+
- name: Install Poetry
114+
uses: abatilo/actions-poetry@v2
115+
with:
116+
version: 1.7.1
117+
118+
# After installing Poetry add to PATH
119+
- name: Add Poetry's bin directory to PATH
120+
run: |
121+
echo "$HOME/.local/bin" >> $GITHUB_PATH
122+
echo $(which poetry)
123+
echo $(poetry --version)
124+
22125
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v2
126+
uses: actions/setup-python@v5
24127
with:
25128
python-version: ${{ matrix.python-version }}
26-
- name: Install dependencies
129+
cache: "poetry" # caching poetry dependencies
130+
131+
#----------------------------------------------
132+
# install your root project, if required
133+
#----------------------------------------------
134+
- name: Install library
135+
run: |
136+
poetry --version
137+
poetry install -E dev
138+
#----------------------------------------------
139+
# add matrix specifics and run test suite
140+
#----------------------------------------------
141+
- name: Run tests
27142
run: |
28-
python -m pip install --upgrade pip
29-
pip install tox-gh-actions
30-
pip install tox
31-
- name: Test with tox
32-
run: tox
143+
poetry run black . --check --diff
144+
poetry run ruff check tidy3d --fix --exit-non-zero-on-fix
145+
poetry run pytest -rA tests
146+
poetry run pytest -rA tests/test_data/_test_datasets_no_vtk.py
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: "sync-to-readthedocs-repo"
2+
permissions:
3+
contents: write
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- latest
9+
- 'pre/*'
10+
- 'v*'
11+
12+
workflow_dispatch:
13+
inputs:
14+
env:
15+
description: environment
16+
default: dev
17+
required: true
18+
jobs:
19+
extract_branch:
20+
outputs:
21+
branch: ${{ steps.extractbranch.outputs.branch }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- id: extractbranch
25+
name: Extract branch name
26+
shell: bash
27+
run: |
28+
echo "::set-output name=branch::${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
29+
echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
30+
echo "${{ steps.extractbranch.outputs.branch }}"
31+
set_env:
32+
needs: extract_branch
33+
outputs:
34+
env: ${{ steps.setenv.outputs.env }}
35+
dest-branch: ${{ steps.dest-branch.outputs.branch }}
36+
runs-on: ubuntu-latest
37+
steps:
38+
- id: setenv
39+
run: |
40+
if [[ "${{ needs.extract_branch.outputs.branch }}" =~ ^v.*$ ]]
41+
then
42+
echo "::set-output name=env::version"
43+
echo "ENV=version" >> $GITHUB_ENV
44+
elif test -n "${{ github.event.inputs.env }}"
45+
then
46+
echo "::set-output name=env::${{ github.event.inputs.env }}"
47+
echo "ENV=${{ github.event.inputs.env }}" >> $GITHUB_ENV
48+
elif test "${{ github.event_name }}" = 'push' -a "${{ github.ref }}" = 'refs/heads/latest'
49+
then
50+
echo "::set-output name=env::dev"
51+
echo "ENV=dev" >> $GITHUB_ENV
52+
elif test "${{ github.event_name }}" = 'push' -a "${{ github.ref }}" = 'refs/heads/main'
53+
then
54+
echo "::set-output name=env::prod"
55+
echo "ENV=prod" >> $GITHUB_ENV
56+
else
57+
echo "::set-output name=env::dev"
58+
echo "ENV=dev" >> $GITHUB_ENV
59+
fi
60+
- id: dest-branch
61+
run: |
62+
echo "The destination branch is ${{ needs.extract_branch.outputs.branch }}"
63+
case ${{ env.ENV }} in
64+
version)
65+
new_branch_name="${{ needs.extract_branch.outputs.branch }}"
66+
echo "::set-output name=branch::${new_branch_name}"
67+
;;
68+
dev)
69+
echo "::set-output name=branch::${{ needs.extract_branch.outputs.branch }}"
70+
;;
71+
prod)
72+
echo "::set-output name=branch::main"
73+
;;
74+
esac
75+
build-and-deploy:
76+
needs: set_env
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v3
81+
with:
82+
submodules: true
83+
- id: clean
84+
run: |
85+
rm -rf .github/ # removes the further triggered github actions.
86+
- name: Create new branch if version pattern
87+
uses: GuillaumeFalourd/[email protected]
88+
with:
89+
repository_owner: flexcompute-readthedocs
90+
repository_name: tidy3d-docs
91+
new_branch_name: ${{ needs.set_env.outputs.dest-branch }}
92+
access_token: ${{ secrets.GH_PAT }}
93+
new_branch_ref: default_clean_sync_branch
94+
ignore_branch_exists: true
95+
- uses: JamesIves/github-pages-deploy-action@v4
96+
with:
97+
folder: .
98+
token: ${{ secrets.GH_PAT }}
99+
repository-name: flexcompute-readthedocs/tidy3d-docs
100+
target-folder: .
101+
branch: ${{ needs.set_env.outputs.dest-branch }}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: test-develop-cli
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
pull_request:
8+
branches:
9+
- develop
10+
- 'pre/*' # We should reduce the frequency of these builds to save resources since it tests the docs build which is pretty long.
11+
12+
jobs:
13+
test-dev-commands:
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
runs-on: ${{ matrix.os }}
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: '3.11'
27+
28+
- name: Install Dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install -e .[dev]
32+
33+
- name: Ubuntu install Pandoc
34+
if: matrix.os == 'ubuntu-latest'
35+
run: sudo apt-get install pandoc
36+
37+
- name: MacOS install Pandoc
38+
if: matrix.os == 'macos-latest'
39+
run: brew install pandoc
40+
41+
- name: Windows install Pandoc
42+
if: matrix.os == 'windows-latest'
43+
run: choco install pandoc
44+
45+
- name: Verify existing installations
46+
run: |
47+
python3 --version
48+
pipx --version
49+
50+
#----------------------------------------------
51+
# ----- install & configure poetry -----
52+
#----------------------------------------------
53+
- name: Install Poetry
54+
uses: snok/install-poetry@v1
55+
with:
56+
version: 1.7.1
57+
virtualenvs-create: true
58+
virtualenvs-in-project: true
59+
60+
- name: Run install-dev-environment command
61+
run: |
62+
# Unsure if this is a valid command since it just guarantees things run on previous dependencies installation
63+
# TODO finish debugging installation without previous installation. Tricky on GH Actions on its own.
64+
tidy3d develop install-dev-environment
65+
66+
- name: Run development test commands
67+
run: |
68+
poetry run pytest tests/test_cli/full_test_develop.py
69+

0 commit comments

Comments
 (0)