-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use github actions, rather than travis (#229)
* Use github actions, rather than travis * Pre-commit lint fixes on test directory * Run apt-get update prior to install * Create build directory for coverage * Temporarily lower coverage
- Loading branch information
Ryan Lane
authored
Dec 16, 2019
1 parent
926ad9e
commit 5a23193
Showing
20 changed files
with
168 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
on: pull_request | ||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Setup python 3.6 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.6 | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files | ||
## Uncomment once license tests are in and passing | ||
#license-check: | ||
# runs-on: ubuntu-18.04 | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v1 | ||
# - name: Setup Ruby 2.x | ||
# uses: actions/setup-ruby@v1 | ||
# with: | ||
# ruby-version: 2.x | ||
# - name: Install license finder | ||
# run: gem install license_finder | ||
# - name: Setup python 3.6 | ||
# uses: actions/setup-python@v1 | ||
# with: | ||
# python-version: 3.6 | ||
# - name: Install apt dependencies | ||
# run: sudo apt-get install -y python3-dev openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev | ||
# - name: Install dependencies | ||
# run: pip install -r piptools_requirements3.txt && pip install -r requirements3.txt | ||
# - name: Run license finder | ||
# run: license_finder | ||
test: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '8.x' | ||
- name: Setup python 3.6 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.6 | ||
- name: Install apt dependencies | ||
run: sudo apt-get update && sudo apt-get install -y python3-dev openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev | ||
- name: Install dependencies | ||
run: pip install -r piptools_requirements3.txt && pip install -r requirements3.txt | ||
- run: "npm install grunt-cli && npm install" | ||
- name: Run python tests | ||
run: make test | ||
- name: Run frontend tests | ||
run: grunt test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build and Deploy | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
jobs: | ||
build-and-deploy-docs: | ||
name: Build and publish docs | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Setup Ruby | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.6.x' | ||
- name: Install bundler deps | ||
run: | | ||
cd docs | ||
gem install bundler | ||
bundle install --jobs 4 --retry 3 | ||
- name: Build docs | ||
run: cd docs && bundler exec middleman build && touch build/.nojekyll | ||
- name: Deploy docs | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BASE_BRANCH: master # The branch the action should deploy from. | ||
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: docs/build # The folder the action should deploy. | ||
build-and-publish-python-module: | ||
name: Build and publish python module to pypi | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Setup python 3.6 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.6 | ||
- name: Add wheel dependency | ||
run: pip install wheel | ||
- name: Generate dist | ||
run: python setup.py sdist bdist_wheel | ||
- name: Publish to PyPI | ||
if: startsWith(github.event.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_password }} | ||
build-and-publish-docker-image: | ||
name: Build and publish docker image | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Publish to Registry | ||
uses: elgohr/[email protected] | ||
with: | ||
name: lyft/confidant | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
tag_names: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
exclude: '^docs/.*$' | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.1.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8==3.3.0 | ||
- flake8-tidy-imports==1.0.6 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
# bash needed for pipefail | ||
SHELL := /bin/bash | ||
|
||
test: test_lint test_unit | ||
|
||
test_lint: | ||
mkdir -p build | ||
set -o pipefail; flake8 | sed "s#^\./##" > build/flake8.txt || (cat build/flake8.txt && exit 1) | ||
test: test_unit | ||
|
||
test_unit: | ||
nosetests --with-path=confidant tests/unit | ||
mkdir -p build | ||
nosetests --with-coverage --with-path=confidant tests/unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ | |
settings.encrypted_settings.secret_string = {} | ||
settings.encrypted_settings.decrypted_secrets = {'SESSION_SECRET': 'TEST_KEY'} | ||
|
||
import confidant.routes | ||
from confidant.app import app | ||
from confidant import authnz | ||
import confidant.routes # noqa:E402,F401 | ||
from confidant.app import app # noqa:E402 | ||
from confidant import authnz # noqa:E402 | ||
|
||
|
||
class AuthnzTest(unittest.TestCase): | ||
|
@@ -159,16 +159,19 @@ def test_will_extract_from_request(self): | |
with patch('confidant.authnz.userauth.request') as request_mock: | ||
request_mock.headers = { | ||
app.config['HEADER_AUTH_USERNAME_HEADER']: 'unittestuser', | ||
app.config['HEADER_AUTH_EMAIL_HEADER']: '[email protected]', | ||
app.config['HEADER_AUTH_EMAIL_HEADER']: '[email protected]', # noqa:E501 | ||
} | ||
self.assertEqual(authnz.get_logged_in_user(), '[email protected]') | ||
self.assertEqual( | ||
authnz.get_logged_in_user(), | ||
'[email protected]' | ||
) | ||
|
||
def test_will_log_in(self): | ||
with app.test_request_context('/fake'): | ||
with patch('confidant.authnz.userauth.request') as request_mock: | ||
request_mock.headers = { | ||
app.config['HEADER_AUTH_USERNAME_HEADER']: 'unittestuser', | ||
app.config['HEADER_AUTH_EMAIL_HEADER']: '[email protected]', | ||
app.config['HEADER_AUTH_EMAIL_HEADER']: '[email protected]', # noqa:E501 | ||
} | ||
resp = authnz.user_mod.log_in() | ||
|
||
|
Oops, something went wrong.