Skip to content

Commit 6b1eb3f

Browse files
authored
Merge pull request #643 from gdsfactory/copilot/fix-642
2 parents 796021a + 55da681 commit 6b1eb3f

3 files changed

Lines changed: 45 additions & 13 deletions

File tree

.github/workflows/test_code.yml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,53 @@ jobs:
7777
7878
test_palace:
7979
runs-on: ubuntu-latest
80-
container:
81-
image: benvial/palace:dev
82-
name: Test palace:dev docker 3.11
80+
name: Test palace ubuntu-latest 3.11
8381
steps:
8482
- uses: actions/checkout@v4
8583
- uses: astral-sh/setup-uv@v6
86-
- name: Install mesa-libGLU
84+
- name: Setup Apptainer
85+
uses: eWaterCycle/setup-apptainer@3f706d898c9db585b1d741b4692e66755f3a1b40
86+
with:
87+
apptainer-version: 1.4.2
88+
- name: Install libglu1-mesa
8789
run: |
88-
dnf install -y mesa-libGLU
89-
- name: Install dependencies
90+
sudo apt-get install -y libglu1-mesa
91+
- name: Download Palace singularity definition
92+
run: wget https://raw.githubusercontent.com/awslabs/palace/main/singularity/singularity.def
93+
- name: Cache Palace container restore
94+
id: cache-palace-restore
95+
uses: actions/cache/restore@v4
96+
with:
97+
path: palace.sif
98+
key: palace-container-${{ runner.os }}-${{ hashFiles('singularity.def') }}
99+
- name: Build palace from source
100+
if: steps.cache-palace-restore.outputs.cache-hit != 'true'
90101
run: |
91-
uv venv -p 3.11
92-
uv pip install .[gmsh,dev]
93-
- name: Test with pytest
102+
echo "Building Palace container from source (this may take a while)…"
103+
echo "Note: This is a one-time build that will be cached for future runs"
104+
timeout 3600 sudo apptainer build palace.sif singularity.def || {
105+
echo "Build timed out or failed after 60 minutes. Palace tests will be skipped."
106+
exit 1
107+
}
108+
- name: Cache Palace container save
109+
uses: actions/cache/save@v4
110+
if: steps.cache-palace-restore.outputs.cache-hit != 'true'
111+
with:
112+
path: palace.sif
113+
key: palace-container-${{ runner.os }}-${{ hashFiles('singularity.def') }}
114+
- name: Create palace alias
94115
run: |
95-
uv run pytest gplugins/palace
96-
116+
# Create a shell script that acts as an alias for palace
117+
echo '#!/bin/bash' > palace
118+
echo "sudo apptainer run $GITHUB_WORKSPACE/palace.sif \"\$@\" " >> palace
119+
chmod +x palace
120+
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
121+
echo "Palace executable created successfully"
122+
- name: Verify Palace installation
123+
run: |
124+
palace --help || echo "Palace help failed but container exists"
125+
- name: Test with pytest
126+
run: sudo env "PATH=$PATH" "$(which uv)" run --extra dev --extra gmsh pytest gplugins/palace -v
97127

98128
test_code_coverage:
99129
runs-on: ubuntu-latest

gplugins/palace/tests/test_palace.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_palace_capacitance_simulation_runs(geometry) -> None:
9090
mesh_parameters=get_reasonable_mesh_parameters_capacitance(c),
9191
)
9292

93+
9394
@pytest.mark.parametrize("n_processes", [(1), (2), (4)])
9495
def test_palace_capacitance_simulation_n_processes(geometry, n_processes) -> None:
9596
c = geometry
@@ -101,6 +102,7 @@ def test_palace_capacitance_simulation_n_processes(geometry, n_processes) -> Non
101102
mesh_parameters=get_reasonable_mesh_parameters_capacitance(c),
102103
)
103104

105+
104106
@pytest.mark.parametrize("element_order", [(1), (2), (3)])
105107
def test_palace_capacitance_simulation_element_order(geometry, element_order) -> None:
106108
c = geometry

uv.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)