Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions CI #771

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/riptano/ccm/blob/master/.travis.yml#L3

Travis has different versions, should we use different ones as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do we run Travis? GitHub actions uses the newest I think

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should converged, or remove, the travis stuff


- 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ccm.egg-info/
.coverage
dse_creds.txt
.eggs/
junit.xml
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
mock==5.1.0
pytest==8.2.1
requests==2.32.2
pylint==3.2.2
5 changes: 3 additions & 2 deletions tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down