Skip to content

Commit 1b348f8

Browse files
Add github actions for different python versions (and C* 4.0, 4.1, and trunk)
Also always test the latest patch versions patch by Mick Semb Wever; reviewed by Dmitry Kropachev
1 parent 0e20102 commit 1b348f8

File tree

4 files changed

+132
-25
lines changed

4 files changed

+132
-25
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
name: CI - Python 2.7
18+
19+
on:
20+
push:
21+
pull_request:
22+
workflow_dispatch:
23+
24+
jobs:
25+
lint_test_smoke:
26+
runs-on: ubuntu-24.04
27+
container:
28+
image: python:2.7-slim
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- name: Install system dependencies
34+
run: |
35+
# Update sources to use Debian archive since Buster is EOL
36+
sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list
37+
sed -i '/security.debian.org/d' /etc/apt/sources.list
38+
sed -i '/stretch-updates/d' /etc/apt/sources.list
39+
sed -i '/buster-updates/d' /etc/apt/sources.list
40+
mkdir -p /usr/share/man/man1
41+
apt-get update
42+
apt-get install -y curl netcat-openbsd sudo git gcc python-dev openjdk-11-jdk-headless ant
43+
44+
- name: Set up Python environment
45+
run: |
46+
python -m pip install --upgrade 'pip<21.0' 'setuptools<45' 'wheel<0.35'
47+
mkdir -p /github/home/.cache/pip
48+
pip install -r requirements.txt
49+
pip install 'pylint==1.9.5'
50+
51+
- name: Run linter
52+
run: |
53+
pylint --output-format msvs --reports y ccmlib || true
54+
pylint --output-format msvs --reports y tests || true
55+
56+
- name: Smoke tests
57+
shell: bash
58+
run: |
59+
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
60+
# hack to fix setup.cfg not being parsed by pbr (FIXME why isn't pbr working...)
61+
export PBR_VERSION=$(grep version setup.cfg | awk -F= '{print $2}' | xargs)
62+
./setup.py install
63+
set -x
64+
LATEST_4_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '4\.0\.[0-9]+' | sort -V | tail -1)
65+
LATEST_4_1=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '4\.1\.[0-9]+' | sort -V | tail -1)
66+
ccm_test() {
67+
for i in {1..9}; do
68+
echo "Checking nc -z 127.0.0.1 7000"
69+
while nc -z 127.0.0.1 7000 ; do echo . ; ./ccm stop || true ; sleep 1 ; done
70+
./ccm start -v --root && ./ccm remove && return 0 || echo retrying
71+
sleep 20
72+
done
73+
echo "ccm start failed after 9 attempts"
74+
exit 1
75+
}
76+
export -f ccm_test
77+
./ccm create -h
78+
./ccm create test -v ${LATEST_4_0} -n1 --vnodes --quiet
79+
ccm_test
80+
./ccm create test -v ${LATEST_4_1} -n1 --vnodes --quiet
81+
ccm_test
82+
./ccm create test --version='git:cassandra-4.0' -n1 --vnodes --quiet
83+
ccm_test
84+
./ccm create test --version='git:cassandra-4.1' -n1 --vnodes --quiet
85+
ccm_test
86+
87+
- name: Publish Test Report
88+
uses: mikepenz/action-junit-report@v5
89+
if: always()
90+
with:
91+
report_paths: 'junit.xml'
92+
annotate_only: true

.github/workflows/main.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,38 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
name: CI
17+
name: CI - Python 3.x
1818

1919
on:
2020
push:
2121
pull_request:
2222
workflow_dispatch:
2323

2424
jobs:
25-
build:
25+
lint_test_smoke:
2626
runs-on: ubuntu-24.04
27+
strategy:
28+
matrix:
29+
python-version: ['3.8', '3.11'] # TODO add '3.12' '3.13' '3.14'
30+
fail-fast: false
2731

2832
steps:
2933
- uses: actions/checkout@v4
3034

31-
- name: Create virtual environment
32-
run: python -m venv venv
33-
34-
- name: Activate virtual environment
35-
run: source venv/bin/activate
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: ${{ matrix.python-version }}
3639

37-
- name: Install dependencies
38-
run: pip install -r requirements.txt && pip install -r tests/requirements.txt
40+
- name: Set up Python environment
41+
run: |
42+
pip install --upgrade pip
43+
pip install -r requirements.txt && pip install -r tests/requirements.txt
3944
4045
- name: Run linter
41-
run: pylint --output-format msvs --reports y ccmlib || true
42-
43-
- name: Run linter for tests
44-
run: pylint --output-format msvs --reports y tests || true
46+
run: |
47+
pylint --output-format msvs --reports y ccmlib || true
48+
pylint --output-format msvs --reports y tests || true
4549
4650
- name: Run tests
4751
run: |
@@ -51,27 +55,39 @@ jobs:
5155
run: |
5256
sudo ./setup.py install
5357
set -x
54-
58+
LATEST_4_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '4\.0\.[0-9]+' | sort -V | tail -1)
59+
LATEST_4_1=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '4\.1\.[0-9]+' | sort -V | tail -1)
60+
LATEST_5_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '5\.0\.[0-9]+' | sort -V | tail -1)
5561
ccm_test() {
56-
for i in {1..9}; do
62+
for i in {1..9}; do
5763
echo "Checking nc -z 127.0.0.1 7000"
5864
while nc -z 127.0.0.1 7000 ; do echo . ; ./ccm stop || true ; sleep 1 ; done
59-
./ccm start && ./ccm remove && return 0 || echo retrying
65+
./ccm start -v && ./ccm remove && return 0 || echo retrying
6066
sleep 20
6167
done
6268
echo "ccm start failed after 9 attempts"
6369
exit 1
6470
}
6571
export -f ccm_test
6672
./ccm create -h
67-
./ccm create test -v 5.0.3 -n1 --vnodes --quiet
73+
./ccm create test -v ${LATEST_4_0} -n1 --vnodes --quiet
74+
ccm_test
75+
./ccm create test -v ${LATEST_4_1} -n1 --vnodes --quiet
76+
ccm_test
77+
./ccm create test -v ${LATEST_5_0} -n1 --vnodes --quiet
78+
ccm_test
79+
./ccm create test --version='git:cassandra-4.0' -n1 --vnodes --quiet
80+
ccm_test
81+
./ccm create test --version='git:cassandra-4.1' -n1 --vnodes --quiet
82+
ccm_test
83+
./ccm create test --version='git:cassandra-5.0' -n1 --vnodes --quiet
6884
ccm_test
69-
./ccm create test --version='git:cassandra-5.0.3' -n1 --vnodes --quiet
85+
./ccm create test --version='git:trunk' -n1 --vnodes --quiet
7086
ccm_test
7187
./ccm create test -v 6.8.54 -n1 --vnodes --dse --quiet
7288
ccm_test
7389
74-
# todo, when available
90+
# todo, when hcd is available
7591
#./ccm create test -v 1.1.0 -n1 --vnodes --hcd --quiet
7692
#ccm_test
7793

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
pyYaml
17+
pyYaml<5.4; python_version < '3'
18+
pyYaml; python_version >= '3'
1819
six >=1.4.1
1920
psutil
2021

setup.cfg

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name=ccm
33
version=3.1.6
44
description=Cassandra Cluster Manager
5-
url='https://github.com/riptano/ccm'
5+
url='https://github.com/apache/cassandra-ccm'
66
description-file = README.md
77
description-content-type = text/markdown; charset=UTF-8
88
classifier=
@@ -11,10 +11,8 @@ classifier=
1111
'Programming Language :: Python :: 2',
1212
'Programming Language :: Python :: 2.7',
1313
'Programming Language :: Python :: 3',
14-
'Programming Language :: Python :: 3.3',
15-
'Programming Language :: Python :: 3.4',
16-
'Programming Language :: Python :: 3.5',
17-
'Programming Language :: Python :: 3.6'
14+
'Programming Language :: Python :: 3.8',
15+
'Programming Language :: Python :: 3.11'
1816

1917
[pbr]
2018
skip_authors=1

0 commit comments

Comments
 (0)