|
| 1 | +# This file was last autogenerated by maturin v1.11.5 |
| 2 | +# To update, run |
| 3 | +# |
| 4 | +# maturin generate-ci github --manifest-path pineappl_cli/Cargo.toml > .github/workflow/release-wheels.yaml |
| 5 | +# |
| 6 | +# and carefully select the change from `git diff` |
| 7 | +name: Release CLI Python distribution |
| 8 | + |
| 9 | +# for available runner images see: https://github.com/actions/runner-images |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + tags: |
| 14 | + - 'v[0-9]+*' |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + linux: |
| 22 | + runs-on: ${{ matrix.platform.runner }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + platform: |
| 26 | + - runner: ubuntu-22.04 |
| 27 | + target: x86_64 |
| 28 | + manylinux: 2_17 |
| 29 | + # - runner: ubuntu-22.04 |
| 30 | + # target: x86 |
| 31 | + # manylinux: 2_17 |
| 32 | + # - runner: ubuntu-22.04 |
| 33 | + # target: aarch64 |
| 34 | + # manylinux: 2_17 |
| 35 | + # - runner: ubuntu-22.04 |
| 36 | + # target: armv7 |
| 37 | + # manylinux: 2_17 |
| 38 | + # - runner: ubuntu-22.04 |
| 39 | + # target: s390x |
| 40 | + # manylinux: 2_17 |
| 41 | + # - runner: ubuntu-22.04 |
| 42 | + # target: ppc64le |
| 43 | + # manylinux: 2_17 |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v6 |
| 46 | + - name: Build wheels |
| 47 | + uses: PyO3/maturin-action@v1 |
| 48 | + with: |
| 49 | + target: ${{ matrix.platform.target }} |
| 50 | + args: --release --out dist --manifest-path pineappl_cli/Cargo.toml |
| 51 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 52 | + manylinux: ${{ matrix.platform.manylinux }} |
| 53 | + before-script-linux: | |
| 54 | + export APPLGRID_V=1.6.36 |
| 55 | + export FASTNLO_V=2.5.0-2826 |
| 56 | + export LHAPDF_V=6.5.4 |
| 57 | + export ZLIB_V=1.3.1 |
| 58 | + export APPL_IGRID_DIR="/usr/local/src/applgrid-${APPLGRID_V}/src" |
| 59 | + # install LHAPDF |
| 60 | + curl -L "https://lhapdf.hepforge.org/downloads/?f=LHAPDF-${LHAPDF_V}.tar.gz" | tar xzf - |
| 61 | + cd LHAPDF-${LHAPDF_V} |
| 62 | + # compile static libraries with PIC to make statically linking PineAPPL's CLI work |
| 63 | + # see also https://users.rust-lang.org/t/why-does-crelocation-model-dynamic-no-pic-help-although-it-shouldnt/109012 |
| 64 | + ./configure --disable-python --disable-shared --with-pic=yes |
| 65 | + make -j V=1 |
| 66 | + make install |
| 67 | + ldconfig |
| 68 | + cd .. |
| 69 | + # install zlib; we need to link against it statically |
| 70 | + curl -fsSL "https://www.zlib.net/fossils/zlib-${ZLIB_V}.tar.gz" | tar xzf - |
| 71 | + cd zlib-${ZLIB_V} |
| 72 | + CFLAGS=-fPIC ./configure --static --prefix=/usr/local |
| 73 | + make -j |
| 74 | + make install |
| 75 | + ldconfig |
| 76 | + cd .. |
| 77 | + # install APPLgrid |
| 78 | + curl -fsSL "https://applgrid.hepforge.org/downloads/applgrid-${APPLGRID_V}.tgz" | tar xzf - |
| 79 | + cd applgrid-${APPLGRID_V} |
| 80 | + patch -l -p0 <<EOF |
| 81 | + --- src/combine.cxx 2024-04-23 16:35:27.000000000 +0200 |
| 82 | + +++ src/combine.cxx.new 2024-07-06 12:29:12.813303074 +0200 |
| 83 | + @@ -56,12 +56,6 @@ |
| 84 | + } |
| 85 | +
|
| 86 | +
|
| 87 | + -double integral( appl::TH1D* h ) { |
| 88 | + - double d = 0; |
| 89 | + - for ( int i=0 ; i<h->GetNbinsX() ; i++ ) d += h->GetBinContent(i+1); |
| 90 | + - return d; |
| 91 | + -} |
| 92 | + - |
| 93 | +
|
| 94 | + void print( appl::TH1D* h ) { |
| 95 | + for ( int i=1 ; i<=h->GetNbinsX() ; i++ ) std::cout << h->GetBinContent(i) << " "; |
| 96 | + EOF |
| 97 | + # compile static libraries with PIC to make statically linking PineAPPL's CLI work |
| 98 | + ./configure --without-root --disable-shared --with-pic=yes |
| 99 | + make -j |
| 100 | + make install |
| 101 | + ldconfig |
| 102 | + mkdir -p ${APPL_IGRID_DIR} |
| 103 | + cp src/*.h ${APPL_IGRID_DIR} |
| 104 | + cd .. |
| 105 | + # install fastNLO |
| 106 | + curl "https://fastnlo.hepforge.org/code/v25/fastnlo_toolkit-${FASTNLO_V}.tar.gz" | tar xzf - |
| 107 | + cd fastnlo_toolkit-${FASTNLO_V} |
| 108 | + # compile static libraries with PIC to make statically linking PineAPPL's CLI work |
| 109 | + ./configure --prefix=/usr/local/ --disable-shared --with-pic=yes |
| 110 | + make -j V=1 |
| 111 | + make install |
| 112 | + ldconfig |
| 113 | + cd .. |
| 114 | + - name: Upload wheels |
| 115 | + uses: actions/upload-artifact@v5 |
| 116 | + with: |
| 117 | + name: wheels-linux-${{ matrix.platform.target }} |
| 118 | + path: dist |
| 119 | + |
| 120 | + # musllinux: |
| 121 | + # runs-on: ${{ matrix.platform.runner }} |
| 122 | + # strategy: |
| 123 | + # matrix: |
| 124 | + # platform: |
| 125 | + # - runner: ubuntu-22.04 |
| 126 | + # target: x86_64 |
| 127 | + # - runner: ubuntu-22.04 |
| 128 | + # target: x86 |
| 129 | + # - runner: ubuntu-22.04 |
| 130 | + # target: aarch64 |
| 131 | + # - runner: ubuntu-22.04 |
| 132 | + # target: armv7 |
| 133 | + # steps: |
| 134 | + # - uses: actions/checkout@v6 |
| 135 | + # - name: Build wheels |
| 136 | + # uses: PyO3/maturin-action@v1 |
| 137 | + # with: |
| 138 | + # target: ${{ matrix.platform.target }} |
| 139 | + # args: --release --out dist --manifest-path pineappl_cli/Cargo.toml |
| 140 | + # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 141 | + # manylinux: musllinux_1_2 |
| 142 | + # - name: Upload wheels |
| 143 | + # uses: actions/upload-artifact@v5 |
| 144 | + # with: |
| 145 | + # name: wheels-musllinux-${{ matrix.platform.target }} |
| 146 | + # path: dist |
| 147 | + |
| 148 | + # windows: |
| 149 | + # runs-on: ${{ matrix.platform.runner }} |
| 150 | + # strategy: |
| 151 | + # matrix: |
| 152 | + # platform: |
| 153 | + # - runner: windows-latest |
| 154 | + # target: x64 |
| 155 | + # python_arch: x64 |
| 156 | + # - runner: windows-latest |
| 157 | + # target: x86 |
| 158 | + # python_arch: x86 |
| 159 | + # - runner: windows-11-arm |
| 160 | + # target: aarch64 |
| 161 | + # python_arch: arm64 |
| 162 | + # steps: |
| 163 | + # - uses: actions/checkout@v6 |
| 164 | + # - name: Build wheels |
| 165 | + # uses: PyO3/maturin-action@v1 |
| 166 | + # with: |
| 167 | + # target: ${{ matrix.platform.target }} |
| 168 | + # args: --release --out dist --manifest-path pineappl_cli/Cargo.toml |
| 169 | + # sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 170 | + # - name: Upload wheels |
| 171 | + # uses: actions/upload-artifact@v5 |
| 172 | + # with: |
| 173 | + # name: wheels-windows-${{ matrix.platform.target }} |
| 174 | + # path: dist |
| 175 | + |
| 176 | + macos: |
| 177 | + runs-on: ${{ matrix.platform.runner }} |
| 178 | + strategy: |
| 179 | + matrix: |
| 180 | + platform: |
| 181 | + - runner: macos-15-intel |
| 182 | + target: x86_64 |
| 183 | + - runner: macos-latest |
| 184 | + target: aarch64 |
| 185 | + steps: |
| 186 | + - uses: actions/checkout@v6 |
| 187 | + - name: Install dependencies |
| 188 | + run: | |
| 189 | + brew tap davidchall/hep |
| 190 | + # install LHAPDF |
| 191 | + brew install lhapdf |
| 192 | + # install APPLgrid's dependencies; disable ROOT because its static libraries are missing |
| 193 | + brew install --only-dependencies --without-hoppet --without-lhapdf --without-root applgrid |
| 194 | + # install zlib, which is a dependency of APPLgrid but somehow missing |
| 195 | + brew install zlib |
| 196 | + # APPLgrid wants to be linked against zlib, and we need to find its static library via pkg-config |
| 197 | + echo "PKG_CONFIG_PATH=$(find $(brew --cellar) -name '*.pc' -exec dirname {} + | sort -u | tr '\n' ':')" >> ${GITHUB_ENV} |
| 198 | + # manually compile APPLgrid, because we need the file `appl_igrid.h` and the files it includes, which are possibly generated |
| 199 | + export HOMEBREW_TEMP="$(pwd)"/tmp |
| 200 | + mkdir -p ${HOMEBREW_TEMP} |
| 201 | + brew install --build-from-source --keep-tmp --without-hoppet --without-lhapdf --without-root applgrid |
| 202 | + echo "APPL_IGRID_DIR=$(find ${HOMEBREW_TEMP} -name appl_igrid.h -exec dirname {} +)" >> ${GITHUB_ENV} |
| 203 | + # do not link against `gfortran` |
| 204 | + sed 's/-lgfortran//g' $(command -v applgrid-config) > applgrid-config.new |
| 205 | + mv applgrid-config.new $(command -v applgrid-config) |
| 206 | + chmod +x $(command -v applgrid-config) |
| 207 | + # install fastNLO |
| 208 | + brew install --without-fastjet fastnlo |
| 209 | + - name: Build wheels |
| 210 | + uses: PyO3/maturin-action@v1 |
| 211 | + with: |
| 212 | + target: ${{ matrix.platform.target }} |
| 213 | + args: --release --out dist --manifest-path pineappl_cli/Cargo.toml |
| 214 | + sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 215 | + - name: Upload wheels |
| 216 | + uses: actions/upload-artifact@v5 |
| 217 | + with: |
| 218 | + name: wheels-macos-${{ matrix.platform.target }} |
| 219 | + path: dist |
| 220 | + |
| 221 | + sdist: |
| 222 | + runs-on: ubuntu-latest |
| 223 | + steps: |
| 224 | + - uses: actions/checkout@v6 |
| 225 | + - name: Build sdist |
| 226 | + uses: PyO3/maturin-action@v1 |
| 227 | + with: |
| 228 | + command: sdist |
| 229 | + args: --out dist --manifest-path pineappl_cli/Cargo.toml |
| 230 | + - name: Upload sdist |
| 231 | + uses: actions/upload-artifact@v5 |
| 232 | + with: |
| 233 | + name: wheels-sdist |
| 234 | + path: dist |
| 235 | + |
| 236 | + release: |
| 237 | + name: Publish wheels |
| 238 | + runs-on: ubuntu-latest |
| 239 | + if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} |
| 240 | + # needs: [linux, musllinux, windows, macos, sdist] |
| 241 | + needs: [linux, macos, sdist] |
| 242 | + permissions: |
| 243 | + # Use to sign the release artifacts |
| 244 | + id-token: write |
| 245 | + # Used to upload release artifacts |
| 246 | + contents: write |
| 247 | + # Used to generate artifact attestation |
| 248 | + attestations: write |
| 249 | + steps: |
| 250 | + - uses: actions/download-artifact@v6 |
| 251 | + - name: Generate artifact attestation |
| 252 | + uses: actions/attest-build-provenance@v3 |
| 253 | + with: |
| 254 | + subject-path: 'wheels-*/*' |
| 255 | + - name: Install uv |
| 256 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 257 | + uses: astral-sh/setup-uv@v7 |
| 258 | + - name: Publish to PyPI |
| 259 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 260 | + run: uv publish 'wheels-*/*' |
| 261 | + env: |
| 262 | + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN_CLI }} |
0 commit comments