Skip to content

Commit

Permalink
move to github-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaney committed Feb 9, 2021
1 parent 0e7ff77 commit efa2f23
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 81 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#
# Example GitHub Actions config for UW-IT AXD2 app testing and publishing to PyPi
#
# Preconditions:
#
# 1) Application contains a setup.py file
#
# 2) Application repo has access to the required secret
# at https://github.com/organizations/uw-it-aca/settings/secrets:
#
# PYPI_API_TOKEN
#
# To adapt this config to a specific Python app:
#
# 1) Set APP_NAME to the name of the package name/directory.
#
# 2) Set CONF_PATH to a path containing a urls.py and/or settings.py file
# used by the test suite, if any
#
# 3) Verify that the lists of branches for push/pull_request is appropriate,
# and add other branch names if needed.
#
# 4) Update the matrix of django versions to test, if necessary.
#
---
name: tests

env:
APP_NAME: grade_conversion_calculator
CONF_PATH: conf
COVERAGE_DJANGO_VERSION: 2.2

on:
push:
branches: [main, master, qa, develop]
pull_request:
branches: [main, master, qa, develop]
types: [opened, reopened, synchronize]
release:
branches: [main, master]
types: [published]

jobs:
test:
runs-on: ubuntu-18.04

strategy:
matrix:
django-version:
- '2.1'
- '2.2'
- '3.1'

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.6

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '12'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pycodestyle coverage coveralls==2.2.0
npm install -g jshint
- name: Upgrade Django Version
run: pip install "Django~=${{ matrix.django-version }}.0"

- name: Setup Django
run: |
django-admin startproject project .
test -f ${CONF_PATH}/urls.py && cp ${CONF_PATH}/urls.py project/
test -f ${CONF_PATH}/settings.py && cat ${CONF_PATH}/settings.py >> project/settings.py
- name: Run Pycodestyle
run: pycodestyle ${APP_NAME}/ --exclude=migrations

- name: Run JSHint
run: jshint ${APP_NAME}/static/${APP_NAME}/js --verbose

- name: Run Migrations
run: python manage.py migrate

- name: Run Tests
run: |
python -m compileall ${APP_NAME}/
coverage run --source=${APP_NAME}/ manage.py test ${APP_NAME}
- name: Report Test Coverage
if: matrix.django-version == env.COVERAGE_DJANGO_VERSION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: coveralls

publish:
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')

needs: test

runs-on: ubuntu-18.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Publish to PyPi
uses: uw-it-aca/actions/publish-pypi@main
with:
app_name: ${APP_NAME}
tag_name: ${{ github.event.release.tag_name }}
api_token: ${{ secrets.PYPI_API_TOKEN }}
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions conf/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

INSTALLED_APPS += [
'grade_conversion_calculator',
]

STATIC_URL = '/static/'
File renamed without changes.
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<https://github.com/uw-it-aca/grade-conversion-calculator>`_.
"""

# The VERSION file is created by travis-ci, based on the tag name
version_path = 'grade_conversion_calculator/VERSION'
VERSION = open(os.path.join(os.path.dirname(__file__), version_path)).read()
VERSION = VERSION.replace("\n", "")
Expand All @@ -21,7 +20,7 @@
author = 'UW-IT AXDD',
author_email="aca-it@uw.edu",
include_package_data=True,
install_requires=['Django>=2.1,<3.0'],
install_requires=['Django>=2.1,<3.2'],
license='Apache License, Version 2.0',
description='UW Grade Scale Conversion Calculator application',
long_description=README,
Expand Down
Empty file removed travis-ci/__init__.py
Empty file.
10 changes: 0 additions & 10 deletions travis-ci/manage.py

This file was deleted.

35 changes: 0 additions & 35 deletions travis-ci/settings.py

This file was deleted.

5 changes: 0 additions & 5 deletions travis-ci/wsgi.py

This file was deleted.

0 comments on commit efa2f23

Please sign in to comment.