interplane.Get Omega
Read in your language

tree-sitter-omega

aien-dev/tree-sitter-omega

Brought by drakestapleton

branch main Branches Tags History

tree-sitter-omega / .github / workflows / ci.yml

99 lines · 4963 bytes Raw Blame History
1name: grammar
2# Regenerates the parser with the pinned tree-sitter CLI and checks it matches the committed src/,
3# runs the corpus and highlight tests, then measures parse coverage over every *.om file in
4# aien-dev/omega-mv at the commit in omega.ref and over the library units omega-mv composes
5# (test/units/omega-mv.units), with omc born from the 408-byte seed as the oracle for which files
6# and units the real compiler accepts. Three negative controls must fail.
7on:
8 push:
9 branches: [main]
10 pull_request:
11 workflow_dispatch:
12 schedule:
13 - cron: '41 6 * * 1'
14permissions:
15 contents: read
16jobs:
17 grammar:
18 runs-on: ubuntu-24.04-arm
19 timeout-minutes: 20
20 steps:
21 - uses: actions/checkout@v4
22 - uses: actions/setup-node@v4
23 with:
24 node-version: '24'
25 - name: Install the pinned tree-sitter CLI and check its bytes
26 run: |
27 set -eu
28 npm ci --ignore-scripts
29 (cd node_modules/tree-sitter-cli && node install.js)
30 sha256sum -c tree-sitter-cli.sha256
31 npx --no-install tree-sitter --version
32 - name: tree-sitter generate (committed src/ must match)
33 run: |
34 set -eu
35 npx --no-install tree-sitter generate
36 git diff --exit-code -- src
37 - name: tree-sitter test
38 run: npx --no-install tree-sitter test
39 - name: Clone omega-mv at omega.ref and birth omc from the seed
40 run: |
41 set -eu
42 ref=$(awk '$1=="commit"{print $2}' omega.ref)
43 git clone --no-checkout https://github.com/aien-dev/omega-mv "$RUNNER_TEMP/omega-mv"
44 cd "$RUNNER_TEMP/omega-mv"
45 git checkout --detach "$ref"
46 git rev-parse HEAD
47 # Keep the corpus pristine: birth omc in a copy, so seed/out adds no files to the count.
48 git worktree add --detach "$RUNNER_TEMP/omega-build" "$ref"
49 cd "$RUNNER_TEMP/omega-build"
50 sh seed/omega-from-seed.sh > "$RUNNER_TEMP/seed.log" 2>&1 || { tail -40 "$RUNNER_TEMP/seed.log"; exit 1; }
51 sha256sum seed/out/omc
52 - name: Corpus coverage (every omc-accepted file and unit must parse clean)
53 run: |
54 set -u
55 rc=0
56 sh scripts/coverage.sh --omc "$RUNNER_TEMP/omega-build/seed/out/omc" --units test/units/omega-mv.units \
57 "$RUNNER_TEMP/omega-mv" > coverage.tsv || rc=$?
58 grep '^COVERAGE' coverage.tsv
59 { echo '```'; grep '^COVERAGE' coverage.tsv; echo; grep 'parse=error' coverage.tsv; echo '```'; } >> "$GITHUB_STEP_SUMMARY"
60 [ "$rc" = 0 ] || { echo "coverage.sh exited $rc"; grep 'omc=accept.*parse=error' coverage.tsv; exit 1; }
61 grep -q '^COVERAGE units-accepted 16/16 ' coverage.tsv || { echo "omega-mv units not all accepted"; grep '^unit:' coverage.tsv; exit 1; }
62 - name: Negative control 1, a malformed unit parses with ERROR (must FAIL to parse)
63 run: |
64 set -u
65 rc=0; npx --no-install tree-sitter parse -p . --quiet test/negative/malformed.om > neg1.txt 2>&1 || rc=$?
66 cat neg1.txt
67 [ "$rc" != 0 ] || { echo "malformed unit parsed clean"; exit 1; }
68 grep -Eq '\((ERROR|MISSING)' neg1.txt
69 echo "negative control 1 failed as required (rc=$rc)"
70 - name: Negative control 2, the coverage gate refuses an accepted file that does not parse
71 run: |
72 set -u
73 d="$RUNNER_TEMP/neg2"; mkdir -p "$d"
74 cp "$RUNNER_TEMP/omega-mv/examples/om2-tour.om" test/negative/malformed.om "$d/"
75 # An oracle that accepts every file: the malformed unit is now "accepted" and must fail the gate.
76 rc=0; sh scripts/coverage.sh --omc /usr/bin/true "$d" > neg2.tsv || rc=$?
77 cat neg2.tsv
78 [ "$rc" = 1 ] || { echo "coverage gate passed a malformed accepted file: rc=$rc"; exit 1; }
79 grep -q '^COVERAGE omc-accepted 1/2 ' neg2.tsv
80 echo "negative control 2 failed as required (rc=$rc)"
81 - name: Negative control 3, the units gate refuses a composed unit and names the member at fault
82 run: |
83 set -u
84 d="$RUNNER_TEMP/neg3"; mkdir -p "$d"
85 cp "$RUNNER_TEMP/omega-mv/examples/om2-tour.om" test/negative/malformed.om "$d/"
86 echo 'unit neg3 neg3:om2-tour.om neg3:malformed.om' > neg3.units
87 rc=0; sh scripts/coverage.sh --omc /usr/bin/true --units neg3.units "$d" > neg3.tsv || rc=$?
88 cat neg3.tsv
89 [ "$rc" = 1 ] || { echo "coverage gate passed a malformed accepted unit: rc=$rc"; exit 1; }
90 grep -Eq '^unit:neg3 omc=accept parse=error .* in malformed\.om:[0-9]+$' neg3.tsv
91 grep -q '^COVERAGE units-accepted 0/1 ' neg3.tsv
92 echo "negative control 3 failed as required (rc=$rc)"
93 - name: Keep the coverage table
94 if: always()
95 uses: actions/upload-artifact@v4
96 with:
97 name: coverage
98 path: coverage.tsv
99 if-no-files-found: ignore