Skip to content

Commit

Permalink
run sequential, split build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
oulap committed Sep 25, 2024
1 parent 0395a22 commit f66d69e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
61 changes: 51 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ on:
workflow_dispatch:

jobs:
example_matrix:
build:
name: Build and upload artefact
strategy:
matrix:
os: [macos-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]
max-parallel: 1

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -95,24 +97,63 @@ jobs:
_PYTHON_HOST_PLATFORM: ${{ env._PYTHON_HOST_PLATFORM }}
ARCHFLAGS: ${{ env.ARCHFLAGS }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-wheels
path: dist-${{ env.PYTHON_VERSION_STR }}-${{ env._PYTHON_HOST_PLATFORM }}/*.whl

test:
name: Test the wheel
needs: build
strategy:
matrix:
os: [macos-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11"]
max-parallel: 1
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: macos-wheels
path: ${{ github.workspace }}

- name: Python - set up ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install the wheel and test dependencies
run: |
python -m pip install samseg -f ./dist-${PYTHON_VERSION_STR}-${_PYTHON_HOST_PLATFORM}
python -m pip install samseg*.whl
python -m pip install pytest
python -m pip install tensorflow
python -m pytest samseg/tests
pytest tests -v
- name: Upload artifact
uses: actions/upload-artifact@v4
publish:
name: Publish the wheel
needs: test
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: macos-wheels
path: dist-${{ env.PYTHON_VERSION_STR }}-${{ env._PYTHON_HOST_PLATFORM }}/*.whl
path: ${{ github.workspace }}
- name: Python - set up 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- 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-${PYTHON_VERSION_STR}-${_PYTHON_HOST_PLATFORM}/*.whl -u __token__ -p "$PASSWORD"
python -m pip install twine
python -m twine upload *.whl -u __token__ -p "$PASSWORD"
env:
PASSWORD: ${{ secrets.PYPI_TOKEN }}
PYTHON: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
max-parallel: 1

runs-on: windows-2022

Expand Down

0 comments on commit f66d69e

Please sign in to comment.