ReMe/.github/workflows/_build-python-packages.yml
dependabot[bot] 89c5e3781c
chore(deps): bump actions/setup-node from 6 to 7
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6 to 7.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-20 07:59:33 +00:00

104 lines
3.6 KiB
YAML

name: _Build Python packages
on:
workflow_call:
inputs:
expected_version:
description: Expected release version; omit for a consistency-only check
required: false
default: ''
type: string
upload_artifacts:
description: Upload distributions for later publish jobs
required: false
default: false
type: boolean
permissions:
contents: read
jobs:
distributions:
name: Build Python distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v7
with:
node-version: '22.13'
cache: npm
cache-dependency-path: website/package-lock.json
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build packaging pytest twine
- name: Validate package versions
if: inputs.expected_version == ''
run: python scripts/bump_version.py --check
- name: Validate release version
if: inputs.expected_version != ''
env:
EXPECTED_VERSION: ${{ inputs.expected_version }}
run: python scripts/bump_version.py --check --expected-version "${EXPECTED_VERSION}"
- name: Run package tests
run: PYTHONPATH=. python -m pytest tests/unit/test_package_versions.py -q
- name: Build Studio static workspace
working-directory: website
run: |
npm ci
npm run build:static
- name: Build and check distributions
run: |
python scripts/package_studio.py
mkdir -p dist/reme dist/studio
python -m build --outdir dist/reme
python -m build packages/reme_ai_studio --outdir dist/studio
python -m twine check dist/reme/* dist/studio/*
- name: Verify distributions and isolated installation
run: |
REME_WHEEL="$(pwd)/$(ls dist/reme/reme_ai-[0-9]*.whl)"
STUDIO_WHEEL="$(pwd)/$(ls dist/studio/reme_ai_studio-*.whl)"
STUDIO_SDIST="$(pwd)/$(ls dist/studio/reme_ai_studio-*.tar.gz)"
python -m zipfile -l "${REME_WHEEL}" | (! grep 'reme/web/')
python -m zipfile -l "${STUDIO_WHEEL}" | grep 'reme_ai_studio/static/index.html'
python -m zipfile -l "${STUDIO_WHEEL}" | grep 'dist-info/licenses/LICENSE'
python -m tarfile -l "${STUDIO_SDIST}" | grep '/LICENSE'
python -m venv "${RUNNER_TEMP}/reme-package-smoke"
"${RUNNER_TEMP}/reme-package-smoke/bin/python" -m pip install \
--find-links "$(pwd)/dist/studio" "${REME_WHEEL}[core]"
cd "${RUNNER_TEMP}"
"${RUNNER_TEMP}/reme-package-smoke/bin/python" -c \
"import reme; from reme_ai_studio import static_dir; assert (static_dir() / 'index.html').is_file()"
"${RUNNER_TEMP}/reme-package-smoke/bin/python" -c \
"from reme.utils import resolve_web_static_dir; assert (resolve_web_static_dir() / 'index.html').is_file()"
- name: Upload ReMe Studio distributions
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: reme-studio-distributions
path: dist/studio/
if-no-files-found: error
- name: Upload ReMe distributions
if: inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: reme-distributions
path: dist/reme/
if-no-files-found: error