File: gh-ci.yaml

package info (click to toggle)
mdanalysis 2.4.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 109,240 kB
  • sloc: python: 73,917; ansic: 8,185; makefile: 145; sh: 97
file content (314 lines) | stat: -rw-r--r-- 9,052 bytes parent folder | download
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
name: GH Actions CI
on:
  push:
    branches:
      - develop
      - master
  pull_request:
    branches:
      - develop
      - master

concurrency:
  # Probably overly cautious group naming.
  # Commits to develop/master will cancel each other, but PRs will only cancel
  # commits within the same PR
  group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
  cancel-in-progress: true

defaults:
  run:
    shell: bash -l {0}

jobs:
  main_tests:
    if: "github.repository == 'MDAnalysis/mdanalysis'"
    runs-on: ${{ matrix.os }}
    strategy:
        fail-fast: false
        matrix:
          os: [ubuntu-latest, ]
          python-version: ["3.8", "3.9", "3.10"]
          full-deps: [true, ]
          install_hole: [true, ]
          codecov: [true, ]
          include:
            - name: py311-ubuntu-min
              os: ubuntu-latest
              python-version: "3.11"
              full-deps: false
              install_hole: true
              codecov: false
            - name: macOS_monterey_py39
              os: macOS-12
              python-version: 3.9
              full-deps: true
              install_hole: true
              codecov: true
            - name: macOS_bigsur_py38
              os: macOS-11
              python-version: 3.8
              full-deps: true
              install_hole: true
              codecov: false
            - name: minimal-ubuntu
              os: ubuntu-latest
              python-version: 3.8
              full-deps: false
              install_hole: false
              codecov: true
            - name: numpy_min
              os: ubuntu-latest
              python-version: 3.8
              full-deps: false
              install_hole: false
              codecov: false
              numpy: numpy=1.20.0
            - name: asv_check
              os: ubuntu-latest
              python-version: 3.8
              full-deps: true
              install_hole: false
              codecov: false
              extra-pip-deps: asv
    env:
      CYTHON_TRACE_NOGIL: 1
      MPLBACKEND: agg

    steps:
    - uses: actions/checkout@v3

    - name: setup_os
      uses: ./.github/actions/setup-os
      with:
        os-type: ${{ matrix.os }}

    - name: setup_miniconda
      uses: conda-incubator/setup-miniconda@v2
      with:
        python-version: ${{ matrix.python-version }}
        auto-update-conda: true
        channel-priority: flexible
        channels: conda-forge, bioconda
        add-pip-as-python-dependency: true
        mamba-version: "*"
        architecture: x64

    - name: install_deps
      uses: ./.github/actions/setup-deps
      with:
        mamba: true
        full-deps: ${{ matrix.full-deps }}
        # in most cases will just default to empty, i.e. pick up max version from other deps
        numpy: ${{ matrix.numpy }}
        extra-pip-deps: ${{ matrix.extra-pip-deps }}

    - name: build_srcs
      uses: ./.github/actions/build-src
      with:
        build-hole: ${{ matrix.install_hole }}
        build-tests: true
        build-docs: false

    - name: run_tests
      if: contains(matrix.name, 'asv_check') != true
      run: |
        PYTEST_FLAGS="--disable-pytest-warnings --durations=50"
        if [ ${{ matrix.codecov }} = "true" ]; then
          PYTEST_FLAGS="${PYTEST_FLAGS} --cov-config=.coveragerc --cov=MDAnalysis --cov-report=xml"
        fi
        echo $PYTEST_FLAGS
        pytest -n $numprocs testsuite/MDAnalysisTests $PYTEST_FLAGS

    - name: run_asv
      if: contains(matrix.name, 'asv_check')
      run: |
        cd benchmarks
        time python -m asv check -E existing

    - name: codecov
      if: matrix.codecov
      uses: codecov/codecov-action@v3
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        file: coverage.xml
        fail_ci_if_error: True
        verbose: True


  build_docs:
    if: "github.repository == 'MDAnalysis/mdanalysis'"
    runs-on: ubuntu-latest
    env:
      CYTHON_TRACE_NOGIL: 1
      MPLBACKEND: agg

    steps:
    - uses: actions/checkout@v3

    - name: setup_miniconda
      uses: conda-incubator/setup-miniconda@v2
      with:
        python-version: 3.8
        auto-update-conda: true
        channel-priority: flexible
        channels: conda-forge, bioconda
        add-pip-as-python-dependency: true
        architecture: x64
        mamba-version: "*"

    - name: install_deps
      uses: ./.github/actions/setup-deps
      with:
        mamba: true
        full-deps: true
        extra-pip-deps: "sphinx sphinx-sitemap sphinx_rtd_theme msmb_theme==1.2.0 sphinxcontrib-bibtex pybtex pybtex-docutils"

    - name: build_srcs
      uses: ./.github/actions/build-src
      with:
        build-hole: false
        build-tests: false
        build-docs: true

    - name: deploy_docs
      if: github.event_name != 'pull_request'
      env:
        GH_USER: github-actions
        GH_EMAIL: "github-action@users.noreply.github.com"
        GH_REPOSITORY: "github.com/${{ github.repository }}.git"
        GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        URL: https://docs.mdanalysis.org

      run: |
        # set up environment variables
        # cannot execute bash to make variables in env section
        # export URL for the Python script $UPDATE_JSON
        export URL
        export VERSION=$(cd package/MDAnalysis; python -c 'import version; print(version.__version__)')
        UPDATE_JSON=$(pwd)/maintainer/update_json_stubs_sitemap.py
        BRANCH="${GITHUB_REF#refs/heads/}"

        # the below turns off non-blocking as it causes large writes to stdout to fail
        # (see https://github.com/travis-ci/travis-ci/issues/4704)
        # commented out as this is not a problem with gh-actions
        # python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);'
        cd package/doc/html/html

        # move docs into version subfolder
        mkdir ../${VERSION} && mv * ../${VERSION} && mv ../${VERSION} $VERSION

        # set up git
        REV=$(git rev-parse --short HEAD)
        git init
        git config user.name $GH_USER
        git config user.email $GH_EMAIL
        git remote add upstream "https://${GH_USER}:${GH_TOKEN}@${GH_REPOSITORY}"
        git fetch --depth 50 upstream $BRANCH gh-pages
        git reset upstream/gh-pages

        # redirects and copies
        mkdir latest
        python $UPDATE_JSON
        touch .
        touch .nojekyll

        git add -A ${VERSION}/
        git add .nojekyll versions.json *.xml *.html index.html latest

        for dirname in dev stable documentation_pages ; do
          if [ -d $dirname ]; then git add $dirname; fi
        done

        # check for anything to commit
        # https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes
        git diff-index --quiet HEAD -- || git commit -m "rebuilt html docs for version ${VERSION} from branch ${BRANCH} with sphinx at ${REV}"
        git push -q upstream HEAD:gh-pages


  pylint_check:
    if: "github.repository == 'MDAnalysis/mdanalysis'"
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3

    - uses: actions/setup-python@v4
      with:
        python-version: 3.8

    - name: install
      run: |
        python -m pip install pylint

    - name: pylint
      env:
        PYLINTRC: package/.pylintrc
      run: |
        pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests


  darker_lint:
    if: "github.repository == 'MDAnalysis/mdanalysis'"
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash

    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0

    - uses: actions/setup-python@v4
      with:
        python-version: 3.8

    - name: darker main code
      uses: akaihola/darker@1.5.1
      with:
        version: "@master"
        options: "--check --diff --color"
        src: "./package/MDAnalysis"
        revision: "HEAD^"
        lint: "flake8"

    - name: darker test code
      uses: akaihola/darker@1.5.1
      if: success() || failure()
      with:
        version: "@master"
        options: "--check --diff --color"
        src: "./testsuite/MDAnalysisTests"
        revision: "HEAD^"
        lint: "flake8"


  pypi_check:
    if: "github.repository == 'MDAnalysis/mdanalysis'"
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./package

    steps:
    - uses: actions/checkout@v3

    - uses: actions/setup-python@v4
      with:
        python-version: 3.8

    - name: install_deps
      run: |
        python -m pip install twine "readme-renderer>=34.0"

    - name: build_sdist
      run: |
        pipx run build --sdist

    - name: check_package_build
      run: |
        DISTRIBUTION=$(ls -t1 dist/MDAnalysis-*.tar.gz | head -n 1)
        test -n "${DISTRIBUTION}" || { echo "no distribution dist/MDAnalysis-*.tar.gz found"; exit 1; }
        echo "twine check $DISTRIBUTION"
        twine check $DISTRIBUTION