summaryrefslogtreecommitdiffstats
path: root/third_party/python/glean_parser/.circleci/config.yml
blob: 8cd7f41930d40c482ebb8ae4469c30eb35377468 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
version: 2.1

commands:
    test-start:
        steps:
            - checkout
            - run:
                    name: environment
                    command: |
                        echo 'export PATH=.:$HOME/.local/bin:$PATH' >> $BASH_ENV
            - run:
                    name: Upgrade pip
                    command: |
                        pip install --upgrade --user pip

    test-min-requirements:
        steps:
            - run:
                    name: install minimum requirements
                    command: |
                        # Use requirements-builder to determine the minimum versions of
                        # all requirements and test those
                        # We install requirements-builder itself into its own venv, since
                        # otherwise its dependencies might install newer versions of
                        # glean_parser's dependencies.
                        python3 -m venv .rb
                        .rb/bin/pip install requirements-builder
                        .rb/bin/requirements-builder --level=min setup.py > min_requirements.txt

                        pip install --use-feature=2020-resolver --progress-bar off --user -U -r min_requirements.txt

    test-python-version:
        parameters:
            requirements-file:
                type: string
                default: "requirements_dev.txt"
        steps:
            - run:
                    name: install
                    command: |
                        pip install --use-feature=2020-resolver --progress-bar off --user -U -r <<parameters.requirements-file>>
                        sudo apt update -q
                        sudo apt upgrade -q
                        sudo apt install openjdk-11-jdk-headless
                        make install-kotlin-linters
            - run:
                    name: lint
                    command: make lint
            - run:
                    name: install
                    # Set CC to something that isn't a working compiler so we
                    # can detect if any of the dependencies require a compiler
                    # to be installed. We can't count on a working compiler
                    # being available to pip on all of the platforms we need to
                    # support, so we need to make sure the dependencies are all
                    # pure Python or provide pre-built wheels.
                    command: CC=broken_compiler python setup.py install --user
            - run:
                    name: test
                    command: make test

jobs:
    build-36:
        docker:
            - image: circleci/python:3.6.12
        steps:
            - test-start
            - test-python-version

    build-36-min:
        docker:
            - image: circleci/python:3.6.12
        steps:
            - test-start
            - test-min-requirements
            - test-python-version

    build-37:
        docker:
            - image: circleci/python:3.7.9
        steps:
            - test-start
            - test-python-version
            - run:
                    name: make-docs
                    command: |
                        make docs
                        touch docs/_build/html/.nojekyll
            - persist_to_workspace:
                    root: docs/_build
                    paths: html

    build-38:
        docker:
            - image: circleci/python:3.8.5
        steps:
            - test-start
            - test-python-version

    build-38-min:
        docker:
            - image: circleci/python:3.8.5
        steps:
            - test-start
            - test-min-requirements
            - test-python-version

    build-39:
        docker:
            - image: circleci/python:3.9.0rc1
        steps:
            - test-start
            - test-python-version

    docs-deploy:
        docker:
            - image: node:8.10.0
        steps:
            - checkout
            - add_ssh_keys:
                    fingerprints:
                        - "9b:25:aa:bf:39:b6:4a:e7:c3:52:cf:ab:23:81:3d:52"
            - attach_workspace:
                    at: docs/_build
            - run:
                    name: install
                    command: |
                        npm install -g --silent gh-pages@2.0.1
                        git config user.email "glean-ci@nowhere.com"
                        git config user.name "glean-ci"
            - run:
                    name: deploy
                    command: |
                        gh-pages --dotfiles --message "[ci skip] updates" --dist docs/_build/html

    pypi-deploy:
        docker:
            - image: circleci/python:3.7.5
        steps:
            - checkout
            - run:
                    name: environment
                    command: |
                        echo 'export PATH=.:$HOME/.local/bin:$PATH' >> $BASH_ENV
            - run:
                    name: Upgrade pip
                    command: |
                        pip install --upgrade --user pip
            - run:
                    name: install
                    command: |
                        pip install --use-feature=2020-resolver --user -U -r requirements_dev.txt
            - run:
                    name: deploy
                    # Requires that the TWINE_USERNAME and TWINE_PASSWORD environment
                    # variables are configured in CircleCI's environment variables.
                    command: |
                        make release

workflows:
    version: 2
    build:
        jobs:
            - build-36:
                    filters:
                        tags:
                            only: /.*/
            - build-36-min:
                    filters:
                        tags:
                            only: /.*/
            - build-37:
                    filters:
                        tags:
                            only: /.*/
            - build-38:
                    filters:
                        tags:
                            only: /.*/
            - build-38-min:
                    filters:
                        tags:
                            only: /.*/
            - build-39:
                    filters:
                        tags:
                            only: /.*/
            - docs-deploy:
                    requires:
                        - build-37
                    filters:
                        branches:
                            only: main
            - pypi-deploy:
                    requires:
                        - build-37
                    filters:
                        branches:
                            ignore: /.*/
                        tags:
                            only: /v[0-9]+(\.[0-9]+)*/