-
Notifications
You must be signed in to change notification settings - Fork 386
177 lines (171 loc) · 5.9 KB
/
continuous-integration.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: CI
on:
push:
paths-ignore:
- 'CHANGELOG.md'
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 11 * * 4'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
codeql:
needs: pre-commit
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: python, javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
test-pip:
needs: pre-commit
continue-on-error: ${{ matrix.experimental || false }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11"]
markdown-it-py-version: ["~=2.0"]
kernel: [true]
include:
- python-version: "3.12-dev"
experimental: true
- python-version: "3.13-dev"
experimental: true
- python-version: 3.9
markdown-it-py-version: ""
- python-version: 3.9
markdown-it-py-version: "~=3.0"
- python-version: "3.11"
markdown-it-py-version: "~=4.0"
experimental: true
- python-version: 3.9
kernel: false
- python-version: 3.9
quarto: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# All dependencies but markdown-it-py
python -m pip install nbformat pyyaml toml
python -m pip install -r requirements-dev.txt
# install sphinx_gallery and matplotlib if available
python -m pip install sphinx_gallery~=0.7.0 || true
python -m pip install jupyter-fs || true
- name: Install markdown-it-py
if: ${{ matrix.markdown-it-py-version }}
run: python -m pip install markdown-it-py${{ matrix.markdown-it-py-version }}
- name: Install from source (required for the pre-commit tests)
run: python -m pip install . --no-deps
- name: Install a Jupyter Kernel
if: ${{ matrix.kernel }}
run: python -m ipykernel install --name python_kernel --user
- name: Install Quarto
if: ${{ matrix.quarto }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
# download the latest release
gh release download --repo quarto-dev/quarto-cli --pattern 'quarto-*-linux-amd64.deb'
# install it
sudo apt install ./*.deb
- name: Test with pytest
run: pytest --cov=./ --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
test-conda:
needs: pre-commit
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
python-version: [ 3.9 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: conda-${{ matrix.os }}-python-${{ matrix.python-version }}-${{ hashFiles('environment-ci.yml') }}
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
auto-activate-base: false
activate-environment: jupytext-ci
python-version: ${{ matrix.python-version }}
channels: defaults,conda-forge
environment-file: environment-ci.yml
use-only-tar-bz2: true
- name: Install from source
# This is required for the pre-commit tests
shell: pwsh
run: python -m pip install .
- name: Create kernel
shell: pwsh
run: |
python -m ipykernel install --name jupytext-ci --user
- name: Conda list
shell: pwsh
run: conda list
- name: Test with pytest
shell: pwsh
run: |
if("${{ matrix.os }}" -eq "windows-latest"){
pytest
} else {
pytest --cov=./ --cov-report=xml
}
- name: Upload coverage
uses: codecov/codecov-action@v3
if: ${{ matrix.os != 'windows-latest' }}
build:
needs: test-pip
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build package
run: |
python -m pip install wheel jupyter-packaging 'jupyterlab>=3,<4'
BUILD_JUPYTERLAB_EXTENSION=1 python setup.py sdist bdist_wheel
# Don't publish a tar.gz file over 1MB (Issue #730)
if (($(wc -c < dist/*.tar.gz) > 1000000)); then exit 1; fi
# node_modules should not be in the package
if (($(tar -tf dist/*.tar.gz | grep node_modules | wc -l)>0)); then echo "node_modules should not be included" && exit 1; fi
# Check that the lab and the notebook extensions are there
if (($(tar -tf dist/*.tar.gz | grep packages/labextension/package.json$ | wc -l)==0)); then echo "Missing lab extension" && exit 1; fi
if (($(tar -tf dist/*.tar.gz | grep jupytext/nbextension/index.js$ | wc -l)==0)); then echo "Missing notebook extension" && exit 1; fi
# Install
python -m pip install dist/*.tar.gz
echo "Install went OK"