forked from jupyter/nbgrader
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (109 loc) · 3.59 KB
/
test-docs-python.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
#
name: Test python-doc
on:
pull_request:
branches: ["**"]
push:
branches: [main, master]
tags: ["**"]
defaults:
run:
shell: bash
jobs:
test_nbgrader:
runs-on: ${{ matrix.os }}
timeout-minutes: 45
env:
# NOTE: UTF-8 content may be interpreted as ascii and causes errors
# without this.
LANG: C.UTF-8
MOZ_HEADLESS: 1
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04]
group: ["docs", "python"]
python: ["3.8", "3.9", "3.10", "3.11"]
exclude:
- os: windows-latest
group: docs
- python: "3.8"
group: docs
- python: "3.9"
group: docs
- python: "3.10"
group: docs
steps:
# This is how you set an environment variable in a GitHub workflow that
# will be available in following steps as if you would used `export
# MY_ENV=my-value`.
- name: Configure environment variables from job flags
run: |
if [ "${{ matrix.group }}" == "docs" ]; then
echo "GROUP=docs" >> $GITHUB_ENV
echo "TIMEOUT_MINUTES=15" >> $GITHUB_ENV
fi
if [ "${{ matrix.group }}" == "python" ]; then
echo "GROUP=python" >> $GITHUB_ENV
echo "TIMEOUT_MINUTES=20" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v3
with:
node-version: '18.x'
# NOTE: actions/setup-python@v2 can make use of a cache within the GitHub
# Action virtual environment and setup extremely fast. 3.9 isn't
# available in this cache as of November 2020.
- name: Install Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Run pre-commit
if: matrix.group == 'docs'
run: |
sudo apt-get install pandoc
# Remove node
sudo rm -rf $(which node)
sudo rm -rf $(which node)
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python tasks.py install --group="$GROUP"
pip freeze
- name: Install Playwright
if: matrix.group != 'docs'
run: |
npx playwright install
- name: Run pytest
timeout-minutes: ${{ fromJSON(env.TIMEOUT_MINUTES) }}
run: |
python tasks.py tests --group="$GROUP"
# - name: Submit codecov report
# run: |
# codecov
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
- name: Remove node
run: |
sudo rm -rf $(which node)
sudo rm -rf $(which node)
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
with:
package_spec: '--editable ."[tests]"'
test_command: python -m pytest -vv nbgrader/tests/api || python -m pytest -vv nbgrader/tests/api --lf