From a36e69822bb686bbb6ae68b758a095e0b1c9f936 Mon Sep 17 00:00:00 2001 From: Oliver Margetts Date: Wed, 28 Jul 2021 21:43:21 +0000 Subject: [PATCH] Pipeline: add github workflows (#1) Tooling: add github actions * Add github actions to run pytest / flake8 / black * Use clickhouse:20.6 (tests fail with 21.x, 20.8) * Keep black away from pypy --- .github/workflows/python-package.yml | 63 ++++++++++++++++++++++++++++ pyproject.toml | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..a89172c --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,63 @@ +# This workflow will install Python dependencies, run tests and lint 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: Python package + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Lint on smallest and largest active versions + python-version: [3.6, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install poetry + poetry install + - name: Lint with flake8 + run: | + poetry run flake8 clickhouse_orm/ + cd tests && poetry run flake8 + - name: Check formatting with black + run: | + poetry run black --line-length 120 --check clickhouse_orm/ tests/ + + test: + runs-on: ubuntu-latest + services: + clickhouse: + image: yandex/clickhouse-server:20.6 + ports: + - 8123:8123 + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install poetry + poetry install + - name: Test with pytest + run: | + poetry run pytest diff --git a/pyproject.toml b/pyproject.toml index bb0cb22..d500cd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ flake8-bugbear = "^21.4.3" pep8-naming = "^0.12.0" pytest = "^6.2.4" flake8-isort = "^4.0.0" -black = "^21.7b0" +black = {version = "^21.7b0", markers = "platform_python_implementation == 'CPython'"} isort = "^5.9.2" freezegun = "^1.1.0"