Skip to content

Commit c57711b

Browse files
chore(ci): setup netlify for simpler previews and remove circle ci (#817)
Co-authored-by: Inessa Pawson <inessapawson@gmail.com>
1 parent ea3d179 commit c57711b

7 files changed

Lines changed: 41 additions & 61 deletions

File tree

‎.circleci/config.yml‎

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

‎.github/workflows/artifact_redirect.yml‎

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

‎CONTRIBUTING.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Once you submit a pull request, a series of checks will be run to ensure that yo
256256

257257
- **Code formatting and styles**: checks that your code is formatted correctly, by `pre-commit.ci - pr check`.
258258
- **docs build**: checks that the documentation builds correctly, using `circleci`.
259-
259+
- **docs build / preview**: builds the guide and publishes a Netlify deploy preview (see [Pull request previews](#pull-request-previews) below).
260260
You will see the status of these checks in your pull request.
261261

262262
```{figure} images/contributing/pull-requests-checks.png
@@ -280,6 +280,15 @@ An image showing the status of the checks in a pull request in GitHub. The check
280280

281281
To get more information about the errors, you can click on the "Details" link next to the failed check.
282282

283+
### Pull request previews
284+
285+
This guide uses [Netlify](https://www.netlify.com/) deploy previews. After
286+
the Netlify check finishes on a pull request, click **Details** next to the
287+
deploy-preview status to open a live build with your changes.
288+
289+
The guide is still deployed live using GitHub Pages:
290+
<https://www.pyopensci.org/python-package-guide/>.
291+
283292
### What to expect from the review process
284293

285294
Once you submit a pull request, a maintainer of the repository will review your changes and provide feedback. The review process may involve:

‎README.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
[![DOI](https://zenodo.org/badge/556814582.svg)](https://zenodo.org/badge/latestdoi/556814582)
88

9-
[![CircleCI](https://circleci.com/gh/pyOpenSci/python-package-guide.svg?style=svg)](https://circleci.com/gh/pyOpenSci/python-package-guide)
10-
119
[![Mentioned in Awesome Scientific Python](https://awesome.re/mentioned-badge.svg)](https://github.com/rossant/awesome-scientific-python)
1210

1311
## What is pyOpenSci?

‎conf.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@
5151

5252
# languages that will be included in the language dropdown
5353
# (ie. all that are being built in this nox build session)
54-
if sphinx_env == "production":
54+
# Netlify sets NETLIFY=true. Those builds publish the same languages as
55+
# production. Link prefixes stay at "/" because SPHINX_ENV is development
56+
# there (see netlify.toml). Local builds are unchanged.
57+
on_netlify = os.environ.get("NETLIFY", "").lower() == "true"
58+
if sphinx_env == "production" or on_netlify:
5559
build_languages = ["en"] + release_languages
5660
else:
5761
build_languages = ["en"] + languages

‎netlify.toml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Netlify deploy previews for the pyOpenSci Python package guide (Sphinx).
2+
# Production remains GitHub Pages:
3+
# https://www.pyopensci.org/python-package-guide/
4+
5+
[build]
6+
command = "bash scripts/netlify-build.sh"
7+
publish = "_build/html"
8+
9+
[build.environment]
10+
PYTHON_VERSION = "3.13"
11+
MPLBACKEND = "Agg"
12+
# Previews are served from the preview URL root, so language-selector
13+
# links use "/" (conf.py does that whenever SPHINX_ENV is not production).
14+
# Netlify also sets NETLIFY=true, which limits the menu to release languages.
15+
SPHINX_ENV = "development"

‎scripts/netlify-build.sh‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# Build the Sphinx Python package guide on Netlify (deploy previews).
3+
set -euo pipefail
4+
5+
# hatch-vcs reads the package version from git tags. Netlify's checkout
6+
# often has no tags. The docs do not display this version.
7+
export SETUPTOOLS_SCM_PRETEND_VERSION="${SETUPTOOLS_SCM_PRETEND_VERSION:-0.0.0}"
8+
9+
python -m pip install --upgrade pip
10+
python -m pip install nox
11+
python -m nox -s docs

0 commit comments

Comments
 (0)