Skip to content

CI - Python 2.7

CI - Python 2.7 #26

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI - Python 2.7
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'
jobs:
lint_test_smoke:
runs-on: ubuntu-24.04
container:
image: python:2.7-slim
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
# Update sources to use Debian archive since Buster is EOL
sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list
sed -i '/security.debian.org/d' /etc/apt/sources.list
sed -i '/stretch-updates/d' /etc/apt/sources.list
sed -i '/buster-updates/d' /etc/apt/sources.list
mkdir -p /usr/share/man/man1
apt-get update
apt-get install -y curl netcat-openbsd sudo git gcc python-dev ant wget
# Use JDK 8 manually ( bc https://bugs.openjdk.org/browse/JDK-8287073 )
JDK8_URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u432-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u432b06.tar.gz"
JDK8_SHA256="abaaa90deadf51bd28921453baf2992b3dff6171bb7142f5bdd14ef269f7b245"
wget -q "$JDK8_URL" -O jdk8.tar.gz
echo "$JDK8_SHA256 jdk8.tar.gz" | sha256sum -c -
tar -xzf jdk8.tar.gz -C /usr/lib/jvm/
mv /usr/lib/jvm/jdk8u432-b06 /usr/lib/jvm/java-8-openjdk-amd64
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-openjdk-amd64/bin/java 1
update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/bin/java
rm jdk8.tar.gz
- name: Set up Python environment
run: |
python -m pip install --upgrade 'pip<21.0' 'setuptools<45' 'wheel<0.35'
mkdir -p /github/home/.cache/pip
pip install -r requirements.txt
pip install 'pylint==1.9.5'
- name: Run linter
run: |
pylint --output-format msvs --reports y ccmlib || true
pylint --output-format msvs --reports y tests || true
- name: Smoke tests
shell: bash
run: |
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# hack to fix setup.cfg not being parsed by pbr (FIXME why isn't pbr working...)
export PBR_VERSION=$(grep version setup.cfg | awk -F= '{print $2}' | xargs)
./setup.py install
set -x
LATEST_4_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '4\.0\.[0-9]+' | sort -V | tail -1)
LATEST_4_1=$(curl -s https://downloads.apache.org/cassandra/ | grep -oE '4\.1\.[0-9]+' | sort -V | tail -1)
ccm_test() {
for i in {1..9}; do
echo "Checking nc -z 127.0.0.1 7000"
while nc -z 127.0.0.1 7000 ; do echo . ; ./ccm stop || true ; sleep 1 ; done
if ./ccm start -v --root; then
./ccm remove && return 0
else
echo "=== Start failed, showing logs ==="
find ~/.ccm -name "startup-*-stderr.log" -o -name "startup-*-stdout.log" -o -name "system.log" | while read f; do
echo "=== $f ==="
tail -100 "$f" 2>/dev/null || true
done
echo "=== Retrying in 20 seconds ==="
sleep 20
fi
done
echo "ccm start failed after 9 attempts"
exit 1
}
export -f ccm_test
./ccm create -h
./ccm create test -v ${LATEST_4_0} -n1 --vnodes --quiet
ccm_test
./ccm create test -v ${LATEST_4_1} -n1 --vnodes --quiet
ccm_test
./ccm create test --version='git:cassandra-4.0' -n1 --vnodes --quiet
ccm_test
./ccm create test --version='git:cassandra-4.1' -n1 --vnodes --quiet
ccm_test
- name: Publish Test Report
uses: mikepenz/action-junit-report@v5
if: always()
with:
report_paths: 'junit.xml'
annotate_only: true