Skip to content

Commit 32acc62

Browse files
authored
CI: switching circleCI to use new engine and use proxy for artifacts (#271)
* CI: switching circleCI to use new engine and use proxy for artifacts * Renaming workflow to be consistent with other repos * Adding GHA deployment for the rendered pages
1 parent 153a2a7 commit 32acc62

File tree

3 files changed

+60
-69
lines changed

3 files changed

+60
-69
lines changed

.circleci/config.yml

Lines changed: 12 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,34 @@
1-
# See: https://circleci.com/docs/2.0/language-python/
1+
version: 2.1
22

3-
version: 2
4-
jobs:
53

4+
jobs:
65
build-docs:
7-
working_directory: ~/repo
86
docker:
97
- image: cimg/python:3.13
10-
118
steps:
129
- checkout
1310

1411
- run:
1512
name: Install Python dependencies
1613
command: |
17-
python3 -m venv venv
18-
source venv/bin/activate
19-
pip install --upgrade pip wheel setuptools
20-
pip install -r site/requirements.txt -r requirements.txt
21-
22-
- restore_cache:
23-
keys:
24-
- cache-data
14+
python -m pip install --upgrade pip tox
2515
2616
- run:
27-
name: Build site
28-
no_output_timeout: 30m
17+
name: Build documentation
18+
no_output_timeout: 60m
19+
environment:
20+
# Ensure this is same as store_artifacts path below
21+
DOCS_PATH: _build/html
2922
command: |
30-
# NOTE: blas multithreading behaves badly on circleci
23+
export BASE_URL="/output/job/$CIRCLE_WORKFLOW_JOB_ID/artifacts/0/$DOCS_PATH"
3124
export OMP_NUM_THREADS=1
32-
source venv/bin/activate
33-
# n = nitpicky (broken links), W = warnings as errors,
34-
# T = full tracebacks, keep-going = run to completion even with errors
35-
make -C site/ SPHINXOPTS="-nWT --keep-going" html
36-
37-
- save_cache:
38-
key: cache-data
39-
paths:
40-
- _data
25+
python -m tox -e py313-buildhtml
4126
4227
- store_artifacts:
43-
path: site/_build/html
44-
45-
- persist_to_workspace:
46-
root: site/_build
47-
paths: html
48-
49-
deploy-docs:
50-
working_directory: ~/repo
51-
docker:
52-
- image: cimg/python:3.13
53-
steps:
54-
- checkout
55-
56-
- attach_workspace:
57-
at: site/_build
58-
59-
- run:
60-
name: install deploy deps
61-
command : |
62-
python3 -m pip install --user ghp-import
63-
64-
- run:
65-
name: configure git
66-
command: |
67-
git config --global user.name "ci-doc-deploy-bot"
68-
git config --global user.email "ci-doc-deploy-bot@nomail"
69-
git config --global push.default simple
70-
71-
- add_ssh_keys:
72-
fingerprints:
73-
5c:54:62:37:75:7f:4d:14:f4:07:82:1c:50:0d:ee:9b
74-
75-
- run:
76-
name: deploy to gh-pages
77-
command: |
78-
ghp-import -n -f -p -m "[skip ci] docs build of $CIRCLE_SHA1" site/_build/html
79-
28+
path: _build/html
8029

8130
workflows:
8231
version: 2
83-
build:
32+
build-and-docs:
8433
jobs:
8534
- build-docs
86-
- deploy-docs:
87-
requires:
88-
- build-docs
89-
filters:
90-
branches:
91-
only: main

.github/workflows/ci_publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Publish HTML and deployed_notebooks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: '0 5 * * 1'
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
# `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from.
17+
# E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`.
18+
# If, instead, your site lives at the root of the domain, at `https://mydomain.org`, set `BASE_URL=''`.
19+
BASE_URL: /${{ github.event.repository.name }}
20+
21+
jobs:
22+
23+
publish_html:
24+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
25+
name: Publish HTML
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v5
29+
30+
- name: Setup Python
31+
uses: actions/setup-python@v6
32+
with:
33+
python-version: '3.12'
34+
35+
- name: Install dependencies
36+
run: python -m pip install --upgrade tox
37+
38+
- name: Execute notebooks while building HTMLs
39+
run: tox -e py312-buildhtml
40+
41+
- name: Publish
42+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./_build/html/
46+
commit_message: ${{ github.event.head_commit.message }}

.github/workflows/circleci.yml renamed to .github/workflows/circleci-artifacts-redirector.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ jobs:
1111
api-token: ${{ secrets.CIRCLE_TOKEN }}
1212
artifact-path: 0/site/_build/html/index.html
1313
circleci-jobs: build-docs
14+
domain: circle.scientific-python.dev
15+
job-title: "--> Rendering Preview <--"

0 commit comments

Comments
 (0)