Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Commit

Permalink
feat: Github Action integrated with Codecov (#632)
Browse files Browse the repository at this point in the history
* feat: Codecov

* feat: Update readme

* feat: Update for 3.8

* feat: Update Testcases for python- 3.8

* feat: Fix flake error

* feat: Update for .env variables

* feat: Update for .env variables

* feat: Use SQLite for test db
  • Loading branch information
satya7289 committed Aug 22, 2020
1 parent 5de25a0 commit 6e6e139
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 68 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run Tests

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
cp .env.example .env
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
sudo apt-get install python-gdal
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"
- name: Run Flake Test
run: flake8 systers_portal

- name: Run Tests
run: coverage run systers_portal/manage.py test --settings=systers_portal.settings.testing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
name: codecov-umbrella
fail_ci_if_error: true
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Systers Portal [![Build Status](https://travis-ci.org/systers/portal.svg?branch=master)](https://travis-ci.org/systers/portal) [![Coverage Status](https://coveralls.io/repos/github/systers/portal/badge.svg?branch=master)](https://coveralls.io/r/systers/portal?branch=master)
Systers Portal [![Build Status](https://codecov.io/gh/anitab-org/portal/branch/develop/graph/badge.svg)](https://codecov.io/gh/anitab-org/portal/) [![Coverage Status](https://coveralls.io/repos/github/systers/portal/badge.svg?branch=master)](https://coveralls.io/r/systers/portal?branch=master)
==============

Systers Portal is for Systers communities to post and share information within
Expand Down
10 changes: 4 additions & 6 deletions systers_portal/meetup/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.utils.timezone import timedelta
from cities_light.models import City, Country
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError


from meetup.forms import (AddMeetupForm, EditMeetupForm,
Expand Down Expand Up @@ -61,9 +60,9 @@ def test_request_meetup_form_with_past_date(self):
date = (timezone.now() - timedelta(2)).date()
time = timezone.now().time()
data = {'title': 'Foo', 'slug': 'foo', 'date': date, 'time': time,
'meetup_location': self.location,
'meetup_location': self.location.id,
'description': "It's a test meetup."}
form = AddMeetupForm(data=data, created_by=self.systers_user, leader=self.systers_user)
form = RequestMeetupForm(data=data, created_by=self.systers_user)
self.assertFalse(form.is_valid())
self.assertTrue(form.errors['date'], ["Date should not be before today's date."])

Expand All @@ -72,13 +71,12 @@ def test_request_meetup_form_with_passed_time(self):
date = timezone.now().date()
time = (timezone.now() - timedelta(2)).time()
data = {'title': 'Foo', 'slug': 'foo', 'date': date, 'time': time,
'meetup_location': self.location,
'meetup_location': self.location.id,
'description': "It's a test meetup."}
form = AddMeetupForm(data=data, created_by=self.systers_user, leader=self.systers_user)
form = RequestMeetupForm(data=data, created_by=self.systers_user)
self.assertFalse(form.is_valid())
self.assertTrue(form.errors['time'],
["Time should not be a time that has already passed."])
self.assertRaises(ValidationError, form.clean_time())


class AddMeetupFormTestCase(MeetupFormTestCaseBase, TestCase):
Expand Down
8 changes: 2 additions & 6 deletions systers_portal/systers_portal/settings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': config('DB_NAME', default='systersdb'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASSWORD'),
'HOST': config('DB_HOST', default='localhost'),
'PORT': config('DB_PORT', default=5432, cast=int),
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

Expand Down

0 comments on commit 6e6e139

Please sign in to comment.