Skip to content

Commit

Permalink
basic ci for pushes (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
myrrc authored Jul 6, 2023
1 parent 5c0dd17 commit a7a3efc
Show file tree
Hide file tree
Showing 21 changed files with 197 additions and 412 deletions.
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/
isort: install-deps
isort src/ tests/

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

0 comments on commit a7a3efc

Please sign in to comment.