|
1 | 1 | name: CI |
2 | 2 |
|
3 | | -on: |
| 3 | +on: |
4 | 4 | schedule: |
5 | 5 | - cron: '45 01 30 * *' |
| 6 | + |
6 | 7 | push: |
7 | | - fork: |
8 | 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 | | - id: checkout |
17 | | - uses: actions/checkout@v4 |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | + fork: |
18 | 13 |
|
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: |
22 | 15 |
|
23 | | - - name: check links |
24 | | - id: links |
25 | | - run: python -m pytest -n auto ./tests/test_check_links_in_ipynb.py ./utils/tests/ |
26 | 16 |
|
| 17 | +jobs: |
27 | 18 | badges: |
28 | 19 | name: Add Google Colab Badges |
29 | | - needs: test_links_utils |
30 | 20 | runs-on: ubuntu-latest |
31 | 21 | permissions: |
32 | 22 | contents: write |
33 | 23 | timeout-minutes: 5 |
34 | 24 | steps: |
35 | | - - name: checkout |
36 | | - id: checkout |
| 25 | + - name: Checkout |
37 | 26 | uses: actions/checkout@v4 |
38 | 27 |
|
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 |
41 | 35 |
|
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 |
45 | 41 |
|
46 | 42 | - 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 |
49 | 44 |
|
50 | 45 | - name: Commit & push |
51 | | - id: commit |
52 | 46 | uses: stefanzweifel/git-auto-commit-action@v5 |
53 | 47 | with: |
54 | | - commit_message : "Clean ipynb ${{ github.sha }}" |
| 48 | + commit_message: "Clean ipynb ${{ github.sha }}" |
55 | 49 |
|
56 | 50 | test_ipynb: |
57 | 51 | 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 |
60 | 54 | strategy: |
61 | 55 | 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,] |
64 | 61 | fail-fast: false |
65 | 62 | timeout-minutes: 30 |
66 | 63 | steps: |
67 | | - - uses: actions/checkout@v4 |
| 64 | + - name: Checkout |
| 65 | + uses: actions/checkout@v4 |
68 | 66 |
|
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 |
73 | 77 |
|
74 | | - - name: pytest |
| 78 | + - name: Run tests |
75 | 79 | env: |
76 | 80 | 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/ |
0 commit comments