Skip to content
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

Clean up CI #258

Merged
merged 7 commits into from Apr 15, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
100 changes: 71 additions & 29 deletions .github/workflows/test.yml
Expand Up @@ -6,7 +6,15 @@ name: Python package
on:
push:
pull_request:
branches: ["master"]
schedule:
- cron: "0 8 * * *"

concurrency:
group: >-
${{ github.workflow }}-
${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
build:
Expand All @@ -15,42 +23,76 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.7]
exclude:
# pywin32 not available
python-version: ["3.7", "3.10"]
include:
- os: windows-latest
python-version: "3.10"
python-version: "3.9"
- os: ubuntu-latest
python-version: "pypy-3.8"
- os: macos-latest
python-version: "3.8"
Comment on lines -18 to +33
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('dev-requirements.txt', 'setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r dev-requirements.txt .
pip install -e ".[test]"
- name: Test with pytest
run: |
pytest -vv jupyter_core --timeout 60 --cov jupyter_core --cov-report term-missing:skip-covered
- name: Check manifest
python -m pytest -vv --timeout 60 --cov jupyter_core --cov-report term-missing:skip-covered

test_miniumum_versions:
name: Test Minimum Versions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.7"
- name: Install miniumum versions
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
- name: Run the unit tests
run: pytest -vv -W default || pytest -vv -W default --lf

test_prereleases:
name: Test Prereleases
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
run: |
pip install --upgrade --upgrade-strategy eager --pre -e ".[test]"
- name: List installed packages
run: |
pip freeze
pip check
- name: Run the tests
run: |
pip install check-manifest
check-manifest -v
pytest -vv || pytest -vv --lf

make_sdist:
name: Make SDist
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1

test_sdist:
runs-on: ubuntu-latest
needs: [make_sdist]
name: Install from SDist and Test
timeout-minutes: 20
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1

pre-commit:
name: pre-commit
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -72,6 +72,12 @@ repos:
scripts/jupyter
)$

- repo: https://github.com/mgedmin/check-manifest
rev: "0.48"
hooks:
- id: check-manifest
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.14.2
hooks:
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
@@ -1,7 +1,6 @@
include COPYING.md
include CONTRIBUTING.md
include README.md
include dev-requirements.txt
include jupyter_core/py.typed

exclude .pre-commit-config.yaml
Expand Down
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -16,8 +16,7 @@ Now create an [editable install](https://pip.pypa.io/en/stable/reference/pip_ins
and download the dependencies of code and test suite by executing:

cd /my/projects/jupyter_core/
pip install -e .
pip install -r dev-requirements.txt
pip install -e ".[test]"
py.test

The last command runs the test suite to verify the setup. During development, you can pass filenames to `py.test`, and it will execute only those tests.
Expand Down
5 changes: 0 additions & 5 deletions dev-requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion jupyter_core/tests/test_command.py
Expand Up @@ -56,7 +56,7 @@ def write_executable(path, source):
import pkg_resources

w = pkg_resources.resource_string("setuptools", "cli-32.exe")
except (ImportError, FileNotFoundError):
except (ImportError, FileNotFoundError, SystemError):
pytest.skip("Need pkg_resources/setuptools to make scripts executable on Windows")
exe.write(w, "wb")
exe.chmod(0o700)
Expand Down
5 changes: 4 additions & 1 deletion jupyter_core/tests/test_paths.py
Expand Up @@ -417,7 +417,10 @@ def test_secure_write_win32():
def fetch_win32_permissions(filename):
"""Extracts file permissions on windows using icacls"""
role_permissions = {}
for index, line in enumerate(os.popen("icacls %s" % filename).read().splitlines()):
proc = os.popen("icacls %s" % filename)
lines = proc.read().splitlines()
proc.close()
for index, line in enumerate(lines):
if index == 0:
line = line.split(filename)[-1].strip().lower()
match = re.match(r"\s*([^:]+):\(([^\)]*)\)", line)
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Expand Up @@ -27,3 +27,14 @@ module = [
"entrypoints"
]
ignore_missing_imports = true


[tool.pytest.ini_options]
addopts = "-raXs --durations 10 --color=yes --doctest-modules --ignore-glob=jupyter_core/tests/dotipython*"
testpaths = [
"jupyter_core/tests/"
]
filterwarnings= [
# Fail on warnings
"error",
]
8 changes: 8 additions & 0 deletions setup.cfg
Expand Up @@ -38,6 +38,14 @@ console_scripts =
jupyter-migrate = jupyter_core.migrate:main
jupyter-troubleshoot = jupyter_core.troubleshoot:main

[options.extras_require]
test =
ipykernel
pre-commit
pytest
pytest-cov
pytest-timeout

[flake8]
ignore = E501, W503, E402
builtins = c, get_config
Expand Down