Skip to content

bug syntax in CI

bug syntax in CI #149

Workflow file for this run

name: Windows Build
on:
push:
branches: [ dev, itk_update ]
tags:
- v*
pull_request:
branches: [ dev ]
workflow_dispatch:
jobs:
build:
name: Build, test and upload
strategy:
max-parallel: 1
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: windows-2022
if: ${{ startsWith(github.ref, 'refs/tags') || !contains(github.event.head_commit.message, '[skip ci]') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-tags: true
- name: Checkout submodules
run: |
git submodule init
git submodule update
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Set python version
run: |
$pythonVersionStr = python -c "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')"
echo "pythonVersionStr=$pythonVersionStr" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Build zlib
run: |
git clone https://github.com/madler/zlib.git
md zlib-build
cd zlib-build
cmake ..\zlib -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="..\zlib-install"
cmake --build . --config Release --target install
cd ..
dir
- name: Build ITK
run: |
md ITK-build
cd ITK-build
cmake.exe -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release ..\ITK
cmake --build . --config Release --target Install
cd ..
shell: cmd
- name: Build wheel
run: |
python -m pip wheel . -w .\dist --no-deps --verbose
python -m pip install . -f .\dist\
#python -m pip install -r requirements.txt
#python -m pip install pytest
#python -m pip install tensorflow
cd ..
python -c 'import samseg'
# python -m pytest samseg\samseg\tests
rm samseg\gems\*.pyd
rm samseg\samseg\gems\Release\*.pyd
env:
ZLIB_INCLUDE_DIR: .\zlib-install\include
ZLIB_LIBRARY: .\zlib-install\lib\zlibstatic.lib
ITK_DIR: ITK-build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-wheels-${{ env.pythonVersionStr }}
path: .\dist\*.whl
publish:
name: Publish the wheels
needs: build
strategy:
max-parallel: 1
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
runs-on: windows-2022
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Set python version
run: |
$pythonVersionStr = python -c "import sys; print(f'cp{sys.version_info.major}{sys.version_info.minor}')"
echo "pythonVersionStr=$pythonVersionStr" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: windows-wheels-${{ env.pythonVersionStr }}
path: ${{ github.workspace }}
- name: Upload to PyPI
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
run: |
python -m pip install twine
python -m twine upload *.whl -u __token__ -p "$env:PASSWORD"
env:
PASSWORD: ${{ secrets.PYPI_TOKEN }}