Skip to content

Build

Build #24

Workflow file for this run

name: Build
on:
push:
tags:
- 'v[0-9]*.[0-9]*.[0-9]*'
workflow_dispatch:
inputs:
force:
description: 'Force rebuild even if a successful build already exists for this SHA'
type: boolean
default: false
jobs:
check:
name: Check for existing build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: read
outputs:
skip: ${{ steps.decide.outputs.skip }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Check if build is needed
id: decide
env:
GH_TOKEN: ${{ github.token }}
run: |
bash scripts/check-build-needed.sh \
"${{ github.sha }}" \
"${{ github.repository }}" \
"${{ inputs.force == true || github.event_name == 'push' }}" \
"Build" \
"*.py" "pyproject.toml" "uv.lock" ".github/workflows/build.yml"
build:
name: ${{ matrix.os.name }}
needs: check
if: needs.check.outputs.skip != 'true'
runs-on: ${{ matrix.os.runner }}
timeout-minutes: 60
permissions:
actions: write
contents: read
strategy:
fail-fast: false
matrix:
os:
- name: Linux (x64)
runner: ubuntu-latest
artifact: uvscem-linux-x64
bin: uvscem-linux-x64
- name: Linux (arm64)
runner: ubuntu-24.04-arm
artifact: uvscem-linux-arm64
bin: uvscem-linux-arm64
- name: macOS (arm64)
runner: macos-latest
artifact: uvscem-macos-arm64
bin: uvscem-macos-arm64
- name: Windows (x64)
runner: windows-latest
artifact: uvscem-windows-x64
bin: uvscem-windows-x64.exe
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Wait for tests to pass
env:
GH_TOKEN: ${{ github.token }}
run: bash scripts/wait-for-workflow.sh "Test" "${{ github.sha }}" "${{ github.repository }}"
- name: Set up Python 3.10
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.10"
- name: Install runtime dependencies
run: pip install .
- name: Write version constant for Nuitka
shell: python
run: |
import importlib.metadata
import uvscem
from pathlib import Path
v = importlib.metadata.version("uvscem")
Path(uvscem.__file__).parent.joinpath("_version.py").write_text(
f'__version__ = "{v}"\n'
)
- name: Build binary
uses: Nuitka/Nuitka-Action@0d4e22d4b66062a13d120f6948dd90170be04b3a # v1.4
with:
script-name: src/uvscem/__main__.py
output-file: ${{ matrix.os.artifact }}
mode: onefile
include-package: uvscem
# Skip zstd compression — near-instant extraction on first run.
onefile-no-compression: true
# Stable per-version cache dir — extraction is skipped entirely on
# subsequent launches once the payload has been extracted once.
onefile-tempdir-spec: "{CACHE_DIR}/{PRODUCT}/{VERSION}"
- name: Smoke test binary
shell: bash
run: |
bin="build/${{ matrix.os.bin }}"
chmod +x "$bin" 2>/dev/null || true
# --help should succeed
"$bin" --help
# missing config/bundle should fail cleanly (exit 1, no traceback)
! "$bin" install --config-name __no_such_file__.json
! "$bin" export --config-name __no_such_file__.json
! "$bin" import --bundle-path __no_such_bundle__
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ matrix.os.artifact }}
path: build/${{ matrix.os.bin }}
if-no-files-found: error
retention-days: 30