Skip to content

Commit

Permalink
Split tutorial CI into multiple jobs (#375)
Browse files Browse the repository at this point in the history
## Description

<!-- Provide a brief description of the PR's purpose here. -->

Tutorials tend to take a lot of time. Splitting the CI into multiple
jobs, one per tutorial, should make this faster. This also makes it
easier to catch dependency errors in the tutorials; for instance, this
PR revealed two tutorials were missing tqdm installation.

Since this does introduce many more jobs, we also cut back on regular
test jobs, only running on 3.11 instead of 3.8-3.11. We do this as
several other jobs like pin and benchmarks already run on Python 3.8, so
it is less essential to test on 3.8 again. Furthermore, we have never
found errors in only the intermediate versions (between lowest supported
and highest supported).

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

## Questions

<!-- Any concerns or points of confusion? -->

## Status

- [x] I have read the guidelines in

[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] I have added a one-line description of my change to the changelog
in
      `HISTORY.md`
- [x] This PR is ready to go
  • Loading branch information
btjanaka authored Sep 15, 2023
1 parent b6de0f9 commit 49f23f1
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ jobs:
max-parallel: 12 # All in parallel.
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
exclude:
# To cut down on runtime since Mac seems to take the longest.
- os: macos-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.10"
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -120,8 +114,24 @@ jobs:
run: pip install .[visualize]
- name: Test Examples
run: bash tests/examples.sh
tutorials_list:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
TUTORIALS=($(ls tutorials/*.ipynb tutorials/*/*.ipynb))
JSON_LIST=""
for x in "${TUTORIALS[@]}"; do JSON_LIST="$JSON_LIST\"$x\","; done
JSON_LIST=${JSON_LIST%","} # Remove extra comma.
echo "matrix={\"tutorial\": [$JSON_LIST]}" >> $GITHUB_OUTPUT
tutorials:
runs-on: ubuntu-latest
needs: tutorials_list
strategy:
matrix: ${{ fromJSON(needs.tutorials_list.outputs.matrix) }}
steps:
# SWIG should not be installed so that we can test that lunar lander is
# installing SWIG properly. See https://github.com/icaros-usc/pyribs/pull/366
Expand All @@ -135,7 +145,7 @@ jobs:
- name: Install deps
run: pip install .[visualize] jupyter nbconvert
- name: Test Tutorials
run: bash tests/tutorials.sh
run: bash tests/tutorials.sh ${{ matrix.tutorial }}
docs:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Add GitHub link roles in documentation ({pr}`361`)
- Refactor argument validation utilities ({pr}`365`)
- Use Conda envs in all CI jobs ({pr}`368`)
- Split tutorial CI into multiple jobs ({pr}`375`)

## 0.5.2

Expand Down
4 changes: 2 additions & 2 deletions tutorials/cma_mae.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install ribs[visualize]"
"%pip install ribs[visualize] tqdm"
]
},
{
Expand Down Expand Up @@ -873,7 +873,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.13"
"version": "3.8.17"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions tutorials/fooling_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install ribs torch"
"%pip install ribs torch tqdm"
]
},
{
Expand Down Expand Up @@ -363,7 +363,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.13"
"version": "3.8.17"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions tutorials/lsi_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"metadata": {},
"outputs": [],
"source": [
"%pip install ribs torch torchvision numpy matplotlib"
"%pip install ribs torch torchvision numpy matplotlib tqdm"
]
},
{
Expand Down Expand Up @@ -696,7 +696,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.13"
"version": "3.8.17"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tom_cruise_dqd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"source": [
"# PyTorch, CLIP, pyribs, and others. ninja is needed for PyTorch C++ extensions\n",
"# for StyleGAN2.\n",
"%pip install torch torchvision git+https://github.com/openai/CLIP ribs ninja einops\n",
"%pip install torch torchvision git+https://github.com/openai/CLIP ribs ninja einops tqdm\n",
"\n",
"# StyleGAN2 - note that StyleGAN2 is not a Python package, so it cannot be\n",
"# installed with pip.\n",
Expand Down

0 comments on commit 49f23f1

Please sign in to comment.