Skip to content

Commit a2fa843

Browse files
committed
Refactor ci test
1 parent 81994f4 commit a2fa843

File tree

5 files changed

+146
-80
lines changed

5 files changed

+146
-80
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
2+
name: ci_test_wheel
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/download-artifact@v4
7+
with:
8+
pattern: dist-*
9+
merge-multiple: true
10+
path: dist/
11+
- name: Set up Python ${{ matrix.python-version }}
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: ${{ matrix.python-version }}
15+
- name: Run tests
16+
shell: bash {0}
17+
run: |
18+
if [[ ${{ matrix.python-version }} == "3.10" ]]; then
19+
export PYTHONFOLDER="cp310-cp310"
20+
elif [[ ${{ matrix.python-version }} == "3.11" ]]; then
21+
export PYTHONFOLDER="cp311-cp311"
22+
elif [[ ${{ matrix.python-version }} == "3.12" ]]; then
23+
export PYTHONFOLDER="cp312-cp312"
24+
elif [[ ${{ matrix.python-version }} == "3.13" ]]; then
25+
export PYTHONFOLDER="cp313-cp313"
26+
fi
27+
if [[ ${{ matrix.os }} == "ubuntu-24.04" ]]; then
28+
export OSNAME="manylinux"
29+
export PLATFORM="x86_"
30+
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
31+
elif [[ ${{ matrix.os }} == "macos-15" ]]; then
32+
export OSNAME="macosx"
33+
export PLATFORM="arm"
34+
which python
35+
python --version
36+
pip install torch
37+
elif [[ ${{ matrix.os }} == "windows-2025" ]]; then
38+
export OSNAME="win"
39+
export PLATFORM="amd"
40+
pip install torch
41+
fi
42+
pip install SimpleITK
43+
pip install "gaga_phsp>=0.7.6"
44+
pip install dist/opengate_core-*-${PYTHONFOLDER}-${OSNAME}*_${PLATFORM}64.whl
45+
pip install dist/opengate-*.whl
46+
export GIT_SSL_NO_VERIFY=1
47+
if [[ ${{ matrix.os }} == "ubuntu-24.04" ]]; then
48+
path=`opengate_library_path.py -p site_packages`
49+
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
50+
fi
51+
if [[ ${{ matrix.os }} == "windows-2025" ]]; then
52+
path=`opengate_library_path.py -p site_packages`
53+
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
54+
export PATH="${path}\\opengate_core.libs":${PATH}
55+
fi
56+
dashboard_path=`opengate_library_path.py -p tests`
57+
pip freeze
58+
sha=${{ github.sha }}
59+
sha=$sha$OSNAME$PYTHONFOLDER
60+
if [ "${{ github.event_name }}" = "schedule" ]; then
61+
OutputTest=$(opengate_tests)
62+
else
63+
OutputTest=$(opengate_tests -r -s $sha)
64+
fi
65+
echo "$OutputTest"
66+
ls $dashboard_path/../output_dashboard/
67+
cp -r $dashboard_path/../output_dashboard .
68+
OutputTest=$(echo "$OutputTest" | tail -1)
69+
if [[ "$OutputTest" != "True" ]]; then
70+
exit -1
71+
else
72+
exit 0
73+
fi
74+
- name: Upload results
75+
uses: actions/upload-artifact@v4
76+
if: always()
77+
with:
78+
name: results_json-${{ matrix.os }}-${{ matrix.python-version }}
79+
path: output_dashboard/dashboard_output*.json
80+
81+
source $GITHUB_WORKSPACE/env_dump.txt
82+
source $CONDA/Scripts/activate opengate_core
83+
if [[ ${MATRIX_PYTHON_VERSION} == "3.10" ]]; then
84+
export PYTHONFOLDER="cp310-cp310"
85+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.11" ]]; then
86+
export PYTHONFOLDER="cp311-cp311"
87+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.12" ]]; then
88+
export PYTHONFOLDER="cp312-cp312"
89+
elif [[ ${MATRIX_PYTHON_VERSION} == "3.13" ]]; then
90+
export PYTHONFOLDER="cp313-cp313"
91+
fi
92+
if [[ ${MATRIX_OS} == "ubuntu-24.04" ]]; then
93+
export OSNAME="manylinux"
94+
export PLATFORM="x86_"
95+
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
96+
elif [[ ${MATRIX_OS} == "macos-15" ]]; then
97+
export OSNAME="macosx"
98+
export PLATFORM="arm"
99+
which python
100+
python --version
101+
pip install torch
102+
elif [[ ${MATRIX_OS} == "windows-2025" ]]; then
103+
export OSNAME="win"
104+
export PLATFORM="amd"
105+
pip install torch
106+
fi
107+
pip install SimpleITK
108+
pip install "gaga_phsp>=0.7.6"
109+
pip install dist/opengate_core-*-${PYTHONFOLDER}-${OSNAME}*_${PLATFORM}64.whl
110+
pip install dist/opengate-*.whl
111+
export GIT_SSL_NO_VERIFY=1
112+
if [[ ${MATRIX_OS} == "ubuntu-24.04" ]]; then
113+
path=`opengate_library_path.py -p site_packages`
114+
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
115+
fi
116+
if [[ ${MATRIX_OS} == "windows-2025" ]]; then
117+
path=`opengate_library_path.py -p site_packages`
118+
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
119+
export PATH="${path}\\opengate_core.libs":${PATH}
120+
fi
121+
dashboard_path=`opengate_library_path.py -p tests`
122+
pip freeze
123+
sha=${{ github.sha }}
124+
sha=$sha$OSNAME$PYTHONFOLDER
125+
if [ "${{ github.event_name }}" = "schedule" ]; then
126+
OutputTest=$(opengate_tests)
127+
else
128+
OutputTest=$(opengate_tests -r -s $sha)
129+
fi
130+
echo "$OutputTest"
131+
ls $dashboard_path/../output_dashboard/
132+
cp -r $dashboard_path/../output_dashboard .
133+
OutputTest=$(echo "$OutputTest" | tail -1)
134+
if [[ "$OutputTest" != "True" ]]; then
135+
exit -1
136+
else
137+
exit 0
138+
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.

.github/workflows/main.yml

Lines changed: 8 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
MATRIX_PYTHON_VERSION: ${{ matrix.python-version }}
127127
run: |
128128
export > $GITHUB_WORKSPACE/env_dump.txt
129-
bash $GITHUB_WORKSPACE/.github/workflows/ci_ubuntu.sh
129+
bash $GITHUB_WORKSPACE/.github/workflows/ci_build_wheel_ubuntu.sh
130130
- name: Create opengate_core Wheel Mac
131131
if: matrix.os == 'macos-15'
132132
env:
@@ -135,7 +135,7 @@ jobs:
135135
shell: bash -l {0}
136136
run: |
137137
export > $GITHUB_WORKSPACE/env_dump.txt
138-
bash $GITHUB_WORKSPACE/.github/workflows/ci_macos.sh
138+
bash $GITHUB_WORKSPACE/.github/workflows/ci_build_wheel_macos.sh
139139
- name: Create opengate_core Wheel Windows
140140
if: matrix.os == 'windows-2025'
141141
env:
@@ -144,7 +144,7 @@ jobs:
144144
shell: bash -l {0}
145145
run: |
146146
export > $GITHUB_WORKSPACE\\env_dump.txt
147-
bash $GITHUB_WORKSPACE\\.github\\workflows\\ci_windows.sh
147+
bash $GITHUB_WORKSPACE\\.github\\workflows\\ci_build_wheel_windows.sh
148148
- name: Upload wheels
149149
uses: actions/upload-artifact@v4
150150
with:
@@ -244,7 +244,7 @@ jobs:
244244
- name: Upload wheels
245245
uses: actions/upload-artifact@v4
246246
with:
247-
name: dist-${{ matrix.os }}-${{ matrix.python-version }}-opengate-core
247+
name: dist-${{ matrix.os }}-${{ matrix.python-version }}-opengate-core-ci_or_tag
248248
path: dist/
249249

250250
build_opengate_core_novis_wheel:
@@ -327,6 +327,7 @@ jobs:
327327
run: |
328328
mkdir dist_opengate_core dist_opengate dist_opengate_core_novis
329329
mv dist/opengate_core_novis-* dist_opengate_core_novis/ || true
330+
mv dist/opengate_core_ci* dist_opengate_core/ || true
330331
mv dist/opengate_core-* dist_opengate_core/
331332
mv dist/opengate-* dist_opengate/
332333
- name: Publish to PyPI opengate_core_novis
@@ -401,7 +402,7 @@ jobs:
401402
# NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
402403
# SSH_PASS: ${{ secrets.SSH_PASS }}
403404

404-
test_wheel:
405+
test_wheel_pr:
405406
runs-on: ${{ matrix.os }}
406407
needs: [build_opengate_wheel, build_opengate_core_wheel_pr]
407408
strategy:
@@ -413,85 +414,12 @@ jobs:
413414
- os: macos-15
414415
python-version: '3.10'
415416
steps:
416-
- uses: actions/download-artifact@v4
417-
with:
418-
pattern: dist-*
419-
merge-multiple: true
420-
path: dist/
421-
- name: Set up Python ${{ matrix.python-version }}
422-
uses: actions/setup-python@v5
423-
with:
424-
python-version: ${{ matrix.python-version }}
425-
- name: Run tests
426-
shell: bash {0}
427-
run: |
428-
if [[ ${{ matrix.python-version }} == "3.10" ]]; then
429-
export PYTHONFOLDER="cp310-cp310"
430-
elif [[ ${{ matrix.python-version }} == "3.11" ]]; then
431-
export PYTHONFOLDER="cp311-cp311"
432-
elif [[ ${{ matrix.python-version }} == "3.12" ]]; then
433-
export PYTHONFOLDER="cp312-cp312"
434-
elif [[ ${{ matrix.python-version }} == "3.13" ]]; then
435-
export PYTHONFOLDER="cp313-cp313"
436-
fi
437-
if [[ ${{ matrix.os }} == "ubuntu-24.04" ]]; then
438-
export OSNAME="manylinux"
439-
export PLATFORM="x86_"
440-
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
441-
elif [[ ${{ matrix.os }} == "macos-15" ]]; then
442-
export OSNAME="macosx"
443-
export PLATFORM="arm"
444-
which python
445-
python --version
446-
pip install torch
447-
elif [[ ${{ matrix.os }} == "windows-2025" ]]; then
448-
export OSNAME="win"
449-
export PLATFORM="amd"
450-
pip install torch
451-
fi
452-
pip install SimpleITK
453-
pip install "gaga_phsp>=0.7.6"
454-
pip install dist/opengate_core-*-${PYTHONFOLDER}-${OSNAME}*_${PLATFORM}64.whl
455-
pip install dist/opengate-*.whl
456-
export GIT_SSL_NO_VERIFY=1
457-
if [[ ${{ matrix.os }} == "ubuntu-24.04" ]]; then
458-
path=`opengate_library_path.py -p site_packages`
459-
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
460-
fi
461-
if [[ ${{ matrix.os }} == "windows-2025" ]]; then
462-
path=`opengate_library_path.py -p site_packages`
463-
export LD_LIBRARY_PATH="${path}/opengate_core.libs":${LD_LIBRARY_PATH}
464-
export PATH="${path}\\opengate_core.libs":${PATH}
465-
fi
466-
dashboard_path=`opengate_library_path.py -p tests`
467-
pip freeze
468-
sha=${{ github.sha }}
469-
sha=$sha$OSNAME$PYTHONFOLDER
470-
if [ "${{ github.event_name }}" = "schedule" ]; then
471-
OutputTest=$(opengate_tests)
472-
else
473-
OutputTest=$(opengate_tests -r -s $sha)
474-
fi
475-
echo "$OutputTest"
476-
ls $dashboard_path/../output_dashboard/
477-
cp -r $dashboard_path/../output_dashboard .
478-
OutputTest=$(echo "$OutputTest" | tail -1)
479-
if [[ "$OutputTest" != "True" ]]; then
480-
exit -1
481-
else
482-
exit 0
483-
fi
484-
- name: Upload results
485-
uses: actions/upload-artifact@v4
486-
if: always()
487-
with:
488-
name: results_json-${{ matrix.os }}-${{ matrix.python-version }}
489-
path: output_dashboard/dashboard_output*.json
417+
- uses: ./.github/workflows/actions
490418

491419
publish_test:
492420
runs-on: ubuntu-24.04
493421
if: ${{ (always()) && (github.ref == 'refs/heads/master') }}
494-
needs: [test_wheel]
422+
needs: [test_wheel_pr]
495423
steps:
496424
- name: Checkout github repo
497425
uses: actions/checkout@v4

0 commit comments

Comments
 (0)