Skip to content

Commit

Permalink
adding github actions unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dfm committed Mar 17, 2021
1 parent 59ac111 commit a5bd694
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Tests
on:
push:
branches: [master]
pull_request:
release:
types: [published]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9"]

steps:
- uses: actions/checkout@v2

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

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install ".[test]"
- name: Run the unit tests
run: python -m pytest -v test

- uses: actions/upload-artifact@v2
with:
path: ./result_images

dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: "3.9"

- name: Build
run: |
python -m pip install -U pip
python -m pip install -U build
python -m build .
- name: Check the dist
run: |
python -m pip install twine
twine check dist/*
- uses: actions/upload-artifact@v2
with:
path: dist/*

upload_pypi:
needs: [tests, dist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
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 }}
# To test: repository_url: https://test.pypi.org/legacy/

0 comments on commit a5bd694

Please sign in to comment.