Skip to content

Commit 434df3f

Browse files
authored
Merge pull request #47 from yuvipanda/actions
Setup GitHub Actions
2 parents 3573673 + 14b0f09 commit 434df3f

File tree

6 files changed

+65
-135
lines changed

6 files changed

+65
-135
lines changed

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.8'
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
python -m pip install black
23+
- name: Lint Python
24+
run: |
25+
black --check .

.github/workflows/tests.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
python-version: [3.6, 3.7, 3.8]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install -e ".[dev]"
28+
- name: Lint with flake8
29+
run: python -m flake8 nbresuse
30+
- name: Test with pytest
31+
run: |
32+
python -m pytest -vvv nbresuse --cov=nbresuse --junitxml=python_junit.xml --cov-report=xml --cov-branch

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55

66
# NBResuse
77

8+
![Github Actions Status](https://github.com/yuvipanda/nbresuse/workflows/Tests/badge.svg)
89
[![PyPI](https://img.shields.io/pypi/v/nbresuse)](https://pypi.python.org/pypi/nbresuse)
910
[![PyPI](https://img.shields.io/pypi/l/nbresuse)](https://pypi.python.org/pypi/nbresuse)
1011
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/yuvipanda/nbresuse/issues)
11-
[![TravisCI build status](https://img.shields.io/travis/jupyter/nbviewer/master?logo=travis)](https://travis-ci.org/yuvipanda/nbresuse)
12-
[![Build Status](https://dev.azure.com/tpaine154/jupyter/_apis/build/status/timkpaine.nbresuse?branchName=master)](https://dev.azure.com/tpaine154/jupyter/_build/latest?definitionId=17&branchName=master)
13-
[![Coverage](https://img.shields.io/azure-devops/coverage/tpaine154/jupyter/17)](https://dev.azure.com/tpaine154/jupyter/_build?definitionId=17&_a=summary)
14-
1512

1613
![Screenshot with memory limit](screenshot.png)
1714

azure-pipelines.yml

Lines changed: 0 additions & 128 deletions
This file was deleted.

nbresuse/tests/test_basic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def test_import_serverextension(self):
3232
"nbresuse.ResourceUseDisplay"
3333
) as resource_use_display_mock, patch(
3434
"nbresuse.PrometheusHandler"
35-
) as prometheus_handler_mock:
35+
) as prometheus_handler_mock, patch(
36+
"nbresuse.PSUtilMetricsLoader"
37+
) as psutil_metrics_loader:
3638

3739
# load up with mock
3840
load_jupyter_server_extension(nbapp_mock)
@@ -45,4 +47,6 @@ def test_import_serverextension(self):
4547
# prometheus
4648
assert periodic_callback_mock.return_value.start.call_count == 1
4749
assert prometheus_handler_mock.call_count == 1
48-
prometheus_handler_mock.assert_called_with(nbapp_mock)
50+
prometheus_handler_mock.assert_called_with(
51+
psutil_metrics_loader(nbapp_mock)
52+
)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
install_requires=["notebook>=5.6.0", "prometheus_client"],
2727
extras_require={
2828
"resources": ["psutil>=5.6.0"],
29-
"dev": ["autopep8", "pytest", "flake8", "pytest-cov>=2.6.1", "mock"],
29+
"dev": ["autopep8", "black", "pytest", "flake8", "pytest-cov>=2.6.1", "mock"],
3030
},
3131
data_files=[
3232
("share/jupyter/nbextensions/nbresuse", glob("nbresuse/static/*")),

0 commit comments

Comments
 (0)