Skip to content

Bumb upload artefact to v4 #548

Bumb upload artefact to v4

Bumb upload artefact to v4 #548

Workflow file for this run

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@v3
- 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
env:
# We need to avoid using NodeJS v20, because it doesn't work with glibc 2.17.
# See https://github.com/actions/checkout/issues/1809.
ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
# Use a container with GLIBC 2.17
container: quay.io/pypa/manylinux2014_x86_64
steps:
- name: Show GLIBC
run: ldd --version
- name: Checkout sources
uses: actions/checkout@v3
with:
ref: ${{ needs.set-env.outputs.sha }}
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76.0
override: true
- uses: Swatinem/rust-cache@v1
with:
key: x64
- name: Compile
uses: actions-rs/cargo@v1
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
command: build
args: --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@v3
with:
ref: ${{ needs.set-env.outputs.sha }}
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.76.0
override: true
- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.arch }}
- name: Compile
uses: actions-rs/cargo@v1
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
command: build
args: --target ${{ matrix.arch }} --no-default-features --profile dist
use-cross: true
- 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
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
with:
key: pyhq
- uses: messense/maturin-action@v1
env:
CARGO_PROFILE_DIST_PANIC: unwind
CARGO_PROFILE_DIST_STRIP: none
CARGO_TARGET_DIR: target
with:
docker-options: -e HQ_BUILD_VERSION=${{ needs.set-env.outputs.version }}
maturin-version: 1.3.0
manylinux: 2014
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 -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
uses: actions-rs/cargo@v1
env:
HQ_BUILD_VERSION: ${{ needs.set-env.outputs.version }}
with:
command: 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