Skip to content

Commit 44ee734

Browse files
author
cbuahin
committed
Sorting on GitHub actions for unit testing and building python wheels
Signed-off-by: cbuahin <caleb.buahin@gmail.com>
1 parent 506fb7a commit 44ee734

File tree

1 file changed

+129
-129
lines changed

1 file changed

+129
-129
lines changed

.github/workflows/unit_testing.yml

Lines changed: 129 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -111,140 +111,140 @@ jobs:
111111
build-${{ matrix.vcpkg_triplet }}/*.tar.gz
112112
build-${{ matrix.vcpkg_triplet }}/*.zip
113113
114-
# python_binding_unit_test:
115-
# name: Build and Unit Test Python Bindings
116-
# strategy:
117-
# fail-fast: false
118-
# matrix:
119-
# os: [windows-latest, ubuntu-latest, macos-13, macos-latest]
120-
# python: [3.13]
121-
# include:
122-
# - os: ubuntu-latest
123-
# alias: Linux
124-
# shell: bash
125-
# cmake_preset: Linux
126-
# shell_extension: .sh
127-
# vcpkg_triplet: x64-linux
128-
# cmake_osx_arch: ""
129-
130-
# - os: macos-13
131-
# alias: intel-mac
132-
# cmake_preset: Darwin
133-
# shell: bash
134-
# shell_extension: .sh
135-
# vcpkg_triplet: x64-osx
136-
# cmake_osx_arch: "x86_64"
137-
138-
# - os: macos-latest
139-
# alias: apple-silicon
140-
# cmake_preset: Darwin
141-
# shell: bash
142-
# shell_extension: .sh
143-
# vcpkg_triplet: arm64-osx
144-
# cmake_osx_arch: "arm64"
114+
python_binding_unit_test:
115+
name: Build and Unit Test Python Bindings
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
os: [windows-latest, ubuntu-latest, macos-13, macos-latest]
120+
python: [3.13]
121+
include:
122+
- os: ubuntu-latest
123+
alias: Linux
124+
shell: bash
125+
cmake_preset: Linux
126+
shell_extension: .sh
127+
vcpkg_triplet: x64-linux
128+
cmake_osx_arch: ""
129+
130+
- os: macos-13
131+
alias: intel-mac
132+
cmake_preset: Darwin
133+
shell: bash
134+
shell_extension: .sh
135+
vcpkg_triplet: x64-osx
136+
cmake_osx_arch: "x86_64"
137+
138+
- os: macos-latest
139+
alias: apple-silicon
140+
cmake_preset: Darwin
141+
shell: bash
142+
shell_extension: .sh
143+
vcpkg_triplet: arm64-osx
144+
cmake_osx_arch: "arm64"
145145

146-
# - os: windows-latest
147-
# alias: win64
148-
# cmake_preset: Windows
149-
# shell: cmd
150-
# shell_extension: .bat
151-
# vcpkg_triplet: x64-windows
152-
153-
# runs-on: ${{ matrix.os }}
154-
# defaults:
155-
# run:
156-
# shell: ${{ matrix.shell }}
157-
158-
# steps:
159-
# - name: Checkout SWMM Repo
160-
# uses: actions/checkout@v4
146+
- os: windows-latest
147+
alias: win64
148+
cmake_preset: Windows
149+
shell: cmd
150+
shell_extension: .bat
151+
vcpkg_triplet: x64-windows
152+
153+
runs-on: ${{ matrix.os }}
154+
defaults:
155+
run:
156+
shell: ${{ matrix.shell }}
157+
158+
steps:
159+
- name: Checkout SWMM Repo
160+
uses: actions/checkout@v4
161161

162-
# - name: Checkout VCPKG
163-
# uses: actions/checkout@v4
164-
# with:
165-
# repository: microsoft/vcpkg
166-
# ref: 2025.02.14
167-
# path: vcpkg
168-
169-
# - name: Install OpenMP and Ninja (MacOS)
170-
# if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-13' }}
171-
# run: |
172-
# brew reinstall libomp
173-
# brew link --force --overwrite libomp
174-
# brew install ninja
175-
176-
# - name: Bootstrap VCPKG (Windows)
177-
# if: ${{ matrix.os == 'windows-latest' }}
178-
# working-directory: ${{ env.VCPKG_ROOT }}
179-
# run: |
180-
# .\bootstrap-vcpkg${{ matrix.shell_extension }}
181-
# .\vcpkg.exe integrate install
162+
- name: Checkout VCPKG
163+
uses: actions/checkout@v4
164+
with:
165+
repository: microsoft/vcpkg
166+
ref: 2025.02.14
167+
path: vcpkg
168+
169+
- name: Install OpenMP and Ninja (MacOS)
170+
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'macos-13' }}
171+
run: |
172+
brew reinstall libomp
173+
brew link --force --overwrite libomp
174+
brew install ninja
175+
176+
- name: Bootstrap VCPKG (Windows)
177+
if: ${{ matrix.os == 'windows-latest' }}
178+
working-directory: ${{ env.VCPKG_ROOT }}
179+
run: |
180+
.\bootstrap-vcpkg${{ matrix.shell_extension }}
181+
.\vcpkg.exe integrate install
182182
183-
# - name: Bootstrap VCPKG (Unix like)
184-
# if: ${{ matrix.os != 'windows-latest' }}
185-
# working-directory: ${{ env.VCPKG_ROOT }}
186-
# run: |
187-
# ./bootstrap-vcpkg${{ matrix.shell_extension }}
188-
# chmod +x vcpkg
189-
190-
# - name: Export GitHub Actions cache environment variables
191-
# uses: actions/github-script@v7
192-
# with:
193-
# script: |
194-
# core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
195-
# core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
183+
- name: Bootstrap VCPKG (Unix like)
184+
if: ${{ matrix.os != 'windows-latest' }}
185+
working-directory: ${{ env.VCPKG_ROOT }}
186+
run: |
187+
./bootstrap-vcpkg${{ matrix.shell_extension }}
188+
chmod +x vcpkg
189+
190+
- name: Export GitHub Actions cache environment variables
191+
uses: actions/github-script@v7
192+
with:
193+
script: |
194+
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
195+
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
196196
197-
# - name: Setup python
198-
# uses: actions/setup-python@v4
199-
# with:
200-
# python-version: ${{ matrix.python }}
197+
- name: Setup python
198+
uses: actions/setup-python@v4
199+
with:
200+
python-version: ${{ matrix.python }}
201201

202-
# - name: Install Python Requirements
203-
# working-directory: ${{ github.workspace }}/python
204-
# run: |
205-
# python -m pip install --upgrade pip
206-
# python -m pip install -r requirements.txt
202+
- name: Install Python Requirements
203+
working-directory: ${{ github.workspace }}/python
204+
run: |
205+
python -m pip install --upgrade pip
206+
python -m pip install -r requirements.txt
207207
208-
# - name: Build and Install
209-
# env:
210-
# CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
211-
# working-directory: ${{ github.workspace }}/python
212-
# run: |
213-
# pyclean .
214-
# python setup.py build_ext --inplace
215-
# python -m pip install .
208+
- name: Build and Install
209+
env:
210+
CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
211+
working-directory: ${{ github.workspace }}/python
212+
run: |
213+
pyclean .
214+
python setup.py build_ext --inplace
215+
python -m pip install .
216216
217-
# - name: Unit Test
218-
# env:
219-
# CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
220-
# working-directory: ${{ github.workspace }}/python
221-
# run: |
222-
# python -m pytest -v tests
223-
# python setup.py clean --all
224-
# python -m build .
217+
- name: Unit Test
218+
env:
219+
CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
220+
working-directory: ${{ github.workspace }}/python
221+
run: |
222+
python -m pytest -v tests
223+
python setup.py clean --all
224+
python -m build .
225225
226-
# - name: Build Wheels
227-
# uses: pypa/cibuildwheel@v2.23.2
228-
# with:
229-
# package-dir: ./python
230-
# output-dir: ./python/wheelhouse
231-
# env:
232-
# CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
233-
# # CIBW_TEST_COMMAND: "python {package}/setup.py build_ext --inplace && python -m pip install {package} && python -m pytest {package}/tests -v"
234-
# CIBW_BEFORE_TEST: "pip install -r {package}/requirements.txt && python -m pip install ninja"
235-
# CIBW_BUILD_VERBOSITY: 1
236-
# CIBW_BEFORE_BUILD_MACOS: brew install ninja
237-
# CIBW_REPAIR_WHEEL_COMMAND: ${{ matrix.os == 'ubuntu-latest' && 'auditwheel repair -w {dest_dir} {wheel}' || '' }}
238-
239-
# - name: Upload Python Wheels
240-
# if: ${{ always() }}
241-
# uses: actions/upload-artifact@v4
242-
# with:
243-
# name: python-wheels-${{ matrix.vcpkg_triplet }}
244-
# path: |
245-
# python/wheelhouse/*.whl
246-
# python/wheelhouse/*.tar.gz
247-
# python/wheelhouse/*.zip
248-
# python/dist/*.whl
249-
# python/dist/*.tar.gz
250-
# python/dist/*.zip
226+
- name: Build Wheels
227+
uses: pypa/cibuildwheel@v2.23.2
228+
with:
229+
package-dir: ./python
230+
output-dir: ./python/wheelhouse
231+
env:
232+
CMAKE_OSX_ARCHITECTURES: ${{ matrix.cmake_osx_arch }}
233+
# CIBW_TEST_COMMAND: "python {package}/setup.py build_ext --inplace && python -m pip install {package} && python -m pytest {package}/tests -v"
234+
CIBW_BEFORE_TEST: "pip install -r {package}/requirements.txt && python -m pip install ninja"
235+
CIBW_BUILD_VERBOSITY: 1
236+
CIBW_BEFORE_BUILD_MACOS: brew install ninja
237+
CIBW_REPAIR_WHEEL_COMMAND: ${{ matrix.os == 'ubuntu-latest' && 'auditwheel repair -w {dest_dir} {wheel}' || '' }}
238+
239+
- name: Upload Python Wheels
240+
if: ${{ always() }}
241+
uses: actions/upload-artifact@v4
242+
with:
243+
name: python-wheels-${{ matrix.vcpkg_triplet }}
244+
path: |
245+
python/wheelhouse/*.whl
246+
python/wheelhouse/*.tar.gz
247+
python/wheelhouse/*.zip
248+
python/dist/*.whl
249+
python/dist/*.tar.gz
250+
python/dist/*.zip

0 commit comments

Comments
 (0)