Skip to content

Commit 0b8c774

Browse files
authored
Merge pull request #69 from microsoftgraph/task/update-ci
Update Github actions config to use Pipenv to run tests and linter
2 parents 500bd71 + 066be4a commit 0b8c774

23 files changed

+395
-145
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,39 @@ name: msgraph-sdk-python-core
55

66
on:
77
push:
8-
branches: [ master ]
8+
branches: [master]
99
pull_request:
10-
branches: [ dev ]
10+
branches: [dev]
1111

1212
jobs:
1313
build:
14-
1514
runs-on: ubuntu-latest
1615
strategy:
1716
matrix:
1817
python-version: [3.5, 3.6, 3.7, 3.8]
1918

2019
steps:
21-
- uses: actions/checkout@v2
22-
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v1
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install -r requirements.txt
30-
pip install -r dev_requirements.txt
31-
- name: Lint with Pylint
32-
run: |
33-
pylint msgraphcore --disable=W --rcfile=.pylintrc
34-
- name: Test with pytest
35-
run: |
36-
coverage run --omit 'venv/*' -m unittest discover tests/unit
37-
coverage run --omit 'venv/*' -m unittest discover tests/integration
38-
coverage html
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install pipenv
29+
pipenv install --dev
30+
- name: Check code format
31+
run: |
32+
pipenv run yapf -dr .
33+
- name: Check import order
34+
run: |
35+
pipenv run isort .
36+
- name: Lint with Pylint
37+
run: |
38+
pipenv run pylint msgraphcore --disable=W --rcfile=.pylintrc
39+
- name: Test with unittest
40+
run: |
41+
pipenv run coverage run -m unittest discover tests/unit
42+
pipenv run coverage run -m unittest discover tests/integration
43+
pipenv run coverage html

.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
profile=hug

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
default_language_version:
2+
python: python3
3+
repos:
4+
- repo: local
5+
hooks:
6+
- id: yapf
7+
name: yapf
8+
stages: [commit]
9+
language: system
10+
entry: pipenv run yapf -ir .
11+
types: [python]
12+
13+
- id: isort
14+
name: isort
15+
stages: [commit]
16+
language: system
17+
entry: pipenv run isort .
18+
types: [python]
19+
20+
- id: pylint
21+
name: pylint
22+
stages: [commit]
23+
language: system
24+
entry: pipenv run pylint msgraphcore --disable=W --rcfile=.pylintrc
25+
types: [python]

.pylintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ disable=print-statement,
144144
missing-module-docstring,
145145
missing-class-docstring,
146146
missing-function-docstring,
147+
C0330,
148+
R0801,
147149

148150
# Enable the message, report, category or checker with the given id(s). You can
149151
# either give multiple identifier separated by comma (,) or put this option

.style.yapf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[style]
2+
based_on_style = pep8
3+
dedent_closing_brackets = true
4+
each_dict_entry_on_separate_line = true
5+
column_limit = 100

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.linting.enabled": true,
3+
"python.linting.pylintPath": "pylint",
4+
"editor.formatOnSave": true,
5+
"python.formatting.provider": "yapf",
6+
"python.linting.pylintEnabled": true,
7+
}

Pipfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ name = "pypi"
55

66
[packages] # Packages required to run the application
77
requests = "==2.23.0"
8+
pre-commit = "==2.10.1"
89

910
[dev-packages] # Packages required to develop the application
1011
coverage = "==5.0.3"
11-
pylint = "==2.4.4"
12+
pylint = "==2.6.0"
1213
responses = "==0.10.12"
1314
flit = "==2.2.0"
1415
azure-identity = "==1.5.0"
16+
isort = "==5.7.0"
17+
yapf = "==0.30.0"
18+
mypy = "==0.800"

Pipfile.lock

Lines changed: 268 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![CI Actions Status](https://github.com/microsoftgraph/msgraph-sdk-python-core/workflows/msgraph-sdk-python-core/badge.svg)](https://github.com/microsoftgraph/msgraph-sdk-python-core/actions)
2+
13
## Microsoft Graph Python Client Library
24

35
The Microsoft Graph Python client library is a lightweight wrapper around

docs/conf.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# import sys
1515
# sys.path.insert(0, os.path.abspath('.'))
1616

17-
1817
# -- Project information -----------------------------------------------------
1918

2019
project = 'msgraph-sdk-python'
@@ -24,14 +23,12 @@
2423
# The full version, including alpha/beta/rc tags
2524
release = '0.0.1'
2625

27-
2826
# -- General configuration ---------------------------------------------------
2927

3028
# Add any Sphinx extension module names here, as strings. They can be
3129
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3230
# ones.
33-
extensions = [
34-
]
31+
extensions = []
3532

3633
# Add any paths that contain templates here, relative to this directory.
3734
templates_path = ['_templates']
@@ -41,7 +38,6 @@
4138
# This pattern also affects html_static_path and html_extra_path.
4239
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
4340

44-
4541
# -- Options for HTML output -------------------------------------------------
4642

4743
# The theme to use for HTML and HTML Help pages. See the documentation for
@@ -52,4 +48,4 @@
5248
# Add any paths that contain custom static files (such as style sheets) here,
5349
# relative to this directory. They are copied after the builtin static files,
5450
# so a file named "default.css" will overwrite the builtin "default.css".
55-
html_static_path = ['_static']
51+
html_static_path = ['_static']

0 commit comments

Comments
 (0)