Advanced coupling #1242
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build artifacts | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_call: | |
| inputs: | |
| version: | |
| required: true | |
| type: string | |
| sha: | |
| required: false | |
| default: ${{ github.sha }} | |
| type: string | |
| jobs: | |
| set-env: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ env.HQ_VERSION }} | |
| sha: ${{ env.HQ_SHA }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Set version | |
| run: | | |
| echo "HQ_VERSION=${{ inputs.version || 'dev' }}" | tee -a $GITHUB_ENV | |
| - name: Set sha | |
| run: | | |
| echo "HQ_SHA=${{ inputs.sha || github.sha }}" | tee -a $GITHUB_ENV | |
| build-binaries-x64: | |
| needs: [ set-env ] | |
| runs-on: ubuntu-latest | |
| # Use a container with GLIBC 2.28 | |
| container: quay.io/pypa/manylinux_2_28_x86_64 | |
| steps: | |
| - name: Show GLIBC | |
| run: ldd --version | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.set-env.outputs.sha }} | |
| - name: Install stable toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: 1.88.0 | |
| override: true | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: x64 | |
| # Needed for the highs dependency | |
| - name: Install Clang | |
| run: yum install clang -y | |
| - name: Compile | |
| env: | |
| HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }} | |
| run: cargo build --profile dist | |
| - name: Compress debuginfo | |
| run: objcopy --compress-debug-sections=zlib-gnu target/dist/hq | |
| - name: Prepare archive | |
| id: archive | |
| run: | | |
| export ARCHIVE_NAME=hq-${{ needs.set-env.outputs.version }}-linux-x64.tar.gz | |
| tar -czvf $ARCHIVE_NAME -C target/dist hq | |
| echo "::set-output name=archive-name::$ARCHIVE_NAME" | |
| - name: Store archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: archive-x64 | |
| path: ${{ steps.archive.outputs.archive-name }} | |
| build-binaries-ext: | |
| needs: [ set-env ] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: powerpc64le-unknown-linux-gnu | |
| name: powerpc64 | |
| - arch: armv7-unknown-linux-gnueabihf | |
| name: raspberry-pi | |
| - arch: aarch64-unknown-linux-gnu | |
| name: arm64-linux | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.set-env.outputs.sha }} | |
| - name: Install stable toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: 1.88.0 | |
| override: true | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.arch }} | |
| - name: Install cross | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Compile | |
| env: | |
| HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }} | |
| run: cross build --target ${{ matrix.arch }} --no-default-features --profile dist | |
| - name: Prepare archive | |
| id: archive | |
| run: | | |
| export ARCHIVE_NAME=hq-${{ needs.set-env.outputs.version }}-linux-${{ matrix.name }}.tar.gz | |
| tar -czvf $ARCHIVE_NAME -C target/${{ matrix.arch }}/dist hq | |
| echo "::set-output name=archive-name::$ARCHIVE_NAME" | |
| - name: Store archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: archive-${{ matrix.name }} | |
| path: ${{ steps.archive.outputs.archive-name }} | |
| build-python-binding: | |
| needs: [ set-env ] | |
| runs-on: ubuntu-latest | |
| container: quay.io/pypa/manylinux_2_28_x86_64 | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install stable toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: 1.88.0 | |
| override: true | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: pyhq | |
| # Needed for the highs dependency | |
| - name: Install Clang and Python development headers | |
| run: yum install clang python3.12-devel -y | |
| - name: Install pip | |
| run: python3 -m ensurepip | |
| - uses: messense/maturin-action@v1 | |
| env: | |
| CARGO_PROFILE_DIST_PANIC: unwind | |
| CARGO_PROFILE_DIST_STRIP: none | |
| CARGO_TARGET_DIR: target | |
| HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }} | |
| with: | |
| maturin-version: 1.3.0 | |
| container: off | |
| manylinux: 2_28 | |
| command: build | |
| args: --manifest-path crates/pyhq/Cargo.toml --profile dist --out wheels | |
| - name: Install Python wheel | |
| run: | | |
| python3 -m venv venv | |
| source venv/bin/activate | |
| python3 --version | |
| python3 -m pip install -U setuptools wheel pip | |
| python3 -m pip install -r tests/requirements.txt | |
| WHEEL=`realpath wheels/*.whl` | |
| python3 -m pip install $WHEEL[all] | |
| - name: Test Python wheel version | |
| run: | | |
| source venv/bin/activate | |
| python3 -c "import hyperqueue; print(hyperqueue.get_version())" > version.txt | |
| cat version.txt | |
| echo "${{ needs.set-env.outputs.version }}" > version-expected.txt | |
| cat version-expected.txt | |
| cmp --silent version-expected.txt version.txt | |
| - name: Compile | |
| env: | |
| HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }} | |
| run: cargo build | |
| - name: Test Python wheel | |
| run: | | |
| source venv/bin/activate | |
| python3 -m pytest tests/pyapi | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: archive-pyhq | |
| path: wheels/hyperqueue-*.whl |