-
Notifications
You must be signed in to change notification settings - Fork 7
142 lines (127 loc) · 4.07 KB
/
workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: main
on:
push: { branches: [main] }
pull_request: { branches: [main] }
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with: { python-version: "3.11", cache: pip }
- run: pip install .[test]
- {name: "lint: black", run: black --check --diff . }
- {name: "lint: isort", run: isort --check --diff . }
# Temporarily disabled due to bugs in typing in click library
# https://github.com/pallets/click/pull/2559
# https://github.com/python/mypy/issues/13250
# https://github.com/python/mypy/issues/13449
#- {name: "lint: mypy", run: make mypy }
push_to_dockerhub:
runs-on: ubuntu-latest
env:
CLICKHOUSE_VERSIONS: "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"
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
- name: login to dockerhub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and push base images
uses: docker/bake-action@v3
with:
files: tests/bake.hcl
push: true
build:
needs: lint
strategy:
matrix:
target:
- {python: "3.6.15", ubuntu: "20.04"}
- {python: "3.10.12", ubuntu: "latest"}
# a copy-paste of the above as github CI can't use env context in matrices
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
- name: install dependencies
# language=sh
run: |
pip install '.[test]'
- name: build project
# language=sh
run: |
make prepare-version
flit build --no-use-vcs
- name: upload wheel
uses: actions/upload-artifact@v3
if: ${{ matrix.clickhouse == 'latest' }}
with:
name: chtools_py${{ matrix.target.python }}.whl
path: dist/*.whl
if-no-files-found: error
- name: upload sdist
uses: actions/upload-artifact@v3
if: ${{ matrix.clickhouse == 'latest' }}
with:
name: chtools_py${{ matrix.target.python }}.tar.gz
path: dist/*.tar.gz
if-no-files-found: error
- {name: run unit tests, run: pytest}
- name: prepare integration tests
# language=sh
run: |
cd tests
CLICKHOUSE_VERSION=${{ matrix.clickhouse }} python3 -m env_control create
cd ..
- name: run integration tests
# language=sh
run: |
cd tests
behave --show-timings --junit -D skip_setup
cd ..
- name: publish test report
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: 'tests/reports/*.xml'
- name: build debian package
# language=sh
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y git python3 python3-venv python3-pip debhelper devscripts
cp dist/*.tar.gz chtools.tar.gz
sudo make clean build-deb-package
- name: test debian package
# language=sh
run: |
sudo make uninstall
sudo apt-get install -q -y ./out/mdb-ch-tools*.deb
sudo chadmin --help
sudo ch-monitoring --no-user-check --help
sudo keeper-monitoring --help
sudo ch-s3-credentials --help
- name: upload deb package artifact
uses: actions/upload-artifact@v3
if: ${{ matrix.clickhouse == 'latest' }}
with:
name: mdb-ch-tools_py-${{ matrix.target.python }}_ubuntu-${{ matrix.target.ubuntu }}.deb
path: out/mdb-ch-tools*.deb
if-no-files-found: error