diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..7cce7e64 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: [ master] + pull_request: + branches: [ master] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Create virtual environment + run: python -m venv venv + + - name: Activate virtual environment + run: source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt && pip install -r tests/requirements.txt + + - name: Run linter + run: pylint --output-format msvs --reports y ccmlib || true + + - name: Run linter for tests + run: pylint --output-format msvs --reports y tests || true + + - name: Run tests + run: | + pytest --junitxml=junit.xml tests + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v4 + if: always() + with: + report_paths: 'junit.xml' + annotate_only: true diff --git a/.gitignore b/.gitignore index b6fced1a..c74ccda7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ ccm.egg-info/ .coverage dse_creds.txt .eggs/ +junit.xml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 12e9e6f1..00000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -dist: xenial -language: python -python: - - "2.7.13" - - "3.6.10" - - "3.7.7" - - "3.8.2" -install: - - pip install pylint six pyyaml paramiko psutil -script: - - pylint --py3k --disable=W1633,W1648,W1662 ccmlib - - pylint --disable=all --enable=E,F ccmlib - - nosetests -jdk: - - openjdk11 -env: - - CASSANDRA_USE_JDK11=true -addons: - apt: - packages: - - ant - - ant-optional \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 00000000..73b16c00 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,4 @@ +mock==5.1.0 +pytest==8.2.1 +requests==2.32.2 +pylint==3.2.2 \ No newline at end of file diff --git a/tests/test_lib.py b/tests/test_lib.py index c54a8ea2..f7d2e41f 100644 --- a/tests/test_lib.py +++ b/tests/test_lib.py @@ -5,6 +5,7 @@ from distutils.version import LooseVersion # pylint: disable=import-error, no-name-in-module from pathlib import Path +import pytest import requests from six import StringIO @@ -206,7 +207,7 @@ def test_update_java_version(self): self._test_java_selection_fail("The version of java available on PATH 8 does not match the Java version of the distribution provided via JAVA_HOME 11", path_version=8, home_version=11, explicit_version=None, cassandra_versions=self.all_versions) self._test_java_selection_fail("JAVA_HOME must be defined if java command is available on the PATH", path_version=8, home_version=None, explicit_version=None, cassandra_versions=self.all_versions) - +@pytest.mark.skip(reason="this test is starting nodes - it needs to be refactored to use mocks instead") class TestCCMLib(ccmtest.Tester): def test2(self): self.cluster = Cluster(CLUSTER_PATH, "test2", version='git:trunk') @@ -302,7 +303,7 @@ def test_dc_mandatory_on_multidc(self): with self.assertRaisesRegexp(ccmlib.common.ArgumentError, 'Please specify the DC this node should be added to'): self.cluster.add(node3, is_seed=False) - +# TODO remove this unused class class TestRunCqlsh(ccmtest.Tester): def setUp(self):