|
| 1 | +# Circle CI configuration file |
| 2 | +# https://circleci.com/docs/ |
| 3 | + |
| 4 | +--- |
| 5 | +version: 2.1 |
| 6 | + |
| 7 | +####################################### |
| 8 | +# Define some common steps as commands. |
| 9 | +# |
| 10 | + |
| 11 | +commands: |
| 12 | + check-skip: |
| 13 | + steps: |
| 14 | + - run: |
| 15 | + name: Check-skip |
| 16 | + command: | |
| 17 | + export git_log=$(git log --max-count=1 --pretty=format:"%B" | |
| 18 | + tr "\n" " ") |
| 19 | + echo "Got commit message:" |
| 20 | + echo "${git_log}" |
| 21 | + if [[ -v CIRCLE_PULL_REQUEST ]] && ( \ |
| 22 | + [[ "$git_log" == *"[skip circle]"* ]] || \ |
| 23 | + [[ "$git_log" == *"[circle skip]"* ]]); then |
| 24 | + echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}." |
| 25 | + circleci-agent step halt; |
| 26 | + fi |
| 27 | +
|
| 28 | + merge: |
| 29 | + steps: |
| 30 | + - run: |
| 31 | + name: Merge with upstream |
| 32 | + command: | |
| 33 | + if ! git remote -v | grep upstream; then |
| 34 | + git remote add upstream https://github.com/matplotlib/cycler.git |
| 35 | + fi |
| 36 | + git fetch upstream |
| 37 | + if [[ "$CIRCLE_BRANCH" != "main" ]] && \ |
| 38 | + [[ "$CIRCLE_PR_NUMBER" != "" ]]; then |
| 39 | + echo "Merging ${CIRCLE_PR_NUMBER}" |
| 40 | + git pull --ff-only upstream "refs/pull/${CIRCLE_PR_NUMBER}/merge" |
| 41 | + fi |
| 42 | +
|
| 43 | + pip-install: |
| 44 | + description: Upgrade pip to get as clean an install as possible |
| 45 | + steps: |
| 46 | + - run: |
| 47 | + name: Upgrade pip |
| 48 | + command: | |
| 49 | + python -m pip install --upgrade --user pip |
| 50 | +
|
| 51 | + cycler-install: |
| 52 | + steps: |
| 53 | + - run: |
| 54 | + name: Install Cycler |
| 55 | + command: | |
| 56 | + python -m pip install --user -ve .[docs] |
| 57 | +
|
| 58 | + doc-build: |
| 59 | + steps: |
| 60 | + - restore_cache: |
| 61 | + keys: |
| 62 | + - sphinx-env-v1-{{ .BuildNum }}-{{ .Environment.CIRCLE_JOB }} |
| 63 | + - sphinx-env-v1-{{ .Environment.CIRCLE_PREVIOUS_BUILD_NUM }}-{{ .Environment.CIRCLE_JOB }} |
| 64 | + - run: |
| 65 | + name: Build documentation |
| 66 | + command: | |
| 67 | + # Set epoch to date of latest tag. |
| 68 | + export SOURCE_DATE_EPOCH="$(git log -1 --format=%at $(git describe --abbrev=0))" |
| 69 | + mkdir -p logs |
| 70 | + make html O="-T -j4 -w /tmp/sphinxerrorswarnings.log" |
| 71 | + rm -r build/html/_sources |
| 72 | + working_directory: doc |
| 73 | + - save_cache: |
| 74 | + key: sphinx-env-v1-{{ .BuildNum }}-{{ .Environment.CIRCLE_JOB }} |
| 75 | + paths: |
| 76 | + - doc/build/doctrees |
| 77 | + |
| 78 | + doc-show-errors-warnings: |
| 79 | + steps: |
| 80 | + - run: |
| 81 | + name: Extract possible build errors and warnings |
| 82 | + command: | |
| 83 | + (grep "WARNING\|ERROR" /tmp/sphinxerrorswarnings.log || |
| 84 | + echo "No errors or warnings") |
| 85 | + # Save logs as an artifact, and convert from absolute paths to |
| 86 | + # repository-relative paths. |
| 87 | + sed "s~$PWD/~~" /tmp/sphinxerrorswarnings.log > \ |
| 88 | + doc/logs/sphinx-errors-warnings.log |
| 89 | + when: always |
| 90 | + - store_artifacts: |
| 91 | + path: doc/logs/sphinx-errors-warnings.log |
| 92 | + |
| 93 | +########################################## |
| 94 | +# Here is where the real jobs are defined. |
| 95 | +# |
| 96 | + |
| 97 | +jobs: |
| 98 | + docs-python39: |
| 99 | + docker: |
| 100 | + - image: cimg/python:3.9 |
| 101 | + resource_class: large |
| 102 | + steps: |
| 103 | + - checkout |
| 104 | + - check-skip |
| 105 | + - merge |
| 106 | + |
| 107 | + - pip-install |
| 108 | + |
| 109 | + - cycler-install |
| 110 | + |
| 111 | + - doc-build |
| 112 | + - doc-show-errors-warnings |
| 113 | + |
| 114 | + - store_artifacts: |
| 115 | + path: doc/build/html |
| 116 | + |
| 117 | +######################################### |
| 118 | +# Defining workflows gets us parallelism. |
| 119 | +# |
| 120 | + |
| 121 | +workflows: |
| 122 | + version: 2 |
| 123 | + build: |
| 124 | + jobs: |
| 125 | + # NOTE: If you rename this job, then you must update the `if` condition |
| 126 | + # and `circleci-jobs` option in `.github/workflows/circleci.yml`. |
| 127 | + - docs-python39 |
0 commit comments