V0.0.1 test check #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: ['*'] | |
release: | |
types: [created] | |
jobs: | |
test-pytest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
pip install tox | |
- name: Install loggingredactor | |
run: | | |
pip install -e . | |
- name: Run pytest | |
run: tox -e py37 | |
test-flake8: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
pip install tox | |
- name: Install loggingredactor | |
run: | | |
pip install -e . | |
- name: Run flake8 | |
run: tox -e flake8 | |
tag: | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Git config | |
run: | | |
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" | |
git config --global user.name "${{ secrets.GIT_USER_NAME }}" | |
- name: Get version from setup.py | |
id: get_version | |
run: echo "::set-output name=version::$(python setup.py --version)" | |
- name: Create tag | |
run: | | |
git tag -a ${{ steps.get_version.outputs.version }} -m "Version created by GitHub Actions" | |
git push origin ${{ steps.get_version.outputs.version }} | |
pypi-package: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: pip install twine | |
- name: Build package | |
run: | | |
rm -f dist/* | |
python setup.py sdist bdist_wheel | |
- name: Publish to PyPI | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USER }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: twine upload dist/* |