Skip to content

Commit 6b90937

Browse files
authored
Merge pull request #258 from blink1073/improve-ci
2 parents 73eb091 + b213591 commit 6b90937

File tree

9 files changed

+102
-39
lines changed

9 files changed

+102
-39
lines changed

.github/workflows/test.yml

Lines changed: 71 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ name: Python package
66
on:
77
push:
88
pull_request:
9-
branches: ["master"]
9+
schedule:
10+
- cron: "0 8 * * *"
11+
12+
concurrency:
13+
group: >-
14+
${{ github.workflow }}-
15+
${{ github.ref_type }}-
16+
${{ github.event.pull_request.number || github.sha }}
17+
cancel-in-progress: true
1018

1119
jobs:
1220
build:
@@ -15,42 +23,76 @@ jobs:
1523
fail-fast: false
1624
matrix:
1725
os: [ubuntu-latest, windows-latest, macos-latest]
18-
python-version: [3.7, 3.8, 3.9, "3.10", pypy-3.7]
19-
exclude:
20-
# pywin32 not available
26+
python-version: ["3.7", "3.10"]
27+
include:
2128
- os: windows-latest
22-
python-version: "3.10"
29+
python-version: "3.9"
30+
- os: ubuntu-latest
31+
python-version: "pypy-3.8"
32+
- os: macos-latest
33+
python-version: "3.8"
2334
steps:
2435
- uses: actions/checkout@v2
25-
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v2
27-
with:
28-
python-version: ${{ matrix.python-version }}
29-
- name: Get pip cache dir
30-
id: pip-cache
31-
run: |
32-
echo "::set-output name=dir::$(pip cache dir)"
33-
- name: pip cache
34-
uses: actions/cache@v2
35-
with:
36-
path: ${{ steps.pip-cache.outputs.dir }}
37-
key: |
38-
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('dev-requirements.txt', 'setup.cfg') }}
39-
restore-keys: |
40-
${{ runner.os }}-pip-${{ matrix.python-version }}-
41-
${{ runner.os }}-pip-
36+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
4237
- name: Install dependencies
4338
run: |
44-
python -m pip install --upgrade pip
45-
pip install --upgrade setuptools wheel
46-
pip install -r dev-requirements.txt .
39+
pip install -e ".[test]"
4740
- name: Test with pytest
4841
run: |
49-
pytest -vv jupyter_core --timeout 60 --cov jupyter_core --cov-report term-missing:skip-covered
50-
- name: Check manifest
42+
python -m pytest -vv --timeout 60 --cov jupyter_core --cov-report term-missing:skip-covered
43+
44+
test_miniumum_versions:
45+
name: Test Minimum Versions
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 10
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: Base Setup
51+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
52+
with:
53+
python_version: "3.7"
54+
- name: Install miniumum versions
55+
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
56+
- name: Run the unit tests
57+
run: pytest -vv -W default || pytest -vv -W default --lf
58+
59+
test_prereleases:
60+
name: Test Prereleases
61+
timeout-minutes: 10
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v2
66+
- name: Base Setup
67+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
68+
- name: Install the Python dependencies
69+
run: |
70+
pip install --upgrade --upgrade-strategy eager --pre -e ".[test]"
71+
- name: List installed packages
72+
run: |
73+
pip freeze
74+
pip check
75+
- name: Run the tests
5176
run: |
52-
pip install check-manifest
53-
check-manifest -v
77+
pytest -vv || pytest -vv --lf
78+
79+
make_sdist:
80+
name: Make SDist
81+
runs-on: ubuntu-latest
82+
timeout-minutes: 10
83+
steps:
84+
- uses: actions/checkout@v2
85+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
86+
- uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1
87+
88+
test_sdist:
89+
runs-on: ubuntu-latest
90+
needs: [make_sdist]
91+
name: Install from SDist and Test
92+
timeout-minutes: 20
93+
steps:
94+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
95+
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
5496

5597
pre-commit:
5698
name: pre-commit

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ repos:
7272
scripts/jupyter
7373
)$
7474
75+
- repo: https://github.com/mgedmin/check-manifest
76+
rev: "0.48"
77+
hooks:
78+
- id: check-manifest
79+
stages: [manual]
80+
7581
- repo: https://github.com/sirosen/check-jsonschema
7682
rev: 0.14.2
7783
hooks:

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
include COPYING.md
22
include CONTRIBUTING.md
33
include README.md
4-
include dev-requirements.txt
54
include jupyter_core/py.typed
65

76
exclude .pre-commit-config.yaml

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Now create an [editable install](https://pip.pypa.io/en/stable/reference/pip_ins
1616
and download the dependencies of code and test suite by executing:
1717

1818
cd /my/projects/jupyter_core/
19-
pip install -e .
20-
pip install -r dev-requirements.txt
19+
pip install -e ".[test]"
2120
py.test
2221

2322
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.

dev-requirements.txt

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

jupyter_core/tests/test_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def write_executable(path, source):
5656
import pkg_resources
5757

5858
w = pkg_resources.resource_string("setuptools", "cli-32.exe")
59-
except (ImportError, FileNotFoundError):
59+
except (ImportError, FileNotFoundError, SystemError):
6060
pytest.skip("Need pkg_resources/setuptools to make scripts executable on Windows")
6161
exe.write(w, "wb")
6262
exe.chmod(0o700)

jupyter_core/tests/test_paths.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,10 @@ def test_secure_write_win32():
417417
def fetch_win32_permissions(filename):
418418
"""Extracts file permissions on windows using icacls"""
419419
role_permissions = {}
420-
for index, line in enumerate(os.popen("icacls %s" % filename).read().splitlines()):
420+
proc = os.popen("icacls %s" % filename)
421+
lines = proc.read().splitlines()
422+
proc.close()
423+
for index, line in enumerate(lines):
421424
if index == 0:
422425
line = line.split(filename)[-1].strip().lower()
423426
match = re.match(r"\s*([^:]+):\(([^\)]*)\)", line)

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,14 @@ module = [
2727
"entrypoints"
2828
]
2929
ignore_missing_imports = true
30+
31+
32+
[tool.pytest.ini_options]
33+
addopts = "-raXs --durations 10 --color=yes --doctest-modules --ignore-glob=jupyter_core/tests/dotipython*"
34+
testpaths = [
35+
"jupyter_core/tests/"
36+
]
37+
filterwarnings= [
38+
# Fail on warnings
39+
"error",
40+
]

setup.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ console_scripts =
3838
jupyter-migrate = jupyter_core.migrate:main
3939
jupyter-troubleshoot = jupyter_core.troubleshoot:main
4040

41+
[options.extras_require]
42+
test =
43+
ipykernel
44+
pre-commit
45+
pytest
46+
pytest-cov
47+
pytest-timeout
48+
4149
[flake8]
4250
ignore = E501, W503, E402
4351
builtins = c, get_config

0 commit comments

Comments
 (0)