Skip to content

Commit

Permalink
Add GHA script to build and test wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
lordmauve committed Apr 13, 2022
1 parent edef580 commit 96cfb3e
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI
on:
workflow_dispatch:
push:
release:
types:
- published

jobs:
dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install wheel and SDist requirements
run: python -m pip install "setuptools>=42.0" wheel

- name: Build packages
run: python setup.py sdist bdist_wheel

- uses: actions/upload-artifact@v3
with:
path: |
dist/*.tar.gz
dist/*.whl
test:
name: Run tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, windows-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v1
with:
submodules: true

- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'

- name: Install package and dependencies
run: |
python -m pip install -e .
python -m pip install -r requirements_dev.txt
- name: Run pytest
run: pytest
working-directory: tests

publish:
needs: [dist, test]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

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

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ __pycache__/
# C extensions
*.so

# Virtualenvs
venv/
.venv/

# Distribution / packaging
.Python
env/
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py36, py37, py38, py39, flake8
envlist = py37, py38, py39, py310, flake8

[testenv:flake8]
basepython=python
Expand Down

0 comments on commit 96cfb3e

Please sign in to comment.