Files
simple/.github/workflows/release.yml
T
catarrh 9ee9c85b09
release / release (push) Waiting to run
release: the curated release package + a tag-triggered workflow
The READMEs now point users at a release package instead of a clone; this
adds the machinery behind it.

- tools/build_release.py builds dist/simple-<version>.zip: the runtime
  tree (the server package incl. its bundled MCC/MNC list, the PWA
  runtime files, docs/, tools/, the setup/start scripts, pyproject,
  requirements-pysim.txt, the READMEs, LICENSE and THIRD-PARTY-NOTICES)
  under a single top-level directory, with no tests, no frontend
  sources/build config, no bytecode and no git metadata.  The version
  comes from server.py; --expect-version guards a mislabeled tag.
- .github/workflows/release.yml runs both test suites, builds the
  package and publishes it on a v* tag (workflow_dispatch for an
  existing tag); a re-run uploads with --clobber.  pysim is checked out
  next to the repo for the Python suite and is NOT bundled.
- tests/test_release_package.py pins the package's shape: the runtime
  files, the absence of the development files, and that sw.js's
  precache list is fully covered - so a new asset cannot silently go
  missing.
- dist/ is gitignored; the READMEs name the artifact.

Verified: 997 Python + 953 frontend green; the built zip (53 files,
~0.95 MB) was unpacked in a clean directory and its setup.sh installed it
into a fresh venv - the console script runs and the installed server
resolves web_dir to the unpacked frontend/ (index.html, sw.js,
uicc_files.json present).  The workflow YAML parses; GitHub-side
execution is unverified until the first tag is pushed.
2026-10-20 23:29:44 +03:00

75 lines
2.2 KiB
YAML

name: release
# Builds the release package from the tagged source and publishes it.
# The package is a snapshot of the tree without the development-only files
# (tools/build_release.py); pysim is not bundled - setup installs it from
# upstream. Trigger: push a v* tag (or run manually for an existing tag).
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: 'Tag to package and publish (e.g. v3.31.0)'
required: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out the tagged source
uses: actions/checkout@v4
with:
path: simple
ref: ${{ github.event.inputs.tag || github.ref }}
# The Python tests expect a pysim checkout as a sibling of the repo
# (tests/*.py prepend <repo>/../pysim to sys.path).
- name: Check out pysim next to the repo
uses: actions/checkout@v4
with:
repository: osmocom/pysim
path: pysim
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pysim and the test dependencies
working-directory: simple
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements-pysim.txt
python -m pip install --no-deps ../pysim
- name: Python suite
working-directory: simple
run: python -m unittest discover -s tests
- name: Frontend suite
working-directory: simple/frontend
run: node --test
- name: Build the release package
working-directory: simple
run: |
TAG="${{ github.event.inputs.tag || github.ref_name }}"
python tools/build_release.py --expect-version "${TAG#v}" --out dist
- name: Publish the release
working-directory: simple
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${{ github.event.inputs.tag || github.ref_name }}"
ZIP="dist/simple-${TAG#v}.zip"
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" "$ZIP" --clobber
else
gh release create "$TAG" "$ZIP" --title "$TAG" --generate-notes
fi