jolt/.github/workflows/tests.yml
Dmitri Sotnikov f0293fb4ee
Parallelize the test gate; cache cold-init tests, drop the benchmark from it (#139)
run-tests.janet runs the same file set as `jpm test` across a pool of worker
processes (one `janet FILE` each, ev-based). The full gate goes from ~790s
serial to ~98s here (8x), and more on CI where the heavy files don't thrash on
swap. CI and the docs point at it; `jpm test` still works serially.

Three things dominated the wall:

- Nine integration tests cold-built a compile ctx (~8s each); switch them to
  api/init-cached so they share the prebuilt image. The cache key already
  fingerprints the ctx-shaping env vars, so the direct-link ones share one DL
  image and the rest share the plain one.
- core-bench's main ran on every gate (~35s of benchmark loops that assert
  nothing); gate it behind JOLT_BENCH=1.
- cli-test spawned `janet src/jolt/main.janet` ~20 times at ~8s cold each
  (340s under parallel load, and it was the whole wall); prefer build/jolt
  (~20ms baked ctx) when present, fall back to from-source for an unbuilt tree.

type-check-test stays on cold init: a snapshot-loaded ctx loses the success
checker's op/msg detail (jolt-vley). jolt-pria tracks caching from-source
startup generally, which would let cli-test drop the build/jolt preference.

Co-authored-by: Yogthos <yogthos@gmail.com>
2026-06-16 14:23:02 +00:00

60 lines
2 KiB
YAML

name: tests
# Run the full test suite (jpm test) on every push and pull request.
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
env:
JANET_VERSION: v1.41.2 # bump to match the version Jolt is developed against
# Per-file deadline for the clojure-test-suite battery. Finite files finish
# in well under 1s; the genuinely-infinite ones get killed at any deadline.
# A generous value gives slow CI runners headroom so a sub-second file
# spiking doesn't time out and drop total-pass below the baseline.
JOLT_SUITE_TIMEOUT: "20"
steps:
- uses: actions/checkout@v5
with:
# Submodules: vendor/sci (SCI bootstrap/runtime tests) and
# vendor/clojure-test-suite (the cross-dialect conformance battery,
# asserted against a baseline by clojure-test-suite-test.janet).
submodules: recursive
- name: Cache Janet build
id: cache-janet
uses: actions/cache@v5
with:
path: /tmp/janet
key: janet-${{ env.JANET_VERSION }}-${{ runner.os }}
- name: Build Janet
if: steps.cache-janet.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch "$JANET_VERSION" https://github.com/janet-lang/janet.git /tmp/janet
make -C /tmp/janet
- name: Install Janet
run: sudo make -C /tmp/janet install
- name: Install jpm
run: |
git clone --depth 1 https://github.com/janet-lang/jpm.git /tmp/jpm
# bootstrap.janet resolves jpm/cli.janet relative to the cwd, so it
# must run from inside the jpm checkout.
cd /tmp/jpm
sudo janet bootstrap.janet
- name: Janet version
run: janet -v
- name: Build executable
run: jpm build
- name: Run tests
# Parallel runner (same file set as `jpm test`, across CPU workers).
# The executable is built in the previous step, so binary-spawning tests
# don't skip.
run: janet run-tests.janet