Skip to content

Commit

Permalink
[INFRA-34] Migrate CI from Travis to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
autophagy committed Apr 13, 2021
1 parent 0052bbc commit 1824168
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 17 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Continuous Integration"

on:
push:

jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']
env:
# For now, skip the integration tests, until we have a locally running
# Ververica Platform to integrate against.
SKIP_INTEGRATION_TESTS: 1
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: python -m unittest

- name: Build Source Distribution
run: python setup.py sdist

- name: Build Docker Image
run: docker build --iidfile .imageid .
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

15 changes: 14 additions & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ In order to test the upload the TestPyPi index can be used, the command to uploa
Unit tests should be used to test functionality whereever possible.
If integration with Ververica Platform needs to be tested, integration tests should be used.
One of the integration tests executes example notebooks, so those should also be updated when any changes are made.
The integration tests are currently not executed by travis, and only run locally.
The integration tests are currently not executed by the CI, and only run locally.

To run the unittests and the integration tests:
```
python -m unittests
```

To only run the unittests (in the case of no available Ververica Platform to
integrate against), export the `SKIP_INTEGRATION_TESTS` environment variable:
```
export SKIP_INTEGRATION_TESTS=1
python -m unittests
```


### Versioning

Expand Down
4 changes: 2 additions & 2 deletions integration_test/test_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor

travis = os.environ.get('TRAVIS', False)
SKIP_INTEGRATION_TESTS = os.environ.get('SKIP_INTEGRATION_TESTS', False)


def run_notebook(notebook_path):
Expand All @@ -30,9 +30,9 @@ def run_notebook(notebook_path):
return nb, errors


@unittest.skipIf(SKIP_INTEGRATION_TESTS, 'Requires locally running VVP backend.')
class IntegrationTest(unittest.TestCase):

@unittest.skipIf(travis, 'Requires locally running VVP backend.')
def test_connect_notebook(self):
notebook_path = os.path.dirname(__file__) + "/../example_notebooks/"
files = [item for item in os.listdir(notebook_path) if os.path.isfile(os.path.join(notebook_path, item))]
Expand Down
6 changes: 2 additions & 4 deletions integration_test/test_vvpmagics_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
from jupytervvp import VvpMagics
from jupytervvp.vvpsession import VvpSession

travis = os.environ.get('TRAVIS', False)
SKIP_INTEGRATION_TESTS = os.environ.get('SKIP_INTEGRATION_TESTS', False)


def random_string():
return ''.join(random.choices(string.digits + "abcdef", k=4))


@unittest.skipIf(SKIP_INTEGRATION_TESTS, 'Requires locally running VVP backend.')
class VvpMagicsTestsAgainstBackend(unittest.TestCase):
ipython_session = None

Expand All @@ -29,7 +30,6 @@ def setUp(self):
VvpSession._sessions = {}
VvpSession.default_session_name = None

@unittest.skipIf(travis, 'Requires locally running VVP backend.')
def test_flink_sql_executes_show_tables(self):
magics = VvpMagics()
connect_magic_line = "localhost -n default -p 8280 -s session1"
Expand All @@ -41,7 +41,6 @@ def test_flink_sql_executes_show_tables(self):
response = magics.flink_sql(sql_magic_line, sql_magic_cell)
assert "table name" in response.columns

@unittest.skipIf(travis, 'Requires locally running VVP backend.')
def test_flink_sql_executes_create_table(self):
magics = VvpMagics()
connect_magic_line = "localhost -n default -p 8280 -s session1"
Expand All @@ -64,7 +63,6 @@ def test_flink_sql_executes_create_table(self):
response = magics.flink_sql(sql_magic_line, sql_magic_cell)
assert response['result'] == 'RESULT_SUCCESS'

@unittest.skipIf(travis, 'Requires locally running VVP backend.')
def test_flink_sql_executes_insert(self):
magics = VvpMagics()
connect_magic_line = "localhost -n default -p 8280 -s session1"
Expand Down

0 comments on commit 1824168

Please sign in to comment.