Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:
# backend and frontend variants that pull requests narrow celox to.
- name: Check CI runtime dependency exclusions and test scopes
if: needs.changes.result == 'success' && needs.changes.outputs.rust == 'true' && needs.changes.outputs.scripts != 'true'
run: node --test scripts/ci-changes.test.mjs scripts/ci-rust-scope.test.mjs
run: node --test scripts/ci-changes.test.mjs scripts/ci-rust-scope.test.mjs scripts/ci-lydite-changes.test.mjs

rust-tests:
name: Rust Tests
Expand All @@ -198,10 +198,6 @@ jobs:
- name: Install cocotb
run: python -m pip install cocotb==2.1.0

# Z3 5.1.0 is lydite's recorded compatibility-test version.
- name: Install Z3 for lydite solver tests
run: python -m pip install z3-solver==5.1.0

- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
Expand All @@ -213,12 +209,11 @@ jobs:
# runs the binaries one after another.
# A pull request builds and runs only the tests its changes can affect
# (scripts/ci-rust-scope.mjs); merge groups and the daily run keep the
# whole workspace, so the tree that lands is still fully tested.
# Celox workspace. lydite.yml owns Lydite tests at its own cadence.
- name: Run workspace tests with CI features
if: needs.changes.outputs.rust_full != 'false'
run: >-
Z3_BIN="$(command -v z3)"
cargo nextest run --locked --workspace --profile ci
cargo nextest run --locked --workspace --exclude 'lydite*' --profile ci
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus

- name: Run the tests this pull request can affect
Expand All @@ -233,14 +228,14 @@ jobs:
args=()
for package in $PACKAGES; do args+=(-p "$package"); done
if [ -n "$FEATURES" ]; then args+=(--features "$FEATURES"); fi
Z3_BIN="$(command -v z3)" cargo nextest run --locked --profile ci \
cargo nextest run --locked --profile ci \
--no-tests=pass "${args[@]}" -E "$FILTER"

# nextest does not run documentation tests.
- name: Run workspace documentation tests with CI features
if: needs.changes.outputs.rust_full != 'false'
run: >-
cargo test --locked --workspace --doc
cargo test --locked --workspace --exclude 'lydite*' --doc
--features celox/systemverilog,celox-test-suite/verilator,celox-test-suite/icarus

- name: Run the documentation tests of the changed libraries
Expand Down
124 changes: 92 additions & 32 deletions .github/workflows/lydite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,12 @@ name: lydite

# Proof, editor, and pinned-Celox conformance gates imported from
# https://github.com/tignear/hwverify. The workspace crates are also built,
# linted, and unit-tested by ci.yml; this workflow runs lydite's own gates.
# linted by ci.yml; this workflow owns Lydite tests and conformance gates.

on:
# Queue drafts run editor/replay checks on combined changes. Ordinary PRs
# skip all jobs; the expensive Veryl proof gates run only weekly or manually.
push:
branches: [develop]
paths:
- "crates/lydite*/**"
- "lydite/**"
- ".github/workflows/lydite.yml"
# The proof-backed suite gate tests the in-tree frontend and suite.
- "crates/celox-test-suite*/**"
- "crates/celox-frontend-veryl/**"
- "crates/celox-frontend-core/**"
- "crates/celox-sir/**"
- "crates/celox-design/**"
# Select affected lanes on changes; run every lane weekly and on demand.
pull_request:
paths:
- "crates/lydite*/**"
- "lydite/**"
- ".github/workflows/lydite.yml"
# The proof-backed suite gate tests the in-tree frontend and suite.
- "crates/celox-test-suite*/**"
- "crates/celox-frontend-veryl/**"
- "crates/celox-frontend-core/**"
- "crates/celox-sir/**"
- "crates/celox-design/**"
# Dependency, toolchain and other Celox updates are covered by ci.yml's
# lydite unit tests; run the full gates weekly to catch slower drift.
merge_group:
schedule:
- cron: "41 3 * * 1"
workflow_dispatch:
Expand All @@ -55,8 +31,64 @@ defaults:
working-directory: lydite

jobs:
changes:
runs-on: ubuntu-26.04
outputs:
core: ${{ steps.scope.outputs.core }}
bridge: ${{ steps.scope.outputs.bridge }}
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Select affected Lydite lanes
id: scope
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha || github.sha }}
RUSTUP_TOOLCHAIN: stable
run: node scripts/ci-lydite-changes.mjs "$BASE_SHA" "$HEAD_SHA"

rust:
timeout-minutes: 30
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.core == 'true' || needs.changes.outputs.bridge == 'true')
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
submodules: recursive
- uses: ./.github/actions/setup-rust
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install recorded solver version
run: python -m pip install z3-solver==5.1.0
- name: Test affected Lydite packages and documentation
env:
CORE: ${{ needs.changes.outputs.core }}
BRIDGE: ${{ needs.changes.outputs.bridge }}
DETECTION: ${{ needs.changes.result }}
run: |
args=()
if [ "$DETECTION" != success ] || [ "$CORE" = true ]; then
args+=(-p lydite -p lydite-ir -p lydite-solver -p lydite-syntax -p lydite-verify)
fi
if [ "$DETECTION" != success ] || [ "$BRIDGE" = true ]; then
args+=(-p lydite-celox)
fi
Z3_BIN="$(command -v z3)"
export Z3_BIN
cargo test --locked "${args[@]}"

documentation:
if: github.event_name != 'pull_request' || startsWith(github.head_ref, 'mergify/merge-queue/')
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.core == 'true')
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v7
Expand All @@ -66,7 +98,8 @@ jobs:
run: python3 scripts/check_docs.py

editor:
if: github.event_name != 'pull_request' || startsWith(github.head_ref, 'mergify/merge-queue/')
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.core == 'true')
runs-on: ubuntu-26.04
timeout-minutes: 20
steps:
Expand Down Expand Up @@ -99,7 +132,8 @@ jobs:
# celox-replay and veryl-proof use the in-tree Celox; the narrow veryl gate
# checks lydite's own Veryl lowering against a pinned upstream corpus.
celox-replay:
if: github.event_name != 'pull_request' || startsWith(github.head_ref, 'mergify/merge-queue/')
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.bridge == 'true')
runs-on: ubuntu-26.04
timeout-minutes: 30
steps:
Expand All @@ -121,7 +155,8 @@ jobs:
retention-days: 14

veryl-fv:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.core == 'true')
runs-on: ubuntu-26.04
timeout-minutes: 30
steps:
Expand All @@ -147,7 +182,8 @@ jobs:
retention-days: 14

veryl-proof-corpus:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: changes
if: always() && (needs.changes.result != 'success' || needs.changes.outputs.bridge == 'true')
runs-on: ubuntu-26.04
# Cold builds plus the sequential proof/mutation gates can exceed one hour.
timeout-minutes: 120
Expand Down Expand Up @@ -201,3 +237,27 @@ jobs:
${{ runner.temp }}/lemma-candidates/
if-no-files-found: error
retention-days: 14

result:
name: Lydite checks
needs: [changes, rust, documentation, editor, celox-replay, veryl-fv, veryl-proof-corpus]
if: always()
runs-on: ubuntu-26.04
defaults:
run:
working-directory: .
steps:
- name: Require every selected lane to pass
env:
NEEDS: ${{ toJSON(needs) }}
run: |
python3 - <<'PYCODE'
import json, os
needs = json.loads(os.environ["NEEDS"])
assert needs["changes"]["result"] == "success", needs
assert all(needs["changes"]["outputs"].get(key) in ("true", "false") for key in ("core", "bridge")), needs
for job, lane in {"rust": None, "documentation": "core", "editor": "core", "celox-replay": "bridge", "veryl-fv": "core", "veryl-proof-corpus": "bridge"}.items():
outputs = needs["changes"]["outputs"]
selected = outputs.get(lane) == "true" if lane else any(outputs.get(key) == "true" for key in ("core", "bridge"))
assert needs[job]["result"] == ("success" if selected else "skipped"), (job, needs[job])
PYCODE
32 changes: 23 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ mixed Rust changes and unknown paths retain their existing coverage.

Pull requests use `scripts/ci-changes.mjs` to select jobs and scope Rust tests
by affected crates. Windows and ARM64 checks run in Mergify queue draft PRs,
legacy merge groups, and daily/manual full runs. Queue drafts run the full Rust
legacy merge groups, and daily/manual full runs. Queue drafts run the full Celox Rust
workspace when Rust is affected. Mergify checks up to five batches concurrently
across three queue rules. Parallel mode separates independent file scopes while
retaining combined-tree validation for overlapping scopes:
Expand Down Expand Up @@ -151,11 +151,8 @@ This does not prioritize jobs inside GitHub Actions or preempt occupied runners.
See [Mergify priorities](https://docs.mergify.com/merge-queue/priority/) and
[Mergify queue modes](https://docs.mergify.com/merge-queue/queue-modes/).

The separate lydite documentation, editor, and Celox replay checks run on queue
drafts rather than ordinary PRs; develop pushes, weekly runs, and manual dispatch
remain enabled. The expensive `veryl-fv` and `veryl-proof-corpus` jobs run only
weekly (Monday at 03:41 UTC / 12:41 JST) or on manual dispatch, never on queue
drafts or develop pushes. These separate lydite checks are not merge requirements.
Lydite tests use the independent change-selected and weekly cadence described
below, including on Mergify queue draft PRs.
The `Queue validation` merge condition requires the selected checks in `ci.yml` to pass;
ordinary PR checks cannot satisfy it. The `ci:full` label opts a PR into the
same coverage on its next push. Unrelated paths may still skip jobs.
Expand Down Expand Up @@ -198,20 +195,37 @@ Job selection:
required check. Only explicitly unneeded producers may be skipped; failures
and cancellations fail the check.

Lydite has its own test cadence (`scripts/ci-lydite-changes.mjs`):

- Lydite sources and fixtures run its core and bridge lanes. The core lane owns
the proof-engine Rust tests, editor and standalone Veryl conformance.
- Celox changes run only the bridge lane when Cargo's dependency graph reaches
`lydite-celox`. This includes replay and proof-backed Veryl/symbolic corpus
gates, which use the in-tree exporter. Upstream private tests and Markdown
do not trigger consumer checks. NAPI/JS changes do not reach Lydite.
- Shared dependency/toolchain configuration and an unreadable diff or dependency
graph run both lanes. The graph includes optional, build and dev edges.
- Ordinary `ci.yml` tests exclude `lydite*`, including daily and release runs;
formatting/lint/build checks remain there. The dedicated workflow tests the
selected Lydite packages, including doctests, and installs its solver.
- `Lydite checks` accepts skipped lanes only when change detection explicitly
excludes them, and fails on selected-job failures or cancellations. Repository
branch protection must require this check to make it a merge gate.

The classifier selects CI jobs, not individual Rust tests. Selected Rust CI
still runs the full workspace suite with CI features, doctests, default-feature
still runs the Celox workspace suite with CI features, doctests, default-feature
checks, ARM64 backend checks, and the explicit cocotb test. Local validation
uses the finer behavior-based matrix above.

| Cadence | Coverage |
| --- | --- |
| Daily at 01:17 UTC (10:17 JST) | Full `ci.yml` on the default branch, with every change-classifier output enabled. Includes native/WASI NAPI, JS/browser tests, ARM64, script tests, and all ordinary workspace tests. |
| Daily at 01:17 UTC (10:17 JST) | Full `ci.yml` on the default branch, with every change-classifier output enabled. Includes native/WASI NAPI, JS/browser tests, ARM64, script tests, and all ordinary Celox workspace tests. |
| Daily from `nightly.yml` at 02:43 UTC (11:43 JST) | Dispatch the same full CI on `develop`, with detection of its Veryl dependency lane. Queue nightly packages and the small pinned/HEAD Heliodor Linux boot compatibility checks. |
| Daily at 01:47 UTC (10:47 JST) | `bench.yml` measures Rust, Verilator, and TypeScript on one host and publishes master history. Manual dispatch supports branch measurements. |
| Daily at 02:17 UTC (11:17 JST) | `codspeed.yml` measures compile time on the default branch using CPU simulation. Execution failures and CodSpeed performance-check failures open or update a branch issue; the next healthy run closes it. Manual dispatch supports branch measurements. PRs, merge groups, and pushes do not run CodSpeed. |
| Daily at 02:37 UTC (11:37 JST) | `heliodor-bench.yml` runs the complete master Linux suite on x86-64 and AArch64. Explicit manual selections retain focused suite runs and ARM64 profiling. PRs run only the benchmark tooling tests when those files change. |
| Every full CI run | Run every shared Veryl and SystemVerilog case against both Verilator and Icarus, with locked Nix tools. Run the live adapter tests normally marked ignored because they need external tools. Preserve reports and per-case diagnostics as artifacts for 14 days, including on failure; matrix failures do not cancel the other comparisons. |
| Weekly Monday at 03:41 UTC (12:41 JST), or manual dispatch | All `lydite.yml` checks, including Veryl formal verification and proof/mutation corpus gates. The two Veryl jobs run only at this cadence; documentation, editor, and Celox replay checks also run on queue drafts and develop pushes with relevant changes. |
| Affected pull requests and merge groups; weekly Monday at 03:41 UTC (12:41 JST); on demand | `lydite.yml` owns Lydite Rust tests, proof, conformance, editor, and mutation gates. Unrelated changes skip these jobs. Weekly and manual runs enable all lanes. |
| On demand | Dispatch `ci.yml` on the desired branch to run full CI and external comparisons, regardless of its diff. |
| Pull requests that cut a release | A `master` pull request or legacy merge group whose diff changes `.release-please-manifest.json` (only the release pull request does there; syncing it into `develop` is not a release) runs full CI and the external comparisons. `Rust Test & NAPI Build` then requires the comparisons to pass, so a release cannot merge after only change-based checks. Daily and manual full runs do not gate on the comparisons; their failures reach the full CI issue below. A `master` pull request or legacy merge group whose diff cannot be determined is treated the same way. |

Expand Down
4 changes: 4 additions & 0 deletions crates/celox-test-suite/src/veryl/cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ pub(super) struct Group {
}

pub(super) const GROUPS: &[Group] = &[
Group {
file: "src/veryl/cases/tb_string.vtest",
text: include_str!("tb_string.vtest"),
},
Group {
file: "src/veryl/cases/partial_word_shift.vtest",
text: include_str!("partial_word_shift.vtest"),
Expand Down
79 changes: 79 additions & 0 deletions crates/celox-test-suite/src/veryl/cases/tb_string.vtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
(group tb_string (category control_flow))

(case assignment
(source "test.veryl" #"#[test(Top)]
module Top {
var text: string;
var copy: string;
initial {
text = "short";
$assert(text == "short");
copy = text;
text = "a string longer than sixty-four bits";
$assert(text == "a string longer than sixty-four bits");
$assert(copy == "short");
copy = text;
$assert(copy == text);
text = "x";
$assert(text == "x");
$assert(copy != text);
text = "";
$assert(text == "");
$assert(copy != text);
$finish();
}
}
"#)
(top Top)
(run_testbench))

(case comparison
(source "test.veryl" #"#[test(Top)]
module Top {
var left: string;
var right: string;
initial {
left = "b";
right = "aa";
$assert(left >: right);
$assert(left >= right);
$assert(right <: left);
$assert(right <= left);
$assert(left != right);
right = left;
$assert(left == right);
$assert(left <= right);
$assert(left >= right);
left = "";
$assert(left <: right);
$finish();
}
}
"#)
(top Top)
(run_testbench))

(case control_flow
(source "test.veryl" #"#[test(Top)]
module Top {
var text: string;
var choose: logic;
initial {
text = "before";
$assert(text == "before");
choose = 1;
text = if choose ? "longer branch value" : "no";
$assert(text == "longer branch value");
choose = 0;
text = if choose ? "no" : "";
$assert(text == "");
for i in 0..3 {
if i == 1 { text = "middle"; }
}
$assert(text == "middle");
$finish();
}
}
"#)
(top Top)
(run_testbench))
2 changes: 1 addition & 1 deletion crates/celox-test-suite/tests/external_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn catalogue_has_unique_stable_names_and_categories() {
assert!(names.insert(case.name), "duplicate {}", case.name);
assert!(case.name.contains("::"));
}
assert_eq!(names.len(), 757);
assert_eq!(names.len(), 760);
assert_eq!(
case("operators::test_bitwise_operations").unwrap().category,
Category::Operators
Expand Down
Loading
Loading