Skip to content

Commit

Permalink
Merge pull request #12 from uw-it-aca/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jlaney committed May 25, 2021
2 parents ef20bac + 3f24177 commit 460a2ad
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 35 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#
# Example GitHub Actions config for UW-IT AXD2 app testing and publishing to PyPi
#
# Preconditions:
#
# 1) Application test suite is kicked off by APP_NAME/test.py
#
# 2) Application contains a setup.py file
#
# 3) 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) Verify that the lists of branches for push/pull_request is appropriate,
# and add other branch names if needed.
#
---
name: tests

env:
APP_NAME: uw_hrp

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

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

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

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install commonconf nose2 coverage coveralls==2.2.0
- name: Run Python Linters
uses: uw-it-aca/actions/python-linters@main
with:
app_name: ${APP_NAME}

- name: Run Tests
run: |
python -m compileall ${APP_NAME}/
coverage run ${APP_NAME}/test.py -v
- name: Report Test Coverage
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 }}
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# REST client for the UW HRP Web Service
# UW-RestClients-HRP

[![Build Status](https://api.travis-ci.org/uw-it-aca/uw-restclients-hrp.svg?branch=master)](https://travis-ci.org/uw-it-aca/uw-restclients-hrp)
[![Coverage Status](https://coveralls.io/repos/uw-it-aca/uw-restclients-hrp/badge.png?branch=master)](https://coveralls.io/r/uw-it-aca/uw-restclients-hrp?branch=master)
[![Build Status](https://github.com/uw-it-aca/uw-restclients-hrp/workflows/tests/badge.svg?branch=main)](https://github.com/uw-it-aca/uw-restclients-hrp/actions)
[![Coverage Status](https://coveralls.io/repos/uw-it-aca/uw-restclients-hrp/badge.svg?branch=main)](https://coveralls.io/r/uw-it-aca/uw-restclients-hrp?branch=main)
[![PyPi Version](https://img.shields.io/pypi/v/uw-restclients-hrp.svg)](https://pypi.python.org/pypi/uw-restclients-hrp)
![Python versions](https://img.shields.io/pypi/pyversions/uw-restclients-hrp.svg)

Installation:

Expand Down
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/uw-restclients-hrp>`_.
"""

# The VERSION file is created by travis-ci, based on the tag name
version_path = 'uw_hrp/VERSION'
VERSION = open(os.path.join(os.path.dirname(__file__), version_path)).read()
VERSION = VERSION.replace("\n", "")
Expand All @@ -22,7 +21,7 @@
author_email="aca-it@uw.edu",
include_package_data=True,
install_requires=[
'UW-RestClients-Core<2.0',
'UW-RestClients-Core',
'python-dateutil'
],
license='Apache License, Version 2.0',
Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
This is the interface for interacting with
the hrp web service.
Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/dao.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

import logging
import os
from os.path import abspath, dirname
Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from datetime import datetime, timezone
from dateutil.parser import parse
import json
Expand Down
5 changes: 4 additions & 1 deletion uw_hrp/test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

# This is just a test runner for coverage
from commonconf.backends import use_configparser_backend
from os.path import abspath, dirname
import os

if __name__ == '__main__':
path = abspath(os.path.join(dirname(__file__),
"..", "travis-ci", "test.conf"))
"..", "conf", "test.conf"))
use_configparser_backend(path, 'HRP')

from nose2 import discover
Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/tests/test_dao.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
from uw_hrp.dao import HRP_DAO

Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
from datetime import datetime, timedelta, timezone
from uw_hrp.models import (
Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/tests/test_worker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
from restclients_core.exceptions import (
DataFailureException, InvalidEmployeeID, InvalidRegID, InvalidNetID)
Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from restclients_core.util.decorators import use_mock
from uw_hrp.dao import HRP_DAO

Expand Down
3 changes: 3 additions & 0 deletions uw_hrp/worker.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

"""
This is the interface for interacting with the HRP Web Service.
"""
Expand Down

0 comments on commit 460a2ad

Please sign in to comment.