Skip to content

Commit

Permalink
Merge pull request #2012 from openhealthcare/work-flows
Browse files Browse the repository at this point in the history
Work flows
  • Loading branch information
davidmiller committed Sep 2, 2022
2 parents e1a57b8 + 9a63e9f commit b05e3d9
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 63 deletions.
18 changes: 0 additions & 18 deletions .appveyor.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .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
30 changes: 0 additions & 30 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
6 changes: 3 additions & 3 deletions runtests.py
Expand Up @@ -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',
}
}
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -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',
Expand Down

0 comments on commit b05e3d9

Please sign in to comment.