File: ci-build.yml

package info (click to toggle)
mpi4py 4.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,560 kB
  • sloc: python: 35,306; ansic: 16,482; sh: 837; makefile: 618; cpp: 193; f90: 178
file content (170 lines) | stat: -rw-r--r-- 4,732 bytes parent folder | download | duplicates (2)
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
name: ci-build

on:  # yamllint disable-line rule:truthy
  schedule:
    - cron: '0 3 * * 0'
  workflow_call:
    inputs:
      py:
        description: 'Python version'
        required: false
        default: 3
        type: string
  workflow_dispatch:
    inputs:
      py:
        description: 'Python version'
        required: true
        default: 3
        type: string

permissions:
  contents: read

jobs:

  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        backend:
          - skbuild
          - mesonpy
        os:
          - ubuntu-24.04
          - macos-15
          - windows-2025
        mpi:
          - mpich
          - openmpi
          - impi
          - msmpi
        exclude:
          - backend: mesonpy
            os:  windows-2025
            mpi: impi
          - os:  ubuntu-24.04
            mpi: msmpi
          - os:  ubuntu-22.04
            mpi: msmpi
          - os:  macos-15
            mpi: impi
          - os:  macos-15
            mpi: msmpi
          - os:  windows-2025
            mpi: mpich
          - os:  windows-2025
            mpi: openmpi

    steps:

    - uses: step-security/harden-runner@v2
      with:
        egress-policy: audit

    - name: Checkout
      uses: actions/checkout@v5

    - name: Setup MSVC
      if:   matrix.backend == 'mesonpy' && runner.os == 'Windows'
      uses: bus1/cabuild/action/msdevshell@v1
      with:
        architecture: x64

    - name: Setup MPI (${{ matrix.mpi }})
      uses: mpi4py/setup-mpi@v1
      with:
        mpi: ${{ matrix.mpi }}

    - name: Setup Python (${{ github.event.inputs.py || 3 }})
      uses: actions/setup-python@v6
      with:
        python-version: ${{ github.event.inputs.py || 3 }}
        check-latest: true
        cache: pip
        cache-dependency-path: |
          conf/requirements-build-cython.txt
          conf/requirements-build-${{ matrix.backend }}.txt

    - name: Upgrade pip
      run:  python -m pip install -U pip

    - name: Install Python packages (build)
      run:  python -m pip install -U build

    - name: Build sdist and wheel (${{ matrix.backend }})
      run:  python -m build
      env:
        MPI4PY_BUILD_BACKEND: ${{ matrix.backend }}
        MPI4PY_LOCAL_VERSION: ${{ matrix.mpi }}

    - name: Upload wheel
      uses: actions/upload-artifact@v4
      with:
        name: mpi4py-${{ matrix.backend }}-${{ matrix.os }}-${{ matrix.mpi }}
        path: dist/mpi4py-*.whl

    - name: Install wheel
      run:  python -m pip install mpi4py
              --verbose --no-index --find-links=dist

    - name: Test wheel after install (cmdline)
      run:  mpiexec -n 1 python -m mpi4py --mpi-library

    - name: Test wheel after install (cmdline)
      run:  mpiexec -n 1 python -m mpi4py --mpi-lib-version

    - name: Test wheel after install (test_package)
      run:  mpiexec -n 1 python test/main.py test_package

    - name: Test wheel after install (helloworld)
      run:  mpiexec -n 2 python -m mpi4py.bench helloworld

    - name: Test wheel after install (ringtest)
      run:  mpiexec -n 3 python -m mpi4py.bench ringtest

    - name: Test wheel after install (I_MPI_LIBRARY_KIND=debug)
      if:   matrix.mpi == 'impi' && runner.os == 'Windows'
      run:  |
        mpiexec -n 1 python -m mpi4py --mpi-library
        mpiexec -n 2 python -m mpi4py.bench helloworld
        mpiexec -n 3 python -m mpi4py.bench ringtest
      env:
        I_MPI_LIBRARY_KIND: debug

    - name: Test wheel after install (I_MPI_LIBRARY_KIND=release)
      if:   matrix.mpi == 'impi' && runner.os == 'Windows'
      run:  |
        mpiexec -n 1 python -m mpi4py --mpi-library
        mpiexec -n 2 python -m mpi4py.bench helloworld
        mpiexec -n 3 python -m mpi4py.bench ringtest
      env:
        I_MPI_LIBRARY_KIND: release

    - name: Uninstall wheel after testing
      run:  python -m pip uninstall mpi4py
              --verbose --yes

    - name: Install package with pip (${{ matrix.backend }})
      run:  python -m pip install .
              --verbose
      env:
        MPI4PY_BUILD_BACKEND: ${{ matrix.backend }}
        MPI4PY_LOCAL_VERSION: ${{ matrix.mpi }}

    - name: Test wheel after install (cmdline)
      run:  mpiexec -n 1 python -m mpi4py --mpi-library

    - name: Test wheel after install (cmdline)
      run:  mpiexec -n 1 python -m mpi4py --mpi-lib-version

    - name: Test package after install (test_package)
      run:  mpiexec -n 1 python test/main.py test_package

    - name: Test package after install (helloworld)
      run:  mpiexec -n 2 python -m mpi4py.bench helloworld

    - name: Uninstall package after testing
      run:  python -m pip uninstall mpi4py
              --verbose --yes