File: pythonpackage.yml

package info (click to toggle)
refnx 0.1.60-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,972 kB
  • sloc: python: 37,056; cpp: 1,015; ansic: 185; makefile: 180; sh: 130; lisp: 89; xml: 34
file content (445 lines) | stat: -rw-r--r-- 14,072 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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
name: Test

on:
  push:
    branches:
      - main
    tags:
      - "v*"
  pull_request:
    branches:
      - main
  workflow_dispatch:


permissions:
  contents: read

jobs:
###############################################################################
  test_linux:

    runs-on: ubuntu-22.04
    strategy:
      fail-fast: true
      max-parallel: 3
      matrix:
        python-version: ['3.11', '3.12', '3.13']

    steps:

    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'pip' # caching pip dependencies
        allow-prereleases: true

    - name: setup apt dependencies
      run: |
        sudo apt-get update
        sudo apt-get install xvfb qt6-base-dev libhdf5-serial-dev libnetcdf-dev build-essential
        sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

        python -m pip install --upgrade pip

    - name: Test with pytest
      env:
        MPLBACKEND: agg
      run: |
        python -m pip install --upgrade pip
        python -m pip install wheel build
        python -m build
        python -m pip install dist/*.whl
        pip install -r .requirements.txt

        # uses xvfb for GUI part of the test
        pushd tools
        xvfb-run pytest --pyargs refnx
        popd

        # check that refnx gui starts
        # python tools/app/check_app_starts.py refnx

        # run vendored ptemcee tests
        pytest --pyargs refnx._lib.ptemcee.tests

    - name: Make sdist
      if: ${{ matrix.python-version == '3.9' }}
      run: |
        git clean -xdf
        python setup.py sdist

    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
      if: ${{ matrix.python-version == '3.9' }}
      with:
        name: refnx-wheel-linux-${{ matrix.python-version }}
        path: dist/


#  linux_wheels:
#
#    runs-on: ubuntu-latest
#    strategy:
#      max-parallel: 2
#      matrix:
#        PLAT: ["manylinux2014_x86_64"]
#
#    steps:
#    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
#    - name: Make Linux Wheel
#      run: |
#        docker run --rm -e="PLAT=${{ matrix.PLAT }}" -v $(pwd):/io quay.io/pypa/${{ matrix.PLAT }} /bin/bash /io/tools/build_manylinux_wheels.sh
#
#    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
#      with:
#        name: refnx-wheel
#        path: dist/


###############################################################################
  test_macos_intel:

    runs-on: macos-13
    strategy:
      fail-fast: true
      max-parallel: 1
      matrix:
        python-version: [ '3.12' ]

    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

      - run: mkdir -p dist

      - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: ${{ matrix.python-version }}
          cache: 'pip' # caching pip dependencies
          allow-prereleases: true

      - name: Make wheel
        shell: bash
        run: |

          python -m pip install --upgrade pip
          python -m pip install wheel delocate build
          python -m build . -v

      - name: Install package and test with pytest
        shell: bash
        env:
          MPLBACKEND: agg
        run: |
          pip install -r .requirements.txt
          pushd dist
          python -m pip install --only-binary=refnx --no-index --find-links=. refnx
          pytest --pyargs refnx
          popd

      - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        with:
          name: refnx-wheel-macos-${{ matrix.python-version }}-intel
          path: dist/


  test_macos:

    runs-on: macos-14
    strategy:
      fail-fast: true
      max-parallel: 3
      matrix:
        python-version: ['3.11', '3.12', '3.13']

    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    - run: mkdir -p dist

    - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'pip' # caching pip dependencies
        allow-prereleases: true

    - name: install compilers
      shell: bash
      run: |
        brew install llvm

    - name: Make wheel
      shell: bash
      env:
        ARCHFLAGS: "-arch arm64"
        _PYTHON_HOST_PLATFORM: macosx-11.0-arm64
      run: |
        sudo xcode-select -s /Applications/Xcode_15.3.app
        export PATH="$PATH:/opt/homebrew/opt/llvm/bin"
        export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
        export LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib"

        python -m pip install --upgrade pip
        python -m pip install wheel delocate build
        python -m build . -v
        # so that libomp is distributed with wheel
        delocate-wheel -v dist/refnx*.whl

    - name: Install package and test with pytest
      shell: bash
      env:
        MPLBACKEND: agg
      run: |
        python -m pip install -r .requirements.txt
        pushd dist
        python -m pip install --only-binary=refnx --no-index --find-links=. refnx
        pytest --pyargs refnx
        popd

    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
      with:
        name: refnx-wheel-macos-${{ matrix.python-version }}
        path: dist/


  test_macos_app:
    needs: test_macos
    runs-on: macos-14
    strategy:
      fail-fast: true

    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
      with:
        python-version: '3.12'
        allow-prereleases: true

    - run: mkdir -p dist

    - name: Download wheel
      uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
      with:
        pattern: refnx-wheel-macos-3.12
        merge-multiple: true
        path: dist

    - name: Make frozen GUI executable
      run: |
        # make app in virtualenv
        python -m venv app
        source app/bin/activate
        python -m pip install --upgrade --upgrade-strategy eager -r tools/app/requirements.txt
        python -m pip install scipy
        pushd dist
        ls
        python -m pip install --only-binary=refnx --no-index --find-links=. refnx
        popd
        python -m pip install pyinstaller psutil
        # compileall in an effort to speedup pyinstaller GUI start
        python -m compileall

        pushd tools/app
        pyinstaller motofit.spec

        # check to see that the app starts
        python check_app_starts.py dist/refnx.app/Contents/MacOS/refnx
        popd
        printenv

    - name: Sign app and create dmg
      if: github.repository == 'refnx/refnx' && (github.event.pull_request.merged == true || startsWith(github.ref, 'refs/tags'))
      env:
        MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE_ISA }}
        MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_ISA_PWD }}
      run: |
        pushd tools/app
        echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
        ls -al certificate.p12
        security create-keychain -p DloaAcYP build.keychain
        security default-keychain -s build.keychain
        security unlock-keychain -p DloaAcYP build.keychain
        security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
        security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k DloaAcYP build.keychain >/dev/null
        security find-identity -p codesigning

        codesign --verify --options=runtime --entitlements entitlements.plist --timestamp --deep --verbose=4 --force --sign "Developer ID Application: The International Scattering Alliance (8CX8K63BQM)" dist/refnx.app

        cp ../../refnx/reflect/_app/icons/Motofit.icns .
        sips -i Motofit.icns
        DeRez -only icns Motofit.icns > icns.rsrc
        hdiutil create dist/refnx.dmg -srcfolder dist/refnx.app -ov -format UDZO
        Rez -append icns.rsrc -o dist/refnx.dmg
        SetFile -a C dist/refnx.dmg
        codesign -s "Developer ID Application: The International Scattering Alliance (8CX8K63BQM)" dist/refnx.dmg
        mv dist/refnx.dmg ../../dist/
        popd

# xcrun notarytool submit --apple-id "$APPLEID" --password "$APP_PASSWORD" --team-id 8CX8K63BQM --wait refnx.dmg
    - name: Notarize DMG
      if: github.repository == 'refnx/refnx' && (github.event.pull_request.merged == true || startsWith(github.ref, 'refs/tags'))
      uses: lando/notarize-action@b5c3ef16cf2fbcf2af26dc58c90255ec242abeed # v2.0.2
      with:
        product-path: "dist/refnx.dmg"
        primary-bundle-id: "com.refnx.refnx"
        appstore-connect-username: ${{ secrets.NOTARIZATION_USERNAME }}
        appstore-connect-password: ${{ secrets.NOTARIZATION_PASSWORD }}
        appstore-connect-team-id: 8CX8K63BQM
        verbose: True

    - name: Staple Release Build
      if: github.repository == 'refnx/refnx' && (github.event.pull_request.merged == true || startsWith(github.ref, 'refs/tags'))
      uses: BoundfoxStudios/action-xcode-staple@1e2200b448c6ed4dd44b963ff17d3e340fc6b064 # v1
      with:
        product-path: "dist/refnx.dmg"

    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
      with:
        name: refnx-app-macos-${{ matrix.python-version }}
        path: dist/*.dmg


###############################################################################
  test_win:

    runs-on: windows-latest
    strategy:
      fail-fast: true
      max-parallel: 3
      matrix:
        python-version: ['3.11', '3.12', '3.13']

    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
      with:
        python-version: ${{ matrix.python-version }}
        cache: 'pip' # caching pip dependencies
        allow-prereleases: true

    - run: pip install -r .requirements.txt

    - run: mkdir -p dist

    - name: Make wheel
      run: |
        python -m pip install --upgrade pip
        python -m pip install wheel
        python -m pip wheel . --no-deps -w dist

    - name: Install package and test with pytest
      if: ${{ matrix.python-version == '3.12' }}
      env:
        PYOPENCL_CTX: 0
      run: |
        cd dist
        python -m pip install --only-binary=refnx --no-index --find-links=. refnx

        #        python -m pip install pytools mako cffi
        #        choco install opencl-intel-cpu-runtime
        #        python -m pip install --only-binary=pyopencl --find-links http://www.silx.org/pub/wheelhouse/ --trusted-host www.silx.org pyopencl

        pytest --pyargs refnx
        cd ..

    - name: Check refnx gui starts
      if: ${{ matrix.python-version == '3.12' }}
      run: |
        # check that refnx gui starts
        pip install psutil
        python tools/app/check_app_starts.py refnx

    - name: Make frozen GUI executable
      if: ${{ matrix.python-version == '3.12' }}
      run: |
        # make app in virtualenv
        pip uninstall -y h5py
        python -m venv app
        app\Scripts\activate.bat
        python -m pip install --upgrade --upgrade-strategy eager -r tools/app/requirements.txt
        cd dist
        python -m pip install --only-binary=refnx --no-index --find-links=. refnx
        cd ..

        # fix for multiprocessing on Py3.9 is not merged in PyInstaller
        # if you are on Py3.7 you can just pip install pyinstaller
        # pip install git+https://github.com/andyfaff/pyinstaller.git@gh4865

        cd tools\app
        pyinstaller motofit.spec
        move dist\motofit.exe ..\..\dist\
        cd ..\..

    - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
      with:
        name: refnx-exe-win-${{ matrix.python-version }}
        path: dist/


###############################################################################
  build_doc:

    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version: ["3.12"]

    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
      with:
        python-version: ${{ matrix.python-version }}

    - name: setup apt dependencies
      run: |
        sudo apt-get update
        sudo apt-get install pandoc

    - name: Build documentation
      run: |
        python -m pip install --upgrade pip
        python -m pip install .
        python -m pip install wheel
        cd doc
        python -m pip install -r requirements.txt
        make html


###############################################################################
  lint:
    runs-on: ubuntu-latest
    strategy:
      max-parallel: 1
      matrix:
        python-version: ["3.12"]

    steps:
    - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
      with:
        python-version: ${{ matrix.python-version }}

    - name: Lint with flake8 and black
      run: |
        python -m pip install ruff black
        # stop the build if there are Python syntax errors or undefined names
        # the ignores are taken care of by black
        ruff check refnx
        black --check refnx

    - name: clang-format
      run: |
        sudo apt update
        sudo apt install clang-format
        cd src
        clang-format --Werror -n *.cpp *.h *.c
        cd pnr
        clang-format --Werror -n *.cc *.h