File: test.yml

package info (click to toggle)
ipyparallel 9.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,388 kB
  • sloc: python: 22,769; javascript: 267; makefile: 29; sh: 28
file content (166 lines) | stat: -rw-r--r-- 4,902 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
name: Test

on:
  pull_request:
  push:
    branches-ignore:
      - "pre-commit-ci*"

concurrency:
  group: >-
    ${{ github.workflow }}-
    ${{ github.ref_type }}-
    ${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

env:
  # UTF-8 content may be interpreted as ascii and causes errors without this.
  LANG: C.UTF-8
  IPP_DISABLE_JS: "1"
  JUPYTER_PLATFORM_DIRS: "1"

jobs:
  test:
    runs-on: ${{ matrix.runs_on || 'ubuntu-22.04' }}
    timeout-minutes: 20

    strategy:
      # Keep running even if one variation of the job fail
      fail-fast: false
      matrix:
        include:
          - python: "3.9"
          - python: "3.8"
            cluster_type: mpi
          - python: "3.10"
            cluster_type: slurm
            container: slurmctld
          - python: "3.8"
          - python: "3.10"
            env:
              IPP_CONTROLLER_IP: "*"
          - python: "3.9"
            env:
              IPP_ENABLE_CURVE: "1"
          - python: "3.9"
            runs_on: windows-2022
          - python: "3.9"
            runs_on: macos-14
          - python: "3.11"
          - python: "3.12"
            pre: pre

    steps:
      - uses: actions/checkout@v4

      - name: Cache conda environment
        uses: actions/cache@v4
        with:
          path: |
            ~/conda
          key: conda

      - name: Cache node_modules
        uses: actions/cache@v4
        with:
          path: |
            node_modules
          key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: Set environment variables
        if: ${{ matrix.env }}
        env:
          MATRIX_ENV: ${{ toJSON(matrix.env) }}
        run: |
          python3 <<EOF
          import json
          import os
          matrix_env = json.loads(os.environ["MATRIX_ENV"])
          with open(os.environ["GITHUB_ENV"], "a") as f:
              for key, value in matrix_env.items():
                  f.write(f"{key}={value}\n")
          EOF

      - name: Set up slurm
        if: ${{ matrix.cluster_type == 'slurm' }}
        run: |
          export DOCKER_BUILDKIT=1
          export COMPOSE_DOCKER_CLI_BUILD=1
          cd ci/slurm
          docker compose up -d --build

      - name: Install Python (conda) ${{ matrix.python }}
        if: ${{ matrix.cluster_type == 'mpi' }}
        run: |
          export MAMBA_ROOT_PREFIX=$HOME/conda
          test -d $MAMBA_ROOT_PREFIX || mkdir $MAMBA_ROOT_PREFIX
          wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba
          eval "$(./bin/micromamba shell hook -s posix)"
          micromamba activate
          micromamba install -y -c conda-forge mpich mpi4py python=${{ matrix.python }}
          echo "PATH=$MAMBA_ROOT_PREFIX/bin:$PATH" >> $GITHUB_ENV

      - name: Install Python ${{ matrix.python }}
        if: ${{ matrix.cluster_type != 'mpi' }}
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python }}

      - name: Install ipyparallel itself
        run: |
          pip install --upgrade pip
          pip install --no-deps .

      - name: Install Python dependencies
        run: |
          pip install --upgrade ipyparallel[test]

      - name: Install pre-release dependencies
        if: ${{ matrix.pre }}
        run: |
          pip install --pre --upgrade ipyparallel[test] 'https://github.com/ipython/ipykernel/archive/main.tar.gz#egg=ipykernel'

      - name: Install extra Python packages
        if: ${{ ! startsWith(matrix.python, '3.11') }}
        run: |
          pip install distributed joblib
          pip install --only-binary :all: matplotlib

      - name: Show environment
        run: pip freeze

      - name: Run tests in container ${{ matrix.container }}
        if: ${{ matrix.container }}
        run: echo "EXEC=docker exec -i ${{ matrix.container }}" >> $GITHUB_ENV

      - name: Run ${{ matrix.cluster_type }} tests
        if: ${{ matrix.cluster_type }}
        run: |
          ${EXEC:-} pytest -v --maxfail=2 --cov=ipyparallel ipyparallel/tests/test_${{ matrix.cluster_type }}.py

      - name: Run tests
        if: ${{ ! matrix.cluster_type }}
        run: |
          pytest -v --maxfail=3 --cov=ipyparallel

      - name: Fixup coverage permissions ${{ matrix.container }}
        if: ${{ matrix.container }}
        run: |
          ls -l .coverage*
          ${EXEC} chmod -R a+rw .coverage*

      - name: Submit codecov report
        uses: codecov/codecov-action@v5

      - name: Report on slurm
        if: ${{ matrix.cluster_type == 'slurm' && failure() }}
        run: |
          set -x
          docker ps -a
          docker exec -i slurmctld squeue --states=all
          docker exec -i slurmctld sinfo
          docker logs slurmctld
          docker logs c1
          docker logs c2