Skip to content

Bump version 3.0.1+dev to 3.0.1-a.0 #675

Bump version 3.0.1+dev to 3.0.1-a.0

Bump version 3.0.1+dev to 3.0.1-a.0 #675

Workflow file for this run

name: package-server
on:
workflow_call:
inputs:
version:
description: The version to use
type: string
required: true
version_patch_run_id:
description: |
The run id where the version.patch artifact was uploaded.
If not provided, the workflow will generate the patch by itself.
type: string
required: true
commit_sha:
required: true
type: string
description: The commit SHA to use when checkout'ing the repository
default: ${{ github.sha }}
# PS: If you trigger manually the packaging, take into account that it will use the workflow as defined in the main branch not in the target branch.
workflow_dispatch:
inputs:
version:
description: The version to use (if not provided will generated one from the code space version)
type: string
required: false
pull_request:
paths:
- .github/workflows/package-server.yml
- server/packaging
- server/build.py
- server/pyproject.toml
# We set `concurrency` to prevent having this workflow being run on code that is not up-to-date on a PR (a user make multiple push in a quick manner).
# But on the main branch, we don't want that behavior.
# Having the workflow run on each merge commit is something we would like, that could help us where a regression was made and missed by previous checks.
#
# For that we use `head_ref` that is only defined on `pull-request` and fallback to `run_id` (this is a counter, so it's value is unique between workflow call).
concurrency:
group: package-server-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
node-version: 18.12.0
poetry-version: 1.5.1
permissions:
contents: read
jobs:
version:
if: ${{ inputs.version_patch_run_id == '' }}
uses: ./.github/workflows/_parse_version.yml
with:
version: ${{ inputs.version }}
commit_sha: ${{ inputs.commit_sha }}
package-wheel:
needs: version
# Always run the job if `version` job is skipped otherwise only if `version` job was successful.
if: ${{ inputs.version_patch_run_id != '' && always() || success() }}
strategy:
fail-fast: false
matrix:
include:
- name: 🐧 Linux
platform: linux
os: ubuntu-22.04
- name: 🍎 macOS
platform: macos
os: macos-12
- name: 🏁 Windows
platform: windows
os: windows-2022
name: "${{ matrix.name }}: 📦 Packaging (build Wheel)"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # pin v4.1.7
with:
ref: ${{ inputs.commit_sha }}
timeout-minutes: 5
- uses: ./.github/actions/setup-python-poetry
with:
poetry-version: ${{ env.poetry-version }}
project-path: ./server
timeout-minutes: 10
- name: Download version.patch artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # pin v4.1.8
with:
name: version.patch
path: ${{ runner.temp }}/version.patch
run-id: ${{ inputs.version_patch_run_id || github.run_id }}
- name: Apply version.patch
run: git apply --allow-empty ${{ runner.temp }}/version.patch/version.patch
- name: Build wheel
uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # pin v2.20.0
with:
package-dir: server
output-dir: dist
timeout-minutes: 50
- name: Set file for wheel version
run: cp -v libparsec/version dist/version
- name: Hack the wheel macos version
if: startsWith(matrix.os, 'macos-')
shell: bash
run: |
set -eux
# Old wheel name
OLD_WHEEL_NAME=$(basename dist/parsec_cloud-*.whl)
# Unzip the wheel
mkdir temp
cd temp
unzip ../dist/$OLD_WHEEL_NAME
# Get platform new wheel name
# FIXME: We fix the version of wheel to 0.43.0 as a temporary fix for the deprecated `bdist_wheel` module
python -m pip install -U pip wheel==0.43.0 setuptools
PLATFORM=$(python -c "from wheel.bdist_wheel import get_platform; print(get_platform('.'))")
NEW_WHEEL_NAME=$(basename ../dist/parsec_cloud-*.whl | sed "s/macosx_.*_x86_64/$PLATFORM/")
# Update archive and zip back
sed -i "" "s/macosx_.*_x86_64/$PLATFORM/" parsec_cloud-*.dist-info/WHEEL
zip -r $NEW_WHEEL_NAME *
cd ..
# Replace old wheel with the new one
mv temp/$NEW_WHEEL_NAME dist/
rm dist/$OLD_WHEEL_NAME
rm -rf temp
- name: Generate requirements & constraints infos
run: python server/packaging/wheel/wheel_it.py ./server --output dist --skip-wheel
# Install syft
- uses: taiki-e/install-action@da8fe73ed87107a1cae164305a928b7c8fcff4bc # pin v2.43.1
with:
tool: syft@0.84.0
- name: Generate SBOM
run: syft packages --config=.syft.yaml --output=spdx-json=dist/Parsec-SBOM-Wheel-${{ matrix.platform }}.spdx.json .
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # pin v4.4.0
with:
name: ${{ runner.os }}-${{ runner.arch }}-wheel
path: |
dist/
if-no-files-found: error
timeout-minutes: 5