From c9129a0426be98f58fe22a46ab3ff3f09123565c Mon Sep 17 00:00:00 2001 From: Florian Strzelecki Date: Sat, 11 Nov 2023 18:10:02 +0100 Subject: [PATCH] ci: add github CI for tests and lint --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ Makefile | 30 ++++++++++++++++++----------- 2 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9c7f8d5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +--- +name: CI + +on: + push: + branches: + - master + - v[0-9]+.[0-9]+.x + pull_request: + branches: + - master + - v[0-9]+.[0-9]+.x + +jobs: + tests: + if: ${{ github.repository_owner == 'sopel-irc' }} + name: Quality & Test Suite + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade wheel + python -m pip install --upgrade -r requirements.txt + python -m pip install -e . + - name: Lint + run: make lint + - name: Tests + run: make test diff --git a/Makefile b/Makefile index 22b5f17..d4d3f10 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,19 @@ -.PHONY: qa quality test coverages coverage_report coverage_html pylint +# Linters (check, style, and type in the future) +.PHONY: lint-check lint-style -quality: +lint-check: isort sopel_help flake8 +lint-style: + pylint sopel_help + pyroma . + +lint: lint-check lint-style + +# Tests (tests and coverage reports) +.PHONY: test coverage_report coverage_html coverages + test: coverage run -m pytest -v . @@ -15,20 +25,18 @@ coverage_html: coverages: coverage_report coverage_html -pylint: - pylint sopel_help - -pyroma: - pyroma . - -qa: quality test coverages pylint pyroma - -.PHONY: develop build +# Development cycle (local install, qa, build, and release on PyPI) +.PHONY: develop qa build develop: pip install -U -r requirements.txt pip install -e . +qa: lint-check test coverages lint-style + build: rm -rf build/ dist/ python -m build . + +release: + twine upload -r sopel-help dist/*