Skip to content

Commit

Permalink
Update actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBB committed Feb 21, 2024
1 parent 911572a commit c256608
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@ name: Python package
on:
push:
branches: [ master ]
tags: ['*']
pull_request:
branches: [ master ]
create:
tags:
workflow_dispatch:

jobs:

debug:
name: Debug
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3

test:
name: Test
runs-on: ${{ matrix.os }}
Expand All @@ -19,9 +24,9 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -40,14 +45,14 @@ jobs:
name: Build wheels
needs: [test]
runs-on: ${{ matrix.os }}
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
Expand All @@ -59,41 +64,42 @@ jobs:
env:
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
CIBW_SKIP: '*musllinux* *i686*'
# CIBW_BEFORE_BUILD: pip install -r requirements.dev.txt
- uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build sdist
needs: [test]
runs-on: ubuntu-latest
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel poetry
- name: Build sdist
run: make sdist
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*.tar.gz

deploy:
name: Deploy
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
Expand All @@ -105,10 +111,10 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
Expand Down

0 comments on commit c256608

Please sign in to comment.