Skip to content

Commit c961079

Browse files
committed
Merge branch 'ci-update'
2 parents 7020877 + e15af8f commit c961079

31 files changed

+198
-176
lines changed

.github/workflows/build_env.sh

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

.github/workflows/check_links.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Check Links
2+
3+
on:
4+
schedule:
5+
- cron: '45 01 30 * *'
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
test_links_utils:
11+
name: Check links in ipynb
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 5
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Set up uv
24+
uses: astral-sh/setup-uv@v5
25+
26+
- name: Create virtual environment
27+
run: uv venv
28+
29+
- name: Install dependencies
30+
run: uv pip install pytest pytest-xdist requests jupyter lxml numpy matplotlib scipy sympy
31+
32+
- name: Check links
33+
run: uv run pytest -n auto ./tests/test_check_links_in_ipynb.py ./utils/tests/
Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,83 @@
11
name: CI
22

3-
on:
3+
on:
44
schedule:
55
- cron: '45 01 30 * *'
6+
67
push:
7-
fork:
88

9-
jobs:
10-
test_links_utils:
11-
name: Check links in ipynb
12-
runs-on: ubuntu-latest
13-
timeout-minutes: 5
14-
steps:
15-
- name: checkout
16-
id: checkout
17-
uses: actions/checkout@v4
9+
pull_request:
10+
branches: [main]
11+
12+
fork:
1813

19-
- name: setup environment
20-
id: setup
21-
run: python -m pip install pytest pytest-xdist requests jupyter lxml numpy matplotlib scipy sympy
14+
workflow_dispatch:
2215

23-
- name: check links
24-
id: links
25-
run: python -m pytest -n auto ./tests/test_check_links_in_ipynb.py ./utils/tests/
2616

17+
jobs:
2718
badges:
2819
name: Add Google Colab Badges
29-
needs: test_links_utils
3020
runs-on: ubuntu-latest
3121
permissions:
3222
contents: write
3323
timeout-minutes: 5
3424
steps:
35-
- name: checkout
36-
id: checkout
25+
- name: Checkout
3726
uses: actions/checkout@v4
3827

39-
- name: Update pip
40-
run: python -m pip install --upgrade pip
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: '3.11'
32+
33+
- name: Set up uv
34+
uses: astral-sh/setup-uv@v5
4135

42-
- name: setup environment
43-
id: setup
44-
run: python -m pip install bs4 jupyter lxml
36+
- name: Create virtual environment
37+
run: uv venv
38+
39+
- name: Install dependencies
40+
run: uv pip install beautifulsoup4 jupyter lxml
4541

4642
- name: Add/Update badges
47-
id: badges
48-
run: python ./utils/add_colab_main_buttons.py
43+
run: uv run python ./utils/add_colab_main_buttons.py
4944

5045
- name: Commit & push
51-
id: commit
5246
uses: stefanzweifel/git-auto-commit-action@v5
5347
with:
54-
commit_message : "Clean ipynb ${{ github.sha }}"
48+
commit_message: "Clean ipynb ${{ github.sha }}"
5549

5650
test_ipynb:
5751
needs: badges
58-
name: ${{ matrix.anaconda }} on ${{ matrix.os }}
59-
runs-on: ${{ matrix.os }}
52+
name: ${{ matrix.environment.name }} on ${{ matrix.os }}
53+
runs-on: ubuntu-latest
6054
strategy:
6155
matrix:
62-
os: [ubuntu-latest]
63-
anaconda: ["2021.11", nightly]
56+
environment:
57+
- {name: '2021.11', python-version: "3.9.4"}
58+
- {name: '2022.10', python-version: "3.10"}
59+
- {name: 'nightly', python-version: "3"}
60+
os: [ubuntu-latest, macos-latest, windows-latest,]
6461
fail-fast: false
6562
timeout-minutes: 30
6663
steps:
67-
- uses: actions/checkout@v4
64+
- name: Checkout
65+
uses: actions/checkout@v4
6866

69-
- name: build environment
70-
env:
71-
CONDA_PYTHON: ${{ matrix.anaconda }}
72-
run: bash ./.github/workflows/build_env.sh
67+
- name: Set up uv
68+
uses: astral-sh/setup-uv@v5
69+
70+
- name: Create virtual environment
71+
run: uv venv test-env-${{ matrix.environment.name }} --python ${{ matrix.environment.python-version }}
72+
73+
- name: Install dependencies
74+
run: |
75+
source test-env-${{ matrix.environment.name }}/bin/activate
76+
uv pip install -r tests/requirements.${{ matrix.environment.name }}.txt
7377
74-
- name: pytest
78+
- name: Run tests
7579
env:
7680
TEST_IPYNB_IGNORE_FOLDER: tutorial
77-
run: bash ./.github/workflows/run_test.sh
81+
run: |
82+
source test-env-${{ matrix.environment.name }}/bin/activate
83+
uv run pytest --numprocesses=auto -k 'not (links or update_nmisp_py)' tests/

.github/workflows/run_test.sh

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

.github/workflows/set_os_env.sh

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

.github/workflows/wget_install_miniconda.sh

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

50.under-the-hood/24.working_with_bits_operators_results.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
* Let's take a look at the assembly instructions.
2-
```
2+
```
33
24:bitwise_16bit_color.cpp **** uint32_t hex = 0;
44
565 .loc 6 24 0
55
566 00cf C745C400 movl $0, -60(%rbp)

tests/check_links_in_ipynb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,5 @@ def check_links_in_ipynb_cells_list(cells_list):
7272

7373
# check simple urls
7474
check_link_in_cell(cell, rs)
75-
# check urls linked to
75+
# check urls linked to
7676
check_link_in_cell(cell, ri)

tests/get_cpp_from_ipynb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def is_markdown_cpp_src(ipynb_cell):
2828
src = ipynb_cell['source'].strip()
2929

3030
# Multiline code block within ```'s
31-
if (src.startswith('```')
31+
if (src.startswith('```')
3232
and src.endswith('```')):
3333

3434
# check C++ right after ```
@@ -100,7 +100,7 @@ def get_build_command_in_last_line(cpp_txt):
100100
if 4 < len(line.lower().split()):
101101
# Check words
102102
if (
103-
('build' == line.lower().split()[1])
103+
('build' == line.lower().split()[1])
104104
and ('command' == line.lower().split()[2])
105105
and (':' == line.lower().split()[3])
106106
):

tests/requirements.2021.11.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# python==3.9.4
2+
cython==0.29.24
3+
jupyter==1.0.0
4+
lxml==4.6.3
5+
matplotlib==3.4.3
6+
numpy==1.20.3
7+
pandas==1.3.4
8+
pandas-datareader==0.10.0
9+
pytest==6.2.4
10+
pytest-xdist==2.3.0
11+
requests==2.26.0
12+
scikit-learn==0.24.2
13+
scipy==1.7.1
14+
seaborn==0.11.2
15+
statsmodels==0.12.2
16+
sympy==1.9
17+
xlwt==1.3.0

0 commit comments

Comments
 (0)