diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 8992e4a9e..000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - PYTHON: "C:\\Python36-x64" - PYTHON_VERSION: "3.6.*" - PYTHON_ARCH: "64" - -install: - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - "echo %PYTHON%" - # - "python -m pip install --disable-pip-version-check --user --upgrade pip" - - "pip3 install -e ." - - "pip3 install -r test-requirements.txt" - -build: off - -test_script: - - "python runtests.py" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..646167a71 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,78 @@ +on: [pull_request] +name: CI +jobs: + # run python/js tests, coveralls and lint + integration-test: + name: python ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + services: + postgres: + image: postgres:11 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: ci_db_test + ports: + - 5432:5432 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-20.04 + python-version: + - 3.6 + - 3.7 + - 3.8 + - 3.9 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Set up ruby for coveralls + uses: actions/setup-ruby@v1 + - name: Set up js + uses: actions/setup-node@v1 + - name: Install js dependencies + run: npm install jasmine-core@2.3.4 karma@1.5 karma-coverage@1.1.1 karma-jasmine@0.3.8 karma-firefox-launcher@2.1.0 karma-coveralls@1.1.2 + - name: Install opal + run: pip install -e . + - name: Install dependencies + run: pip install -r test-requirements.txt + - run: gem install coveralls-lcov + - name: run tests + run: opal test --coverage + - name: flake8 + run: flake8 + - name: combine coveralls + run: find coverage -name "lcov.info" -exec coveralls-lcov -v -n {} \; > coverage/coverage.json + - run: coveralls --merge=coverage/coverage.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}" + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + # make sure the python side of things works on windows + other-os-tests: + name: ${{ matrix.os }} python ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - windows-latest + python-version: + - 3.9 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install opal + run: pip install -e . + - name: Install dependencies + run: pip install -r test-requirements.txt + - name: run tests + run: opal test py diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 189af0cc3..000000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python -dist: xenial -python: - - "3.6" - - "3.7" - - "3.8" - -services: - - postgresql - - xvfb -install: - - python setup.py develop - - gem install coveralls-lcov - - pip install -r test-requirements.txt - - npm install jasmine-core@2.3.4 karma@1.5 karma-coverage@1.1.1 karma-jasmine@0.3.8 karma-firefox-launcher@1.0.0 karma-coveralls@1.1.2 - - gem install rake -before_script: - - psql -c 'create database travis_ci_test;' -U postgres -script: - - opal test --coverage - - flake8 -after_success: - - ls -lha coverage - - coveralls-lcov -v -n coverage/Firefox\ 56.0.0\ \(Linux\ 0.0.0\)/lcov.info > coverage/coverage.json - - cat coverage/coverage.json - - coveralls debug --merge=coverage/coverage.json - - coveralls --merge=coverage/coverage.json -notifications: - slack: ohcuk:6spaME3CB7f2PGrMAcklYWqp -sudo: false diff --git a/README.md b/README.md index 2708783fa..dc1dfa3ee 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ Opal ==== -[![Build Status](https://travis-ci.org/openhealthcare/opal.svg?branch=v0.11.0)](https://travis-ci.org/openhealthcare/opal) +![Build](https://github.com/openhealthcare/opal/workflows/.github/workflows/build.yml/badge.svg) + [![Coverage Status](https://coveralls.io/repos/github/openhealthcare/opal/badge.svg?branch=v0.11.0)](https://coveralls.io/github/openhealthcare/opal?branch=v0.11.0) -[![PyPI version](https://badge.fury.io/py/opal.svg)](https://badge.fury.io/py/opal) +[![PyPI version](https://badge.fury.io/py/opal.svg)](https://badge.fury.io/py/opal) Opal is a full stack web framework that makes building digital tools for health care easy. diff --git a/opal/core/test_runner.py b/opal/core/test_runner.py index 438d3e78a..69efdb473 100644 --- a/opal/core/test_runner.py +++ b/opal/core/test_runner.py @@ -10,7 +10,10 @@ from opal.utils import write -TRAVIS = os.environ.get('TRAVIS', False) +# We're using the GITHUB_WORKFLOW env variable +# to determine that we are running in a github action. +# GITHUB_WORKFLOW is set in the env by github. +GITHUB_ACTION = os.environ.get('GITHUB_WORKFLOW', False) def _has_file(where, filename): @@ -84,7 +87,7 @@ def _run_js_tests(args): # to a string env["OPAL_LOCATION"] = str(args.opal_location) - if TRAVIS: + if GITHUB_ACTION: karma = './node_modules/karma/bin/karma' else: karma = 'karma' diff --git a/opal/tests/js_config/karma_defaults.js b/opal/tests/js_config/karma_defaults.js index aa29b451a..20a9bdf8b 100644 --- a/opal/tests/js_config/karma_defaults.js +++ b/opal/tests/js_config/karma_defaults.js @@ -63,8 +63,8 @@ module.exports = function(includedFiles, baseDir, coverageFiles){ } ]; - if(process.env.TRAVIS){ - browsers = ["Firefox"]; + if(process.env.GITHUB_WORKFLOW){ + browsers = ["FirefoxHeadless"]; plugins.push("karma-firefox-launcher"); plugins.push("karma-coveralls"); if(useCoverage){ diff --git a/opal/tests/test_core_test_runner.py b/opal/tests/test_core_test_runner.py index 9acb7ed1a..ab1136f01 100644 --- a/opal/tests/test_core_test_runner.py +++ b/opal/tests/test_core_test_runner.py @@ -10,6 +10,7 @@ from opal.core import test_runner + class RunPyTestsTestCase(OpalTestCase): @patch('subprocess.check_call') @@ -148,10 +149,10 @@ def test_run_tests_for_unknown_config(self, sysexit, writer, has_file): class RunJSTestsTestCase(OpalTestCase): def setUp(self): - self.TRAVIS = test_runner.TRAVIS + self.GITHUB_ACTION = test_runner.GITHUB_ACTION def tearDown(self): - test_runner.TRAVIS = self.TRAVIS + test_runner.GITHUB_ACTION = self.GITHUB_ACTION @patch('subprocess.check_call') def test_run_tests(self, check_call): @@ -160,7 +161,7 @@ def test_run_tests(self, check_call): mock_args.coverage = False mock_args.test = None mock_args.failfast = False - test_runner.TRAVIS = False + test_runner.GITHUB_ACTION = False test_runner._run_js_tests(mock_args) self.assertEqual( ['karma', 'start', 'config/karma.conf.js', '--single-run'], @@ -168,13 +169,13 @@ def test_run_tests(self, check_call): ) @patch('subprocess.check_call') - def test_run_tests_travis(self, check_call): + def test_run_tests_github(self, check_call): mock_args = MagicMock(name="args") mock_args.userland_here = ffs.Path('.') mock_args.coverage = False mock_args.test = None mock_args.failfast = False - test_runner.TRAVIS = True + test_runner.GITHUB_ACTION = True test_runner._run_js_tests(mock_args) self.assertEqual( [ @@ -198,7 +199,7 @@ def test_run_tests_failfast(self, check_call): mock_args.coverage = False mock_args.test = None mock_args.failfast = True - test_runner.TRAVIS = False + test_runner.GITHUB_ACTION = False test_runner._run_js_tests(mock_args) self.assertEqual( [ diff --git a/runtests.py b/runtests.py index 32d7ea6c8..d67b3286e 100644 --- a/runtests.py +++ b/runtests.py @@ -113,13 +113,13 @@ } ) -if 'TRAVIS' in os.environ: +if os.environ.get('GITHUB_WORKFLOW') and not os.environ.get('RUNNER_OS') == 'Windows': test_settings_config["DATABASES"] = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'travis_ci_test', + 'NAME': 'ci_db_test', 'USER': 'postgres', - 'PASSWORD': '', + 'PASSWORD': 'postgres', 'HOST': 'localhost', } } diff --git a/setup.py b/setup.py index e51441c82..01dcd2a9f 100644 --- a/setup.py +++ b/setup.py @@ -45,6 +45,8 @@ ] }, install_requires=[ + # We pin kombu because kombu 5.3 imports does not work on python 3.6.9 + 'kombu==5.1.0', 'ffs>=0.0.8.2', 'Jinja2==2.10.1', 'django==2.2.16',