Skip to content

Commit

Permalink
publish releases from github actions
Browse files Browse the repository at this point in the history
and run tests on gha instead of travis
  • Loading branch information
minrk committed Mar 30, 2021
1 parent 405e00e commit 716f0ba
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 49 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Build releases and (on tags) publish to PyPI
name: Release

# always build releases (to make sure wheel-building works)
# but only publish to PyPI on tags
on:
push:
pull_request:

jobs:
build-release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: install build package
run: |
pip install --upgrade pip
pip install build
pip freeze
- name: build release
run: |
python -m build --sdist --wheel .
ls -l dist
- name: publish to pypi
uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.pypi_password }}
64 changes: 64 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test

on:
pull_request:
push:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

test:
runs-on: ${{ matrix.os }}

strategy:
# Keep running even if one variation of the job fail
fail-fast: false
matrix:
os:
- ubuntu-20.04
python:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
include:
- os: macos-latest
python: 3.8

steps:
- uses: actions/checkout@v2

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

# preserve pip cache to speed up installation
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('*requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install --upgrade --pre -r dev-requirements.txt .
pip freeze
- name: Run tests
run: |
pytest -v --color=yes --cov=wurlitzer test.py
- name: Submit codecov report
run: |
codecov
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
codecov
mock
mock # python_version < '3.0'
pytest>=2.8
pytest-cov
5 changes: 1 addition & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
set -e

bumpversion release --tag
py.test test.py
python setup.py sdist bdist_wheel
twine upload dist/*
bumpversion patch

git push --follow-tags
5 changes: 4 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import time
from tempfile import TemporaryFile

import mock
try:
from unitest import mock
except ImportError:
import mock

from wurlitzer import (
PIPE,
Expand Down

0 comments on commit 716f0ba

Please sign in to comment.