|
| 1 | +name: "public/tidy3d-extras/python-client-integration-tests" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + release_tag: |
| 7 | + description: 'Release Tag (v2.10.0, v2.10.0rc1)' |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + default: '' |
| 11 | + |
| 12 | + workflow_call: |
| 13 | + inputs: |
| 14 | + release_tag: |
| 15 | + description: 'Release Tag (v2.10.0, v2.10.0rc1)' |
| 16 | + required: false |
| 17 | + type: string |
| 18 | + default: '' |
| 19 | + outputs: |
| 20 | + workflow_success: |
| 21 | + description: 'Overall integration test workflow success status' |
| 22 | + value: ${{ jobs.integration-tests.result == 'success' }} |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + |
| 27 | +jobs: |
| 28 | + integration-tests: |
| 29 | + name: python-${{ matrix.python-version }}-${{ matrix.platform }}-extras |
| 30 | + runs-on: ${{ matrix.platform }} |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + concurrency: |
| 34 | + group: tidy3d-extras-integration-${{ github.event.pull_request.number || github.sha }}-${{ matrix.platform }}-${{ matrix.python-version }} |
| 35 | + cancel-in-progress: true |
| 36 | + strategy: |
| 37 | + fail-fast: false |
| 38 | + matrix: |
| 39 | + include: |
| 40 | + # Linux x86_64 (manylinux/musllinux) |
| 41 | + - platform: ubuntu-latest |
| 42 | + python-version: '3.10' |
| 43 | + # Linux aarch64 (manylinux/musllinux) |
| 44 | + - platform: linux-arm64 |
| 45 | + python-version: '3.10' |
| 46 | + # macOS x86_64 |
| 47 | + - platform: macos-15-intel |
| 48 | + python-version: '3.10' |
| 49 | + # macOS arm64 |
| 50 | + - platform: macos-latest |
| 51 | + python-version: '3.10' |
| 52 | + # Windows x86_64 |
| 53 | + - platform: windows-latest |
| 54 | + python-version: '3.10' |
| 55 | + defaults: |
| 56 | + run: |
| 57 | + shell: bash |
| 58 | + env: |
| 59 | + PIP_ONLY_BINARY: gdstk |
| 60 | + MPLBACKEND: agg |
| 61 | + RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || inputs.release_tag }} |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: checkout-head |
| 65 | + if: ${{ !env.RELEASE_TAG }} |
| 66 | + uses: actions/checkout@v4 |
| 67 | + with: |
| 68 | + fetch-depth: 1 |
| 69 | + submodules: false |
| 70 | + persist-credentials: false |
| 71 | + |
| 72 | + - name: checkout-tag |
| 73 | + if: ${{ env.RELEASE_TAG }} |
| 74 | + uses: actions/checkout@v4 |
| 75 | + with: |
| 76 | + ref: refs/tags/${{ env.RELEASE_TAG }} |
| 77 | + fetch-depth: 1 |
| 78 | + submodules: false |
| 79 | + persist-credentials: false |
| 80 | + |
| 81 | + - name: set-python-${{ matrix.python-version }} |
| 82 | + uses: actions/setup-python@v4 |
| 83 | + with: |
| 84 | + python-version: ${{ matrix.python-version }} |
| 85 | + |
| 86 | + - name: install-poetry |
| 87 | + uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1 |
| 88 | + with: |
| 89 | + version: 2.1.1 |
| 90 | + virtualenvs-create: true |
| 91 | + virtualenvs-in-project: true |
| 92 | + |
| 93 | + - name: configure-aws-credentials |
| 94 | + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 |
| 95 | + with: |
| 96 | + aws-access-key-id: ${{ secrets.AWS_CODEARTIFACT_ACCESS_KEY }} |
| 97 | + aws-secret-access-key: ${{ secrets.AWS_CODEARTIFACT_ACCESS_SECRET }} |
| 98 | + aws-region: us-east-1 |
| 99 | + |
| 100 | + - name: configure-codeartifact-authentication |
| 101 | + run: | |
| 102 | + set -e |
| 103 | + echo "Getting CodeArtifact token..." |
| 104 | + CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token \ |
| 105 | + --domain flexcompute \ |
| 106 | + --domain-owner 625554095313 \ |
| 107 | + --query authorizationToken \ |
| 108 | + --output text) |
| 109 | +
|
| 110 | + echo "Configuring Poetry with CodeArtifact credentials..." |
| 111 | + poetry config http-basic.codeartifact aws $CODEARTIFACT_AUTH_TOKEN |
| 112 | + echo "✅ CodeArtifact authentication configured" |
| 113 | +
|
| 114 | + - name: install-project |
| 115 | + shell: bash |
| 116 | + run: | |
| 117 | + poetry --version |
| 118 | + python --version |
| 119 | + python -m venv .venv |
| 120 | + if [[ "${{ runner.os }}" == "Windows" ]]; then |
| 121 | + source .venv/Scripts/activate |
| 122 | + python --version |
| 123 | + else |
| 124 | + source .venv/bin/activate |
| 125 | + which python |
| 126 | + fi |
| 127 | + poetry env use python |
| 128 | + poetry env info |
| 129 | + poetry run pip install --upgrade pip wheel setuptools |
| 130 | + poetry run pip install gdstk --only-binary gdstk |
| 131 | + poetry install -E extras -E dev |
| 132 | + |
| 133 | + - name: verify-extras-installation |
| 134 | + run: | |
| 135 | + export SIMCLOUD_APIKEY=${{ secrets.TIDY3D_API_KEY }} |
| 136 | + poetry run tidy3d configure --apikey ${{ secrets.TIDY3D_API_KEY }} |
| 137 | + poetry run python -c "import tidy3d; print(f'tidy3d version: {tidy3d.__version__}')" |
| 138 | + poetry run python -c "import tidy3d_extras; print(f'tidy3d-extras version: {tidy3d_extras.__version__}')" |
| 139 | + cd tests/ |
| 140 | + poetry run pytest _test_tidy3d_extras_license.py |
| 141 | +
|
| 142 | + - name: run-doctests |
| 143 | + run: | |
| 144 | + export SIMCLOUD_APIKEY=${{ secrets.TIDY3D_API_KEY }} |
| 145 | + poetry run tidy3d configure --apikey ${{ secrets.TIDY3D_API_KEY }} |
| 146 | + poetry run pytest -rF --tb=short tidy3d |
| 147 | +
|
| 148 | + - name: run-tests-coverage |
| 149 | + env: |
| 150 | + PYTHONUNBUFFERED: "1" |
| 151 | + run: | |
| 152 | + export SIMCLOUD_APIKEY=${{ secrets.TIDY3D_API_KEY }} |
| 153 | + poetry run tidy3d configure --apikey ${{ secrets.TIDY3D_API_KEY }} |
| 154 | + poetry run pytest --cov=tidy3d -rF --tb=short tests/_test_data/_test_datasets_no_vtk.py |
| 155 | + poetry run pytest --cov=tidy3d -rF --tb=short tests |
| 156 | + poetry run coverage report -m |
| 157 | + TOTAL_COVERAGE=$(poetry run coverage report --format=total) |
| 158 | + echo "total=$TOTAL_COVERAGE" >> "$GITHUB_ENV" |
| 159 | + echo "### Total coverage: ${TOTAL_COVERAGE}%" |
0 commit comments