diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml new file mode 100644 index 000000000000..0f56f214a5f8 --- /dev/null +++ b/.github/workflows/build-packmol.yml @@ -0,0 +1,126 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_wheels` job of +# https://github.com/m3g/packmol/blob/v21.2.3/.github/workflows/build-wheels.yaml +name: Build packmol wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/packmol.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-packmol.yml' + - 'docs/packages/packmol.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-packmol.yml' + - 'docs/packages/packmol.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: packmol + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build packmol ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.setup.outputs.matrix) }} + env: + PACKMOL_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout packmol v${{ env.PACKMOL_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: m3g/packmol + ref: v${{ env.PACKMOL_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # Upstream FLAGS minus -march=native, which GCC rejects on riscv64. FLAGS is also + # the link line: link packmol PIE so auditwheel's patchelf --set-rpath appends its + # segment instead of prepending one below vm.mmap_min_addr (gotcha 595). Not + # -Wl,-Ttext-segment: musllinux's default-PIE gcc then emits an ET_EXEC that + # still carries PIE relocations, and patchelf's rewrite of it segfaults at start. + CIBW_ENVIRONMENT: >- + MAKEFLAGS='FLAGS=-O3\ -funroll-loops\ -fPIE\ -pie' + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: packmol-${{ env.PACKMOL_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + gpl_sources: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # packmol is a gfortran-built executable, so auditwheel vendors its libgfortran runtime. + name: Collect GPL sources (gcc) for packmol ${{ matrix.version }} + runs-on: ubuntu-24.04-riscv + + steps: + - name: Collect gcc source RPM from manylinux_riscv64 + uses: riseproject-dev/python-wheels/actions/collect-gpl-sources@main + with: + image: ${{ env.MANYLINUX_RISCV64_IMAGE }} + packages: gcc + output: gpl-sources.tar + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: packmol-${{ matrix.version }}-gpl-sources + path: gpl-sources.tar + if-no-files-found: error + + publish: + name: Publish packmol ${{ matrix.version }} + needs: [setup, build_wheels, gpl_sources] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: packmol-${{ matrix.version }}-*riscv64 + gpl-sources-artifact: packmol-${{ matrix.version }}-gpl-sources + gpl-sources-description: gcc diff --git a/docs/packages/packmol.yaml b/docs/packages/packmol.yaml new file mode 100644 index 000000000000..ac00654ca7d0 --- /dev/null +++ b/docs/packages/packmol.yaml @@ -0,0 +1,18 @@ +package-name: packmol +source-code: https://github.com/m3g/packmol +license: MIT +versions: +- version: 21.2.3 + files: + - python: 3.10:manylinux + - python: 3.10:musllinux + - python: 3.11:manylinux + - python: 3.11:musllinux + - python: 3.12:manylinux + - python: 3.12:musllinux + - python: 3.13:manylinux + - python: 3.13:musllinux + - python: 3.14:manylinux + - python: 3.14:musllinux + - python: 3.14t:manylinux + - python: 3.14t:musllinux