|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the `build_wheels` job of |
| 5 | +# https://github.com/jeremymcrae/liftover/blob/v1.5.0/.github/workflows/python-package.yml |
| 6 | +name: Build liftover wheels (riscv64) |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/liftover.yaml not released yet' |
| 13 | + required: false |
| 14 | + default: '' |
| 15 | + pull_request: |
| 16 | + branches: [main] |
| 17 | + paths: |
| 18 | + - '.github/workflows/build-liftover.yml' |
| 19 | + - 'docs/packages/liftover.yaml' |
| 20 | + push: |
| 21 | + branches: [main] |
| 22 | + paths: |
| 23 | + - '.github/workflows/build-liftover.yml' |
| 24 | + - 'docs/packages/liftover.yaml' |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: read # to fetch code (actions/checkout) |
| 32 | + |
| 33 | +env: |
| 34 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 35 | + |
| 36 | +jobs: |
| 37 | + setup: |
| 38 | + uses: $/.github/workflows/_setup.yml |
| 39 | + with: |
| 40 | + package: liftover |
| 41 | + version: ${{ inputs.version }} |
| 42 | + |
| 43 | + build_wheels: |
| 44 | + needs: [setup] |
| 45 | + if: needs.setup.outputs.versions != '[]' |
| 46 | + name: Build liftover ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 47 | + runs-on: ubuntu-24.04-riscv |
| 48 | + timeout-minutes: 60 |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 53 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 54 | + |
| 55 | + env: |
| 56 | + LIFTOVER_VERSION: ${{ matrix.version }} |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout liftover v${{ env.LIFTOVER_VERSION }} |
| 60 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 61 | + with: |
| 62 | + repository: jeremymcrae/liftover |
| 63 | + ref: v${{ env.LIFTOVER_VERSION }} |
| 64 | + submodules: true |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Fetch chain file for tests |
| 68 | + run: | |
| 69 | + mkdir -p chain_cache |
| 70 | + curl --fail --location --retry 5 --retry-all-errors --retry-delay 30 \ |
| 71 | + -o chain_cache/hg19ToHg38.over.chain.gz \ |
| 72 | + https://hgdownload.soe.ucsc.edu/goldenPath/hg19/liftOver/hg19ToHg38.over.chain.gz |
| 73 | + gzip -t chain_cache/hg19ToHg38.over.chain.gz |
| 74 | +
|
| 75 | + - name: Build wheels |
| 76 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 77 | + with: |
| 78 | + output-dir: wheelhouse/ |
| 79 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 80 | + env: |
| 81 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 82 | + CIBW_ENVIRONMENT_LINUX: LIFTOVER_TEST_CACHE=/project/chain_cache |
| 83 | + CIBW_TEST_COMMAND: python -m unittest discover -s {project} |
| 84 | + |
| 85 | + - name: Verify the wheel ships the compiled extension and licence |
| 86 | + run: | |
| 87 | + python3 - wheelhouse/*.whl <<'EOF' |
| 88 | + import sys, zipfile |
| 89 | + names = zipfile.ZipFile(sys.argv[1]).namelist() |
| 90 | + sos = sorted(n for n in names if n.endswith(".so")) |
| 91 | + print("\n".join(sos)) |
| 92 | + assert any("liftover/chain_file" in n for n in sos), sos |
| 93 | +
|
| 94 | + lic = sorted(n for n in names if ".dist-info/licenses/" in n and not n.endswith("/")) |
| 95 | + print("\n".join(lic)) |
| 96 | + assert lic, names |
| 97 | + EOF |
| 98 | +
|
| 99 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 100 | + with: |
| 101 | + name: liftover-${{ env.LIFTOVER_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 102 | + path: wheelhouse/*.whl |
| 103 | + if-no-files-found: error |
| 104 | + |
| 105 | + publish: |
| 106 | + name: Publish liftover ${{ matrix.version }} |
| 107 | + needs: [setup, build_wheels] |
| 108 | + if: needs.setup.outputs.versions != '[]' |
| 109 | + strategy: |
| 110 | + fail-fast: false |
| 111 | + matrix: |
| 112 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 113 | + permissions: |
| 114 | + contents: write |
| 115 | + pull-requests: write |
| 116 | + uses: $/.github/workflows/_publish-wheel.yml |
| 117 | + secrets: |
| 118 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 119 | + with: |
| 120 | + artifact-pattern: liftover-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments