summaryrefslogtreecommitdiff
path: root/.circleci/config.yml
blob: 8cf18d809d8627a118c71b9ccbf8dc0050484f48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
  build:
    docker:
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      - image: circleci/python:3.8.4

    working_directory: ~/repo

    steps:
      - checkout:
      - run:
          name: pull changes from merge
          command: |
            if [[ -v CI_PULL_REQUEST ]] ; then git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" ; fi

      - run:
          name: create virtual environment, install dependencies
          command: |
            sudo apt-get update
            sudo apt-get install -y graphviz texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra texlive-generic-extra latexmk texlive-xetex
            python3.8 -m venv venv
            . venv/bin/activate

      - run:
          name: build numpy
          command: |
            . venv/bin/activate
            pip install --progress-bar=off --upgrade pip 'setuptools<49.2.0'
            pip install --progress-bar=off -r test_requirements.txt
            pip install .
            pip install --progress-bar=off -r doc_requirements.txt

      - run:
          name: create release notes
          command: |
            . venv/bin/activate
            pip install towncrier
            VERSION=$(python -c "import setup; print(setup.VERSION)")
            towncrier build --version $VERSION --yes
            ./tools/ci/test_all_newsfragments_used.py

      - run:
          name: run doctests on documentation
          command: |
            . venv/bin/activate
            (cd doc ; git submodule update --init)
            python tools/refguide_check.py --rst

      - run:
          name: build devdocs w/ref warnings
          command: |
            . venv/bin/activate
            cd doc
            # Don't use -q, show warning summary"
            SPHINXOPTS="-n" make -e html || echo "ignoring errors for now, see gh-13114"

      - run:
          name: build devdocs
          no_output_timeout: 30m
          command: |
            . venv/bin/activate
            cd doc
            make clean
            SPHINXOPTS=-q make -e html

      - run:
          name: build neps
          command: |
            . venv/bin/activate
            cd doc/neps
            SPHINXOPTS=-q make -e html

      - store_artifacts:
          path: doc/build/html/


      - store_artifacts:
          path: doc/neps/_build/html/
     #      destination: neps

      - add_ssh_keys:
          fingerprints:
            - "9f:8c:e5:3f:53:40:0b:ee:c9:c3:0f:fd:0f:3c:cc:55"

      -  run:
          name: deploy devdocs
          command: |
            if [ "${CIRCLE_BRANCH}" == "main" ]; then
              touch doc/build/html/.nojekyll

              ./tools/ci/push_docs_to_repo.py doc/build/html \
                  git@github.com:numpy/devdocs.git \
                  --committer "numpy-circleci-bot" \
                  --email "numpy-circleci-bot@nomail" \
                  --message "Docs build of $CIRCLE_SHA1" \
                  --force
            else
              echo "Not on the main branch; skipping deployment"
            fi

      - add_ssh_keys:
          fingerprints:
            - "11:fb:19:69:80:3a:6d:37:9c:d1:ac:20:17:cd:c8:17"

      - run:
          name: select SSH key for neps repo
          command: |
            cat <<\EOF > ~/.ssh/config
            Host github.com
              IdentitiesOnly yes
              IdentityFile /home/circleci/.ssh/id_rsa_11fb1969803a6d379cd1ac2017cdc817
            EOF

      -  run:
          name: deploy neps
          command: |
            if [ "${CIRCLE_BRANCH}" == "main" ]; then
              touch doc/neps/_build/html/.nojekyll

              ./tools/ci/push_docs_to_repo.py doc/neps/_build/html \
                  git@github.com:numpy/neps.git \
                  --committer "numpy-circleci-bot" \
                  --email "numpy-circleci-bot@nomail" \
                  --message "Docs build of $CIRCLE_SHA1" \
                  --force
            else
              echo "Not on the main branch; skipping deployment"
            fi