Refactor GitHub's CI config and helper scripts#7672
Refactor GitHub's CI config and helper scripts#7672lagru merged 19 commits intoscikit-image:mainfrom
Conversation
tools/github/run_tests_and_docs.sh
Outdated
There was a problem hiding this comment.
We might want to get rid of this script altogether in a follow-up PR. It is a lot more "trivial" now. Might make our CI more readable to not have the extra layer of abstraction.
bf0aa33 to
e018ee7
Compare
|
The windows runners are now by far the slowest. The gallery build took 40 minutes, where it takes 10 minutes on the aarch64 runner, so I removed it. I thought we may be able to get faster machines, but the documentation suggests we cannot. Slightly bizarrely, the Windows runner specs differ between Azure Pipelines and GitHub: GH: 4 cpu, 16 GB RAM, 14 GB SSD If parallelization weren't an issue, I'd have said we should switch immediately. Maybe we should ask GitHub if they'd raise our quota? /cc @jarrodmillman |
| # TODO: delete when scipy, numpy, cython and pywavelets free-threaded wheels are available on PyPi | ||
| FREE_THREADED_BUILD="$(python -c"import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")" | ||
| if [[ $FREE_THREADED_BUILD == "True" ]]; then | ||
| pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython numpy scipy pywavelets |
There was a problem hiding this comment.
Do we need Cython during testing?
| pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython numpy scipy pywavelets | |
| pip install --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy scipy pywavelets |
There was a problem hiding this comment.
Still curious about this. But not critical I think since we plan to remove this eventually anyway.
There was a problem hiding this comment.
Yes, we should get rid of this as soon as free-threaded builds are more commonly available.
tools/github/setup_docs_env.sh
Outdated
| echo "Installing docs / examples dependencies..." | ||
| # Use previous installed requirements as well, otherwise installing | ||
| # successively may update previously constraint dependencies | ||
| python -m pip install $PIP_FLAGS $REQUIREMENT_FILES -r ./requirements/docs.txt |
There was a problem hiding this comment.
Should we make sure that $REQUIREMENT_FILES includes default.txt, and optional.txt (if needed) regardless of setup_test_env.sh being run? Also are we sure that $REQUIREMENT_FILES sticks from running setup_test_env.sh before?
There was a problem hiding this comment.
This is a remnant from the previous script; I will remove $REQUIREMENT_FILES, since there's really no need to robustly check the docs build under minimum AND latest dependencies. User should only need to be able to build docs after pip install -r requirements/docs.txt.
Docs are a small subset of functionality that should be covered by regular test suite.
Docs examples should work, of course, which is why it needs to be run once. But library functionality should be tested in the test suite, and all platforms.
There was a problem hiding this comment.
Hmm, might be good to check that there's a working dependency solution between "default", "test", "optional" and "docs" for local development. But agreed not critical right now. Might be something we think about, when / if we update our dependency groups though.
There was a problem hiding this comment.
We could build some checking logic into tools/generate_requirements.py?
| # Build the documentation | ||
| choco install optipng | ||
| export SPHINXCACHE=${AGENT_BUILDDIRECTORY}/.cache/sphinx | ||
| export SPHINXOPTS="-W -j auto" |
There was a problem hiding this comment.
I think this is currently the only place in our CI where we fail on warnings for Sphinx. We should make sure to add that flag in another job.
To be honest, I would prefer if we discuss and deal with removing docs on Azure separately. See also #7658 that proposes a different route.
There was a problem hiding this comment.
To be clear. Not a blocker, just noting that I'd like to keep testing our doc pipeline on Windows in some form. Might be good to get those faster runners from GitHub so this is no longer a huge time sink!
There was a problem hiding this comment.
I emailed GH about the faster runners earlier today, and will be happy to reinstate the Windows docs build if we are able to get those going. The 4x build time is a major blocker right now for getting CI build times down. I saw the differently proposed route, and will be happy to add that if you and @jarrodmillman come to an agreement.
There was a problem hiding this comment.
Noted about the warnings, thanks.
| if [[ $MINIMUM_REQUIREMENTS == 1 ]]; then | ||
| for filename in requirements/*.txt; do | ||
| sed -i 's/>=/==/g' "$filename" | ||
| done | ||
| fi |
There was a problem hiding this comment.
This could also sed the dependencies in pyproject.toml. Otherwise pip install . to be safe?
There was a problem hiding this comment.
It requires a bit more finesse to do this in the pyproject.toml, because you'd need to avoid areas other than the test dependencies. I can double check that all pip installs are with --build-isolation.
| - name: Run tests | ||
| run: source tools/github/script.sh | ||
| run: | | ||
| (cd .. && pytest --doctest-plus --showlocals --pyargs skimage) |
There was a problem hiding this comment.
This will miss the pytest config in pyproject.toml but we will deal with that in a separate PR.
|
|
||
| test_docs_aarch64: | ||
| name: macos-docs | ||
| runs-on: ubuntu-24.04-arm |
There was a problem hiding this comment.
Did you chose aarch64 / ARM because its the fastest right now?
There was a problem hiding this comment.
Exactly; we can reduce the 40 minute doc build down to 10 minutes.
lagru
left a comment
There was a problem hiding this comment.
Wow, this seems like a huge step in making our CI config feel more sane. 🙏 Thanks Stéfan. I've left a few suggestions that I think would be good to include here. Approving anyway since all those things could be dealt with in follow-up PRs as well.
Though, there are a few places where I'd like a clarification or your perspective.
02b8e0a to
7ee2cd8
Compare
The Azure runners are too slow.
7ee2cd8 to
891b6fd
Compare
|
We should now have access to the Windows runners we need on GA. I'll refactor to use those as soon as we get this in. |
| - name: Build and install from source | ||
| if: ${{ matrix.INSTALL_FROM_SDIST != 1 }} | ||
| run: | | ||
| pip install -vv --no-build-isolation . |
There was a problem hiding this comment.
I'm wondering now why we actually use --no-build-isolation at all. Seems to me that we could remove the "Install build dependencies" step before and simply rely on pip install to do its thing?
Might be something we could look into as a follow-up simplification. But not terribly important.
There was a problem hiding this comment.
You actually set it up this way already for INSTALL_FROM_SDIST which skips installing the builds and uses an isolated build env.
There was a problem hiding this comment.
I suppose it shortens the subsequent testing and documentation dependency installation steps, but it's not a big deal; we could, indeed, remove that step.
|
Thank you, Stéfan! Really happy with the direction we are going here. The better separation into steps, on its own, makes the CI logs already easier to navigate. 😊 |
…ailure * origin/main: Refactor GitHub's CI config and helper scripts (scikit-image#7672)
I found the naming of the GH scripts confusing, and they didn't seem to stick to their respective purposes. So, I shuffled things around a bit to make it more consistent, and documented the variables.