File: cirrus_wheels.yml

package info (click to toggle)
numpy 1%3A2.2.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 83,420 kB
  • sloc: python: 248,499; asm: 232,365; ansic: 216,874; cpp: 135,657; f90: 1,540; sh: 938; fortran: 558; makefile: 409; sed: 139; xml: 109; java: 92; perl: 79; cs: 54; javascript: 53; objc: 29; lex: 13; yacc: 9
file content (175 lines) | stat: -rw-r--r-- 5,812 bytes parent folder | download | duplicates (3)
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
build_and_store_wheels: &BUILD_AND_STORE_WHEELS
  install_cibuildwheel_script:
    - python -m pip install cibuildwheel
  cibuildwheel_script:
    - cibuildwheel
  wheels_artifacts:
    path: "wheelhouse/*"

######################################################################
# Build linux_aarch64 natively
######################################################################

linux_aarch64_task:
  use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
  env:
    CIRRUS_CLONE_SUBMODULES: true
  compute_engine_instance:
    image_project: cirrus-images
    image: family/docker-builder-arm64
    architecture: arm64
    platform: linux
    cpu: 1
    memory: 4G
  matrix:
    # build in a matrix because building and testing all four wheels in a
    # single task takes longer than 60 mins (the default time limit for a
    # cirrus-ci task).
    - env:
        CIBW_BUILD: cp310-*
    - env:
        CIBW_BUILD: cp311-*
    - env:
        CIBW_BUILD: cp312-*
    - env:
        CIBW_BUILD: cp313-*
    - env:
        CIBW_BUILD: cp313t-*
        CIBW_FREE_THREADED_SUPPORT: 1
        CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"

  initial_setup_script: |
    apt update
    apt install -y python3-venv python-is-python3 gfortran libatlas-base-dev libgfortran5 eatmydata
    git fetch origin
    bash ./tools/wheels/cibw_before_build.sh ${PWD}
    which python
    echo $CIRRUS_CHANGE_MESSAGE
  <<: *BUILD_AND_STORE_WHEELS


######################################################################
# Build macosx_arm64 natively
#
# macosx_arm64 for macos >= 14 used to be built here, but are now
# built on GHA.
######################################################################

macosx_arm64_task:
  use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
  env:
      CIRRUS_CLONE_SUBMODULES: true
  macos_instance:
    matrix:
      image: ghcr.io/cirruslabs/macos-monterey-xcode

  matrix:
    - env:
        CIBW_BUILD: cp310-* cp311-*
    - env:
        CIBW_BUILD: cp312-* cp313-*
    - env:
        CIBW_BUILD: cp313t-*
        CIBW_FREE_THREADED_SUPPORT: 1
        CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"
  env:
    PATH: /usr/local/lib:/usr/local/include:$PATH
    CIBW_ARCHS: arm64

  build_script: |
    brew install micromamba gfortran
    micromamba shell init -s bash --root-prefix ~/micromamba
    source ~/.bash_profile
    
    micromamba create -n numpydev
    micromamba activate numpydev
    micromamba install -y -c conda-forge python=3.11 2>/dev/null
    
    # Use scipy-openblas wheels
    export INSTALL_OPENBLAS=true
    export CIBW_ENVIRONMENT_MACOS="MACOSX_DEPLOYMENT_TARGET='11.0' INSTALL_OPENBLAS=true RUNNER_OS=macOS PKG_CONFIG_PATH=$PWD/.openblas"

    # needed for submodules
    git submodule update --init
    # need to obtain all the tags so setup.py can determine FULLVERSION
    git fetch origin
    uname -m
    python -c "import platform;print(platform.python_version());print(platform.system());print(platform.machine())"
    clang --version

    python -m pip install cibuildwheel
    cibuildwheel

  wheels_artifacts:
    path: "wheelhouse/*"

######################################################################
# Upload all wheels
######################################################################

wheels_upload_task:
  use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
  # Artifacts don't seem to be persistent from task to task.
  # Rather than upload wheels at the end of each cibuildwheel run we do a
  # final upload here. This is because a run may be on different OS for
  # which bash, etc, may not be present.
  depends_on:
    - linux_aarch64
    - macosx_arm64
  compute_engine_instance:
    image_project: cirrus-images
    image: family/docker-builder
    platform: linux
    cpu: 1

  env:
    NUMPY_STAGING_UPLOAD_TOKEN: ENCRYPTED[!5a69522ae0c2af9edb2bc1cdfeaca6292fb3666d9ecd82dca0615921834a6ce3b702352835d8bde4ea2a9ed5ef8424ac!]
    NUMPY_NIGHTLY_UPLOAD_TOKEN: ENCRYPTED[4376691390321cd5e76613ec21de8456cc0af0164971dd9542f985a017dc30ccb4d40e60f59184618e2d55afd63e93b7]

  upload_script: |
    apt-get update
    apt-get install -y curl wget
    export IS_SCHEDULE_DISPATCH="false"
    export IS_PUSH="false"

    # cron job
    if [[ "$CIRRUS_CRON" == "nightly" ]]; then
      export IS_SCHEDULE_DISPATCH="true"
    fi

    # a manual build was started
    if [[ "$CIRRUS_BUILD_SOURCE" == "api" && "$CIRRUS_COMMIT_MESSAGE" == "API build for null" ]]; then
      export IS_SCHEDULE_DISPATCH="true"
    fi

    # only upload wheels to staging if it's a tag beginning with 'v' and you're
    # on a maintenance branch
    if [[ "$CIRRUS_TAG" == v* ]] && [[ $CIRRUS_TAG != *"dev0"* ]]; then
      export IS_PUSH="true"
    fi

    if [[ $IS_PUSH == "true" ]] || [[ $IS_SCHEDULE_DISPATCH == "true" ]]; then
        # install miniconda in the home directory. For some reason HOME isn't set by Cirrus
        export HOME=$PWD

        # install miniconda for uploading to anaconda
        wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
        bash miniconda.sh -b -p $HOME/miniconda3
        $HOME/miniconda3/bin/conda init bash
        source $HOME/miniconda3/bin/activate
        conda install -y anaconda-client

        # The name of the zip file is derived from the `wheels_artifact` line.
        # If you change the artifact line to `myfile_artifact` then it would be
        # called myfile.zip

        curl https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/wheels.zip --output wheels.zip
        unzip wheels.zip

        source ./tools/wheels/upload_wheels.sh
        # IS_PUSH takes precedence over IS_SCHEDULE_DISPATCH
        set_upload_vars

        # Will be skipped if not a push/tag/scheduled build
        upload_wheels
    fi