Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 341afc9

Browse files
authored
MAINT/DOC: refactor CircleCI config file (#22948)
In #22943 we saw that CircleCI was using the deployment keys in all jobs. This PR update the configuration to restrict this on main. Doing that it also: Update to the latest configuration template Add a skip logic on the circleci_artifacts_redirector_job
1 parent bb2769e commit 341afc9

2 files changed

Lines changed: 64 additions & 52 deletions

File tree

.circleci/config.yml

Lines changed: 63 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
1-
# Python CircleCI 2.0 configuration file
1+
# Python CircleCI 2.1 configuration file
22
#
3-
# Check https://circleci.com/docs/2.0/language-python/ for more details
3+
# Check https://circleci.com/docs/2.1/language-python/ for more details
44
#
5-
version: 2
6-
jobs:
7-
build:
8-
docker:
9-
# CircleCI maintains a library of pre-built images
10-
# documented at https://circleci.com/docs/2.0/circleci-images/
11-
# circleci/python3.8 images come with old versions of Doxygen(1.6.x),
12-
# therefore a new base image chose instead to guarantee to
13-
# have a newer version >= 1.8.10 to avoid warnings
14-
# that related to the default behaviors or non-exist config options
15-
- image: cimg/python:3.9
5+
version: 2.1
6+
7+
# Aliases to reuse
8+
_defaults: &defaults
9+
docker:
10+
# CircleCI maintains a library of pre-built images
11+
# documented at https://circleci.com/docs/2.1/circleci-images/
12+
# circleci/python3.8 images come with old versions of Doxygen(1.6.x),
13+
# therefore a new base image chose instead to guarantee to
14+
# have a newer version >= 1.8.10 to avoid warnings
15+
# that related to the default behaviors or non-exist config options
16+
- image: cimg/python:3.9
17+
working_directory: ~/repo
1618

17-
working_directory: ~/repo
1819

20+
jobs:
21+
build:
22+
<<: *defaults
1923
steps:
20-
- checkout:
24+
- checkout
2125

2226
- run:
2327
name: Check-skip
@@ -83,51 +87,50 @@ jobs:
8387
. venv/bin/activate
8488
cd doc
8589
# Don't use -q, show warning summary"
86-
SPHINXOPTS="-j4 -n" make -e html || echo "ignoring errors for now, see gh-13114"
87-
88-
- run:
89-
name: build devdocs
90-
no_output_timeout: 30m
91-
command: |
92-
. venv/bin/activate
93-
cd doc
94-
make clean
95-
SPHINXOPTS="-j4 -q" make -e html
90+
SPHINXOPTS="-j2 -n" make -e html || echo "ignoring errors for now, see gh-13114"
9691
9792
- run:
9893
name: build neps
9994
command: |
10095
. venv/bin/activate
10196
cd doc/neps
102-
SPHINXOPTS="-j4 -q" make -e html
97+
SPHINXOPTS="-j2 -q" make -e html
10398
10499
- store_artifacts:
105100
path: doc/build/html/
106101

107-
108102
- store_artifacts:
109103
path: doc/neps/_build/html/
110104
# destination: neps
111105

106+
- persist_to_workspace:
107+
root: ~/repo
108+
paths:
109+
- doc/build/html
110+
- doc/neps/_build
111+
- tools/ci/push_docs_to_repo.py
112+
113+
deploy:
114+
<<: *defaults
115+
steps:
116+
- attach_workspace:
117+
at: ~/
118+
112119
- add_ssh_keys:
113120
fingerprints:
114121
- "45:d8:d1:d6:f7:53:47:c5:d0:9e:35:19:79:e7:ff:24"
115122

116123
- run:
117124
name: deploy devdocs
118125
command: |
119-
if [ "${CIRCLE_BRANCH}" == "main" ]; then
120-
touch doc/build/html/.nojekyll
121-
122-
./tools/ci/push_docs_to_repo.py doc/build/html \
123-
[email protected]:numpy/devdocs.git \
124-
--committer "numpy-circleci-bot" \
125-
--email "numpy-circleci-bot@nomail" \
126-
--message "Docs build of $CIRCLE_SHA1" \
127-
--force
128-
else
129-
echo "Not on the main branch; skipping deployment"
130-
fi
126+
touch doc/build/html/.nojekyll
127+
128+
./tools/ci/push_docs_to_repo.py doc/build/html \
129+
[email protected]:numpy/devdocs.git \
130+
--committer "numpy-circleci-bot" \
131+
--email "numpy-circleci-bot@nomail" \
132+
--message "Docs build of $CIRCLE_SHA1" \
133+
--force
131134
132135
- add_ssh_keys:
133136
fingerprints:
@@ -136,7 +139,7 @@ jobs:
136139
- run:
137140
name: select SSH key for neps repo
138141
command: |
139-
cat <<\EOF > ~/.ssh/config
142+
cat \<<\EOF > ~/.ssh/config
140143
Host github.com
141144
IdentitiesOnly yes
142145
IdentityFile /home/circleci/.ssh/id_rsa_df8bfb342d387d49fc1be8444fbd2c0e
@@ -145,15 +148,23 @@ jobs:
145148
- run:
146149
name: deploy neps
147150
command: |
148-
if [ "${CIRCLE_BRANCH}" == "main" ]; then
149-
touch doc/neps/_build/html/.nojekyll
150-
151-
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
152-
[email protected]:numpy/neps.git \
153-
--committer "numpy-circleci-bot" \
154-
--email "numpy-circleci-bot@nomail" \
155-
--message "Docs build of $CIRCLE_SHA1" \
156-
--force
157-
else
158-
echo "Not on the main branch; skipping deployment"
159-
fi
151+
touch doc/neps/_build/html/.nojekyll
152+
153+
./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
154+
[email protected]:numpy/neps.git \
155+
--committer "numpy-circleci-bot" \
156+
--email "numpy-circleci-bot@nomail" \
157+
--message "Docs build of $CIRCLE_SHA1" \
158+
--force
159+
160+
workflows:
161+
version: 2
162+
default:
163+
jobs:
164+
- build
165+
- deploy:
166+
requires:
167+
- build
168+
filters:
169+
branches:
170+
only: main

.github/workflows/circleci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on: [status]
88
jobs:
99
circleci_artifacts_redirector_job:
1010
runs-on: ubuntu-latest
11+
if: "github.repository == 'numpy/numpy' && !contains(github.event.head_commit.message, '[circle skip]') && !contains(github.event.head_commit.message, '[skip circle]') && github.event.context == 'ci/circleci: build'"
1112
name: Run CircleCI artifacts redirector
1213
# if: github.repository == 'numpy/numpy'
1314
steps:

0 commit comments

Comments
 (0)