Skip to content

Commit

Permalink
Merge bb909af into 9754979
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Dec 9, 2020
2 parents 9754979 + bb909af commit 802e277
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 65 deletions.
18 changes: 0 additions & 18 deletions .appveyor.yml

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,93 @@
on: [push, pull_request]
jobs:
# run python/js tests, coveralls and lint
integration-test:
name: Integration test ${{ matrix.os }} 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-16.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: python setup.py develop
env:
OPAL_TEST_USE_POSTGRES: 1
- name: Install dependencies
run: pip install -r test-requirements.txt
- run: gem install coveralls-lcov
- run: gem install rake
- name: run tests
run: opal test --coverage
- name: flake8
run: flake8
- name: find lcov
run: find . -name "lcov.info"
- name: find in coverage
run: find coverage -name "lcov.info"
- run: ls coverage
- 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: Test ${{ matrix.os }} Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
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: Install opal
run: python setup.py develop
- name: Install dependencies
run: pip install -r test-requirements.txt
- name: run tests
run: opal test py





31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions 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.

Expand Down
7 changes: 5 additions & 2 deletions opal/core/test_runner.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions opal/tests/js_config/karma_defaults.js
Expand Up @@ -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){
Expand Down
13 changes: 7 additions & 6 deletions opal/tests/test_core_test_runner.py
Expand Up @@ -10,6 +10,7 @@

from opal.core import test_runner


class RunPyTestsTestCase(OpalTestCase):

@patch('subprocess.check_call')
Expand Down Expand Up @@ -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):
Expand All @@ -160,21 +161,21 @@ 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'],
check_call.call_args[0][0]
)

@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(
[
Expand All @@ -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(
[
Expand Down
8 changes: 4 additions & 4 deletions runtests.py
Expand Up @@ -43,7 +43,7 @@
'reversion.middleware.RevisionMiddleware'
),
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.staticfiles',
'django.contrib.sessions',
Expand Down Expand Up @@ -112,13 +112,13 @@
}
)

if 'TRAVIS' in os.environ:
if os.environ.get('USE_POSTGRES'):
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',
}
}
Expand Down

0 comments on commit 802e277

Please sign in to comment.