Skip to content

Commit

Permalink
Add pypi workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRomualdi committed Mar 29, 2022
1 parent 55e4003 commit abe6aed
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/pypi-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Python CI/CD

on:
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
pull_request:
workflow_dispatch:
release:
types:
- published
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "weekly" build at 2 AM UTC on Thursday
- cron: '0 2 * * *'

jobs:

build_wheels:
name: Build wheels [${{ matrix.os }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.8
os:
- ubuntu-20.04
# - macos-latest
# - windows-latest

steps:

- uses: actions/checkout@master
- run: git fetch --prune --unshallow

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

- name: Install cibuildwheel
run: pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: cp37-* cp38-* cp39-*
CIBW_TEST_COMMAND: "python -c 'import icub_models'"

- uses: actions/upload-artifact@v2
with:
name: dist
path: ./wheelhouse/*.whl

upload_pypi:
needs:
- build_sdist
- build_wheels
runs-on: ubuntu-latest
# Devel branch produces pre-releases.
# Master branch produces stable releases linked to GitHub releases.

steps:

- uses: actions/download-artifact@v2
with:
name: dist
path: dist

- name: Inspect dist folder
run: ls -lah dist/

- uses: pypa/gh-action-pypi-publish@master
if: |
github.repository == 'robotology/icub-models' &&
((github.event_name == 'release' && github.event.action == 'published') ||
(github.event_name == 'push' && github.ref == 'refs/heads/devel'))
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

0 comments on commit abe6aed

Please sign in to comment.