Skip to content

2.0.5 release

2.0.5 release #38

Workflow file for this run

# This workflow will install Python dependencies, run tests and converage with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Run tests
on:
pull_request:
push:
branches:
- master
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
name: Cache pip directory
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.9
- uses: actions/cache@v2
name: Cache poetry deps
with:
path: .venv
key: ${{ runner.os }}-build-${{ hashFiles('poetry.lock') }}-3.9
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Lint
run: |
poetry run python -m flake8 sh.py tests/*.py
poetry run black --check --diff sh.py tests/*.py
poetry run rstcheck README.rst
poetry run mypy sh.py
test:
name: Run tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
use-select: [0, 1]
lang: [C, en_US.UTF-8]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
name: Cache pip directory
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-3.9
- uses: actions/cache@v2
name: Cache poetry deps
env:
cache-name: poetry-deps
with:
path: .venv
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('poetry.lock') }}-${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry config virtualenvs.in-project true
poetry install
- name: Run tests
run: |
SH_TESTS_RUNNING=1 SH_TESTS_USE_SELECT=${{ matrix.use-select }} LANG=${{ matrix.lang }} poetry run coverage run -a -m unittest
- name: Store coverage
uses: actions/upload-artifact@v2
with:
name: coverage.${{ matrix.use-select }}.${{ matrix.lang }}.${{ matrix.python-version }}
path: .coverage
report:
name: Report Coverage
needs: test
runs-on: ubuntu-latest
steps:
# required because coveralls complains if we're not in a git dir
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install coverage coveralls
- name: Download coverage artifacts
uses: actions/download-artifact@v2
with:
path: coverage-artifacts
- name: Combine coverage
run: |
find coverage-artifacts -name .coverage | xargs coverage combine -a
- name: Report coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage report
coveralls --service=github
deploy:
name: Deploy
needs: test
runs-on: ubuntu-latest
if: github.ref_name == 'master'
steps:
- uses: actions/checkout@v2
- name: Get current version
id: get_version
run: echo "::set-output name=version::$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml)"
- name: Tag commit
run: |
git tag "${{steps.get_version.outputs.version}}" "${{github.ref_name}}"
git push -f origin "${{steps.get_version.outputs.version}}"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install build
- name: Build
run: python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}