Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github CI workflow for every push commit #10

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: on push
on: [push]

jobs:
lint: # fail-fast on linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python ${{ matrix.target.python }}
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: pip

- run: make install-deps

- name: "lint: black"
run: make black
- name: "lint: isort"
run: make isort

build:
strategy:
matrix:
target:
- {python: "3.6.15", ubuntu: "20.04"}
- {python: "3.10.12", ubuntu: "latest"}
clickhouse:
- "21.8.15.7"
- "22.3.20.29"
- "22.8.19.10"
- "23.3.4.17"
- "23.4.4.16"
- "23.5.3.24"
- "latest"
runs-on: ubuntu-${{ matrix.target.ubuntu }}
steps:
- uses: actions/checkout@v3
- name: set up python ${{ matrix.target.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.target.python }}
cache: pip

- run: make install-deps
- run: make build-python-package

- name: upload wheel
uses: actions/upload-artifact@v3
with:
path: dist/*.whl
if-no-files-found: error

- name: upload sdist
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
if-no-files-found: error

- name: run unit tests
run: make test-unit

- name: prepare docker images for integration tests
run: CLICKHOUSE_VERSION=${{ matrix.clickhouse }} make test-integration-prepare

- name: run integration tests
run: make test-integration

- name: publish test report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: 'tests/reports/*.xml'
78 changes: 4 additions & 74 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,81 +1,11 @@
# MacOS
.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# pyenv
.python-version

# poetry
poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Environments
.env
.venv
env/
__pycache__
venv/
ENV/
env.bak/
venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# JetBrains IDEs
.idea
tests/staging/
tests/reports/
.session_conf.sav
File renamed without changes.
File renamed without changes.
34 changes: 27 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,42 @@ prepare-version: version.txt
version.txt:
@echo "2.$$(git rev-list HEAD --count).$$(git rev-parse --short HEAD | perl -ne 'print hex $$_')" > $@

install-deps:
pip install flit
pip install ".[test]"

.PHONY: build-deb-package
build-deb-package: prepare-changelog
@echo 'Building debian package'
lint: black isort #pylint mypy bandit

rm -f pyproject.toml # for forcing usage of setup.py
cd debian && \
debuild --check-dirname-level 0 --preserve-env --no-lintian --no-tgz-check -uc -us
black: install-deps
black --check src/ tests/
dstaroff marked this conversation as resolved.
Show resolved Hide resolved
isort: install-deps
isort src/ tests/
dstaroff marked this conversation as resolved.
Show resolved Hide resolved

build-python-package: install-deps $(dist/*)
flit build --no-use-vcs

build-deb-package: install-deps prepare-changelog
cd debian && debuild --check-dirname-level 0 --preserve-env --no-lintian --no-tgz-check -uc -us

test-unit: install-deps
pytest tests/unit

export CLICKHOUSE_VERSION?=latest

test-integration-prepare: install-deps build-python-package
cp dist/*.whl tests/ && \
cd tests && \
CLICKHOUSE_VERSION=${CLICKHOUSE_VERSION} python3 -m env_control create

test-integration: test-integration-prepare
cd tests && \
behave --show-timings -D skip_setup --junit

.PHONY: clean
clean:
@echo 'Cleaning up'

rm -f version.txt
rm -rf venv
rm -rf build
rm -rf dist
rm -rf *.egg-info
Expand Down
File renamed without changes.
Loading