Skip to content

Commit

Permalink
Add github actions
Browse files Browse the repository at this point in the history
- Static Analysis & Test
- PyPi release
  • Loading branch information
MHendricks committed Aug 5, 2022
1 parent f539d39 commit bf69ed1
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
on:
release:
types: [created]

jobs:

build-and-publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel twine
- name: Build wheel
run: |
python setup.py build bdist_wheel
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --verbose dist/*
71 changes: 71 additions & 0 deletions .github/workflows/python-static-analysis-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Static Analysis & Test

on: [push, pull_request]

jobs:

static-analysis:

# We want to run on external PRs, but not on our own internal PRs as they'll
# be run by the push to the branch. Without this if check, checks are
# duplicated since internal PRs match both the push and pull_request events.
# https://github.com/psf/black/blob/f51e53726b39a177355a7917c91c56f390dda7ef/.github/workflows/lint.yml#L7-L12
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Lint with flake8
run: tox -e flake8

- name: Format with black
run: tox -e black


# test:

# # We want to run on external PRs, but not on our own internal PRs as they'll
# # be run by the push to the branch. Without this if check, checks are
# # duplicated since internal PRs match both the push and pull_request events.
# if:
# github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
# github.repository

# runs-on: ubuntu-latest

# strategy:
# matrix:
# python: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]

# steps:
# - name: Checkout code
# uses: actions/checkout@v2

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

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install tox

# - name: Run Tox
# run: |
# tox -e py

0 comments on commit bf69ed1

Please sign in to comment.