Skip to content

Add tests

Add tests #19

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
concurrency:
group: CI-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install poetry
run: pip install "poetry==1.4.2"
- name: Install dependencies
run: poetry install
- name: Lint
run: |
poetry run ruff keycmd
poetry run black --check keycmd
test:
name: Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install poetry
run: pip install "poetry==1.4.2"
- name: Install dependencies
run: poetry install
- name: Test
run: |
poetry run pytest -v tests
build:
name: Build and check wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install poetry
run: pip install "poetry==1.4.2"
- name: Install dependencies
run: poetry install
- name: Build wheel
run: poetry build
- name: Twine check
run: poetry run twine check dist/*
- name: Upload wheel artifact
uses: actions/upload-artifact@v2
with:
path: dist
name: dist
publish:
name: Publish release to Github and Pypi
runs-on: ubuntu-latest
needs: [lint, test, build]
if: success() && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Download assets
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
dist/*.tar.gz
dist/*.whl
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}