Skip to content

Commit

Permalink
Trying to get the wheel names correct in macos and winos builds
Browse files Browse the repository at this point in the history
  • Loading branch information
oulap committed Sep 25, 2024
1 parent cf929e4 commit a241844
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 14 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,22 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set python version and platform variables
- name: Detect if arm and set wheel variables
if: runner.arch == 'ARM64' || runner.arch == 'ARM64'
run: |
_PYTHON_HOST_PLATFORM="macosx-14.0-arm64"
echo "_PYTHON_HOST_PLATFORM=${_PYTHON_HOST_PLATFORM}" >> $GITHUB_ENV
PYTHON_VERSION_STR=$(python -c "import sys;print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
echo "PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> $GITHUB_ENV
- name: Detect if x64 and set build variables
if: runner.arch == 'x64'
run: |
_PYTHON_HOST_PLATFORM="macosx-13.0-x86_64"
echo "_PYTHON_HOST_PLATFORM=${_PYTHON_HOST_PLATFORM}" >> $GITHUB_ENV
PYTHON_VERSION_STR=$(python -c "import sys;print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
echo "PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -161,13 +170,22 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set python version and platform variables
- name: Detect if arm and set wheel variables
if: runner.arch == 'ARM64' || runner.arch == 'ARM64'
run: |
_PYTHON_HOST_PLATFORM="macosx-14.0-arm64"
echo "_PYTHON_HOST_PLATFORM=${_PYTHON_HOST_PLATFORM}" >> $GITHUB_ENV
PYTHON_VERSION_STR=$(python -c "import sys;print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
echo "PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> $GITHUB_ENV
- name: Detect if x64 and set build variables
if: runner.arch == 'x64'
run: |
_PYTHON_HOST_PLATFORM="macosx-13.0-x86_64"
echo "_PYTHON_HOST_PLATFORM=${_PYTHON_HOST_PLATFORM}" >> $GITHUB_ENV
PYTHON_VERSION_STR=$(python -c "import sys;print(f'cp{sys.version_info.major}{sys.version_info.minor}')")
echo "PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v4
with:
Expand Down
60 changes: 48 additions & 12 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

jobs:
build_and_test:
build:
name: Build, test and upload
strategy:
max-parallel: 1
Expand All @@ -29,6 +29,17 @@ jobs:
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
Expand All @@ -48,14 +59,11 @@ jobs:
cd ..
shell: cmd

- name: Build and test samseg python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- run: |
python -m pip wheel . -w .\dist --no-deps --verbose
python -m pip install . -f .\dist\

- name: Build wheel
run: |
python -m pip wheel . -w .\dist-%pythonVersionStr% --no-deps --verbose
python -m pip install . -f .\dist-%pythonVersionStr%\
#python -m pip install -r requirements.txt
#python -m pip install pytest
#python -m pip install tensorflow
Expand All @@ -74,13 +82,41 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-wheels
path: .\dist\*.whl
name: windows-wheels-${{ env.pythonVersionStr }}
path: .\dist-${{ env.pythonVersionStr }}\*.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

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 .\dist\*.whl -u __token__ -p "$env:PASSWORD"
python -m twine upload *.whl -u __token__ -p "$env:PASSWORD"
env:
PASSWORD: ${{ secrets.PYPI_TOKEN }}

0 comments on commit a241844

Please sign in to comment.