feat: implement Gitea CI workflows for release and testing, enhance build script for multi-platform support
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
# One Linux runner produces all three archives. build.py normalises
|
||||
# everything that would otherwise vary by build host — file modes, tar
|
||||
# ownership, and launcher line endings — so a Windows zip built here is
|
||||
# equivalent to one built on Windows. That removes the three-runner matrix,
|
||||
# the artifact hand-off between jobs, and the race of three jobs trying to
|
||||
# create the same release.
|
||||
#
|
||||
# Multi-OS runners would still earn their keep for *testing*, which is a
|
||||
# different question from building.
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# build.py copies only what "git ls-files" reports, so it needs real
|
||||
# history rather than a tarball export.
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
# No pip install: build.py and publish_gitea.py are both stdlib-only, so
|
||||
# the release path cannot be broken by a dependency it does not ship.
|
||||
- name: Build all three archives
|
||||
run: python packaging/build.py --platform all
|
||||
|
||||
# Tag pushes publish; a manual run stops after the build above. Guarding
|
||||
# the step rather than the job is what keeps workflow_dispatch usable as
|
||||
# a dry run — the archives still get built and the logs still show their
|
||||
# sizes, without a release being created.
|
||||
- name: Publish to Gitea
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
GITEA_URL: ${{ github.server_url }}
|
||||
GITEA_REPOSITORY: ${{ github.repository }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
# Leaves a draft. Review the archives, then publish from the web UI, or
|
||||
# add --publish here once you trust the pipeline.
|
||||
run: >-
|
||||
python packaging/publish_gitea.py
|
||||
--tag "${{ github.ref_name }}"
|
||||
dist/LM-Gambit-*.zip dist/LM-Gambit-*.tar.gz
|
||||
|
||||
- name: Dry run note
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
echo "No tag — archives built but not published."
|
||||
ls -lh dist/
|
||||
@@ -0,0 +1,61 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: tests-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
python:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# 3.11 is what this is developed against. 3.10 is the floor the README
|
||||
# advertises, so it is checked rather than assumed.
|
||||
python: ["3.10", "3.11"]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
# requirements-ci.txt deliberately omits llama-cpp-python: it needs a C
|
||||
# compiler, dominates install time, and nothing under tests_py/ imports
|
||||
# it. The tests cover suite loading, grading, reporting and the HTTP
|
||||
# surface — none of which touch local inference.
|
||||
- name: Install
|
||||
run: python -m pip install -r requirements-ci.txt
|
||||
|
||||
# test_api.py skips itself when nothing is listening on :8765, so the
|
||||
# other eight files run and the suite still reports success.
|
||||
- name: Run tests
|
||||
run: python tests_py/run_all.py
|
||||
|
||||
web:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: web
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Install
|
||||
run: npm ci
|
||||
|
||||
# Runs tsc as well as the bundler, so a type error fails here.
|
||||
- name: Type-check and build
|
||||
run: npm run build
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
Reference in New Issue
Block a user