summaryrefslogtreecommitdiff
path: root/.circleci/config.yml
blob: 22bacb99eb8f4bd734015fc43261bded7a3416fb (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
# See: https://circleci.com/docs/2.0/language-python/

version: 2
jobs:
  build:
    working_directory: ~/repo
    docker:
      - image: circleci/python:3.8.5-buster

    steps:
      - checkout

      - run:
          name: Update apt-get
          command: |
            sudo apt-get update

      - run:
          name: Install Graphviz
          command: |
            sudo apt-get install graphviz libgraphviz-dev

      - run:
          name: Install TeX
          command: |
            sudo apt-get install texlive texlive-latex-extra latexmk

      - run:
          name: Install Python dependencies
          command: |
            python3 -m venv venv
            source venv/bin/activate
            pip install --upgrade pip wheel setuptools
            pip install -r requirements.txt
            pip install -r requirements/doc.txt
            pip install pydot pygraphviz

      - run:
          name: Install
          command: |
            source venv/bin/activate
            pip install -e .

      - run:
          name: Build docs
          command: |
            source venv/bin/activate
            make -C doc/ html
            make -C doc/ latexpdf LATEXOPTS="-file-line-error -halt-on-error"
            cp -a doc/build/latex/networkx_reference.pdf doc/build/html/_downloads/.

      - store_artifacts:
          path: doc/build/html

      - persist_to_workspace:
          root: doc/build
          paths:
            - html

  deploy:
    working_directory: ~/repo
    docker:
      - image: circleci/python:3.8.3-buster

    steps:
      - attach_workspace:
          at: /tmp/build

      - add_ssh_keys:
          fingerprints:
            - "e5:04:e6:c4:d6:c3:34:b9:02:e6:9f:25:1c:01:9e:e9"

      - run:
          name: upload_devdocs
          command: |
            set -e
            echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
            git clone git@github.com:networkx/documentation.git
            cd documentation
            rm -rf latest
            cp -R /tmp/build/html latest
            git config --global user.email "networkx-circleci-bot@nomail"
            git config --global user.name "networkx-circleci-bot"
            git config --global push.default simple;
            git commit -am "Docs built from $CIRCLE_SHA1"
            git push origin gh-pages

workflows:
  version: 2
  default:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master