Skip to content

Setup GitHub Actions #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black
- name: Lint Python
run: |
black --check .
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Lint with flake8
run: python -m flake8 nbresuse
- name: Test with pytest
run: |
python -m pytest -vvv nbresuse --cov=nbresuse --junitxml=python_junit.xml --cov-report=xml --cov-branch
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@

# NBResuse

![Github Actions Status](https://github.com/yuvipanda/nbresuse/workflows/Tests/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/nbresuse)](https://pypi.python.org/pypi/nbresuse)
[![PyPI](https://img.shields.io/pypi/l/nbresuse)](https://pypi.python.org/pypi/nbresuse)
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/yuvipanda/nbresuse/issues)
[![TravisCI build status](https://img.shields.io/travis/jupyter/nbviewer/master?logo=travis)](https://travis-ci.org/yuvipanda/nbresuse)
[![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)
[![Coverage](https://img.shields.io/azure-devops/coverage/tpaine154/jupyter/17)](https://dev.azure.com/tpaine154/jupyter/_build?definitionId=17&_a=summary)


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

Expand Down
128 changes: 0 additions & 128 deletions azure-pipelines.yml

This file was deleted.

8 changes: 6 additions & 2 deletions nbresuse/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def test_import_serverextension(self):
"nbresuse.ResourceUseDisplay"
) as resource_use_display_mock, patch(
"nbresuse.PrometheusHandler"
) as prometheus_handler_mock:
) as prometheus_handler_mock, patch(
"nbresuse.PSUtilMetricsLoader"
) as psutil_metrics_loader:

# load up with mock
load_jupyter_server_extension(nbapp_mock)
Expand All @@ -45,4 +47,6 @@ def test_import_serverextension(self):
# prometheus
assert periodic_callback_mock.return_value.start.call_count == 1
assert prometheus_handler_mock.call_count == 1
prometheus_handler_mock.assert_called_with(nbapp_mock)
prometheus_handler_mock.assert_called_with(
psutil_metrics_loader(nbapp_mock)
)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
install_requires=["notebook>=5.6.0", "prometheus_client"],
extras_require={
"resources": ["psutil>=5.6.0"],
"dev": ["autopep8", "pytest", "flake8", "pytest-cov>=2.6.1", "mock"],
"dev": ["autopep8", "black", "pytest", "flake8", "pytest-cov>=2.6.1", "mock"],
},
data_files=[
("share/jupyter/nbextensions/nbresuse", glob("nbresuse/static/*")),
Expand Down