Skip to content

Commit 42dda13

Browse files
committed
Merge branch 'github-actions' into dev
2 parents 0fb43c5 + b0ff1ce commit 42dda13

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/python-package.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
pull_request:
9+
branches: [ dev ]
10+
11+
jobs:
12+
build:
13+
env:
14+
# Fake a TRAVIS env so that the pre-existing test cases would behave like before
15+
TRAVIS: true
16+
LAB_APP_CLIENT_ID: ${{ secrets.LAB_APP_CLIENT_ID }}
17+
LAB_APP_CLIENT_SECRET: ${{ secrets.LAB_APP_CLIENT_SECRET }}
18+
LAB_OBO_CLIENT_SECRET: ${{ secrets.LAB_OBO_CLIENT_SECRET }}
19+
LAB_OBO_CONFIDENTIAL_CLIENT_ID: ${{ secrets.LAB_OBO_CONFIDENTIAL_CLIENT_ID }}
20+
LAB_OBO_PUBLIC_CLIENT_ID: ${{ secrets.LAB_OBO_PUBLIC_CLIENT_ID }}
21+
22+
runs-on: ubuntu-latest
23+
strategy:
24+
matrix:
25+
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
34+
# Derived from https://github.com/actions/cache/blob/main/examples.md#using-pip-to-get-cache-location
35+
# However, a before-and-after test shows no improvement in this repo,
36+
# possibly because the bottlenect was not in downloading those small python deps.
37+
- name: Get pip cache dir from pip 20.1+
38+
id: pip-cache
39+
run: |
40+
echo "::set-output name=dir::$(pip cache dir)"
41+
- name: pip cache
42+
uses: actions/cache@v2
43+
with:
44+
path: ${{ steps.pip-cache.outputs.dir }}
45+
key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('**/setup.py', '**/requirements.txt') }}
46+
47+
- name: Install dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
python -m pip install flake8 pytest
51+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
52+
- name: Lint with flake8
53+
run: |
54+
# stop the build if there are Python syntax errors or undefined names
55+
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
56+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
57+
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
58+
- name: Test with pytest
59+
run: |
60+
pytest

0 commit comments

Comments
 (0)