Merge pull request #21 from masadcv/revert-to-v3-artifacts #121
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: Build | |
# simple build workflow for sanity check wheel binary, source distribution compilation and installation on various platforms with p3.8 | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
inputs: | |
test_package: | |
description: 'Test package within workflow' | |
required: true | |
default: 'true' | |
save_artifacts: | |
description: 'Save artifacts from build' | |
required: true | |
default: 'false' | |
jobs: | |
build_whl: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019, macos-12, ubuntu-20.04] | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install wheel setuptools ninja | |
pip install -r requirements-dev.txt | |
- name: Build wheel | |
run: python setup.py bdist_wheel | |
- name: Install software | |
if: ${{ github.event.inputs.test_package == 'true' }} | |
run: | | |
pip install numpy # install to get rid of warning | |
pip install --no-index --find-links=${{github.workspace}}/dist/ numpymaxflow | |
- name: Test import anhd 2D/3D case | |
if: ${{ github.event.inputs.test_package == 'true' }} | |
run: | | |
# 2D test | |
python -c "import numpy; import numpymaxflow; numpymaxflow.maxflow(numpy.zeros((1, 128, 128), numpy.float32), numpy.zeros((2, 128, 128), numpy.float32), 1.0, 1.0)" | |
# 3D test | |
python -c "import numpy; import numpymaxflow; numpymaxflow.maxflow(numpy.zeros((1, 128, 128, 128), numpy.float32), numpy.zeros((2, 128, 128, 128), numpy.float32), 1.0, 1.0)" | |
- name: Upload Python Dist | |
if: ${{ github.event.inputs.save_artifacts == 'true' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
if-no-files-found: error | |
build_sdist: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
pip install wheel setuptools | |
pip install -r requirements-dev.txt | |
- name: Build source dist | |
run: python setup.py sdist | |
- name: Install software | |
if: ${{ github.event.inputs.test_package == 'true' }} | |
run: | | |
pip install numpy # install to get rid of warning | |
pip install ${{github.workspace}}/dist/numpymaxflow*.tar.gz | |
- name: Test import and 2D/3D case | |
if: ${{ github.event.inputs.test_package == 'true' }} | |
run: | | |
# 2D test | |
python -c "import numpy; import numpymaxflow; numpymaxflow.maxflow(numpy.zeros(1, 128, 128), numpy.zeros(2, 128, 128), 1.0, 1.0)" | |
# 3D test | |
python -c "import numpy; import numpymaxflow; numpymaxflow.maxflow(numpy.zeros(1, 128, 128, 128), numpy.zeros(2, 128, 128, 128), 1.0, 1.0)" | |
- name: Upload Python Dist | |
if: ${{ github.event.inputs.save_artifacts == 'true' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
if-no-files-found: error |