calling instead #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test-python | ||
workflow_call: | ||
inputs: | ||
run-id: | ||
required: true | ||
type: string | ||
jobs: | ||
python-wheels-build: | ||
needs: paths-filter | ||
if: needs.paths-filter.outputs.python == 'true' | ||
# This strategy is taken straight from the numpy wheels.yaml CI job | ||
# | ||
# Since we depend on numpy, there's no reason to try and build a binary cocoex wheel | ||
# on platform that don't have a compiled numpy available. | ||
strategy: | ||
# Ensure that a wheel builder finishes even if another fails | ||
fail-fast: false | ||
matrix: | ||
buildplat: | ||
- [ubuntu-20.04, manylinux_x86_64] | ||
- [ubuntu-20.04, musllinux_x86_64] | ||
- [macos-14, macosx_x86_64] | ||
- [windows-2019, win_amd64] | ||
- [windows-2019, win32] | ||
python: | ||
- ["cp39", "3.9"] | ||
- ["cp310", "3.10"] | ||
- ["cp311", "3.11"], | ||
- ["cp312", "3.12"], | ||
- ["pp39", "pp"] | ||
exclude: | ||
# Don't build PyPy 32-bit windows | ||
- buildplat: [windows-2019, win32] | ||
python: ["pp39", "pp"] | ||
- buildplat: [ ubuntu-20.04, musllinux_x86_64 ] | ||
python: ["pp39", "pp"] | ||
runs-on: ${{ matrix.buildplat[0] }} | ||
defaults: | ||
run: | ||
working-directory: ${{github.workspace}} | ||
steps: | ||
- name: Setup MSVC (32-bit) | ||
if: ${{ matrix.buildplat[1] == 'win32' }} | ||
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1 | ||
with: | ||
architecture: 'x86' | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
- name: Download Python source package | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-python-sdist | ||
run-id: ${{ inputs.config-path }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install cibuildwheel | ||
run: python -m pip install cibuildwheel==2.16.2 | ||
- name: Build cocoex wheel | ||
shell: bash | ||
run: python -m cibuildwheel --output-dir dist/ coco_experiment-*.tar.gz | ||
env: | ||
CIBW_PRERELEASE_PYTHONS: True | ||
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} | ||
- name: Archive Python wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist-python-wheels-${{ matrix.python[1] }}-${{ matrix.buildplat[1] }} | ||
path: dist/coco_experiment*.whl | ||
python-wheels-test: | ||
needs: python-wheels-build | ||
if: success() || failure() | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
buildplat: | ||
- [ubuntu-20.04, manylinux_x86_64] | ||
- [ubuntu-20.04, musllinux_x86_64] | ||
- [macos-14, macosx_x86_64] | ||
- [windows-2019, win_amd64] | ||
- [windows-2019, win32] | ||
python: ["3.9", "3.10", "3.11", "3.12"] | ||
exclude: | ||
# Don't build PyPy 32-bit windows | ||
- buildplat: [windows-2019, win32] | ||
python: "3.9" | ||
- buildplat: [ ubuntu-20.04, musllinux_x86_64 ] | ||
python: "3.9" | ||
runs-on: ${{ matrix.buildplat[0] }} | ||
defaults: | ||
run: | ||
working-directory: ${{github.workspace}} | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-python-sdist | ||
path: dist | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-python-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
path: wheels | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python}} | ||
- name: Setup Python | ||
run: python -m pip install --upgrade pip wheel | ||
- name: Install cocoex | ||
run: python -m pip install --find-links wheels/ coco-experiment | ||
- name: Run cocoex test | ||
shell: bash | ||
run: | | ||
tar xf dist/coco_experiment-*.tar.gz --strip-components=1 | ||
python -m pip install pytest pytest-cov | ||
pytest --cov=cocoex test/ | ||
python-wheels-example: | ||
needs: [python-wheels-build, python-wheels-build] | ||
strategy: | ||
matrix: | ||
fail-fast: false | ||
buildplat: | ||
- [ubuntu-20.04, manylinux_x86_64] | ||
- [ubuntu-20.04, musllinux_x86_64] | ||
- [macos-14, macosx_x86_64] | ||
- [windows-2019, win_amd64] | ||
- [windows-2019, win32] | ||
python: ["3.9", "3.10", "3.11", "3.12"] | ||
exclude: | ||
# Don't build PyPy 32-bit windows | ||
- buildplat: [windows-2019, win32] | ||
python: "3.9" | ||
- buildplat: [ ubuntu-20.04, musllinux_x86_64 ] | ||
python: "3.9" | ||
runs-on: ${{ matrix.buildplat[0] }} | ||
defaults: | ||
run: | ||
working-directory: ${{github.workspace}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-python-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }} | ||
path: wheels | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{matrix.python}} | ||
- name: Setup Python | ||
run: python -m pip install --upgrade pip wheel | ||
- name: Install cocoex and cocopp | ||
run: python -m pip install --find-links wheels/ coco-experiment cocopp | ||
- name: Install scipy for example experiment | ||
run: python -m pip install scipy | ||
- name: Run example experiment | ||
run: python build/python/example/example_experiment2.py | ||
merge-python-wheels: | ||
runs-on: ubuntu-latest | ||
needs: [python-wheels-test, python-wheels-example] | ||
if: success() || failure() | ||
steps: | ||
- name: Merge Artifacts | ||
uses: actions/upload-artifact/merge@v4 | ||
with: | ||
name: dist-python-wheels | ||
pattern: dist-python-wheels-* | ||
delete-merged: true | ||
python-lint: | ||
needs: paths-filter | ||
if: needs.paths-filter.outputs.python == 'true' | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: dist-python-sdist | ||
path: dist | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
- name: Setup Python | ||
run: python -m pip install --upgrade pip wheel | ||
- name: Lint with Ruff | ||
shell: bash | ||
continue-on-error: true | ||
run: | | ||
pip install ruff | ||
tar xf dist/coco_experiment*.tar.gz --strip-components=1 | ||
ruff check --output-format=github . |