interplane.Get Omega
Read in your language

omega-packages

aien-dev/omega-packages

Brought by drakestapleton

branch main Branches Tags History

omega-packages / .github / workflows / ci.yml

233 lines · 10886 bytes Raw Blame History
1name: recipes
2# Builds omc from the 408-byte seed with every recipe in this repo on GitHub's ubuntu-24.04-arm runner,
3# and runs negative controls that must fail. A run dispatched with control=tampered-seed or
4# control=wrong-omc-hash makes the seed-deb job itself fail: that red run is the proof the gate bites.
5on:
6 push:
7 branches: [main]
8 pull_request:
9 workflow_dispatch:
10 inputs:
11 control:
12 description: "none = normal build; anything else must make seed-deb FAIL"
13 type: choice
14 options: [none, tampered-seed, wrong-omc-hash, wrong-source-hash]
15 default: none
16permissions:
17 contents: read
18jobs:
19 pins:
20 runs-on: ubuntu-24.04-arm
21 steps:
22 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
23 with:
24 persist-credentials: false
25 - run: sh scripts/check-pins.sh
26
27 seed-deb:
28 runs-on: ubuntu-24.04-arm
29 timeout-minutes: 30
30 steps:
31 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32 with:
33 persist-credentials: false
34 - name: Birth omc from the seed (scripts/omc-from-seed.sh)
35 env:
36 CONTROL: ${{ inputs.control || 'none' }}
37 run: |
38 set -eu
39 case $CONTROL in
40 none) ;;
41 tampered-seed) export TAMPER_SEED=1 ;;
42 wrong-omc-hash) export EXPECT_OMC_SHA256=0000000000000000000000000000000000000000000000000000000000000000 ;;
43 wrong-source-hash) export EXPECT_SRC_SHA256=0000000000000000000000000000000000000000000000000000000000000000 ;;
44 esac
45 echo "control=$CONTROL"; uname -srm
46 start=$(date +%s%3N)
47 sh scripts/omc-from-seed.sh build
48 echo "wall_ms $(( $(date +%s%3N) - start ))"
49 - name: Build the .deb
50 run: sh debian/build-deb.sh build/omc dist
51 - name: dpkg -i, then compile and run examples/hello.om from a clean dir
52 run: |
53 set -eu
54 sudo dpkg -i dist/omc_*_arm64.deb
55 dpkg -s omc | sed -n '1,4p'
56 d=$(mktemp -d); cd "$d"
57 cp /usr/share/doc/omc/examples/hello.om .
58 omc < hello.om > hello; chmod +x hello
59 out=$(./hello); echo "hello prints: $out"; [ "$out" = "omega 55" ]
60 printf 'fn main to int\nret zz\nend\n' > bad.om
61 rc=0; omc < bad.om > bad || rc=$?
62 [ "$rc" != 0 ] || { echo "omc accepted bad.om"; exit 1; }
63 echo "bad.om refused, rc=$rc (expected)"
64 sudo dpkg -r omc
65 - name: SPDX SBOM, validated by spdx-tools
66 run: |
67 set -eu
68 . ./pins.env
69 sh scripts/sbom.sh "build/omega-mv-$OMEGA_MV_COMMIT" build/omc > dist/omc.spdx.json
70 pipx run --spec 'spdx-tools==0.8.3' pyspdxtools -i dist/omc.spdx.json
71 - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
72 with:
73 name: deb
74 path: dist/
75
76 controls:
77 runs-on: ubuntu-24.04-arm
78 timeout-minutes: 30
79 steps:
80 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
81 with:
82 persist-credentials: false
83 - name: Fetch the pinned archive once
84 run: |
85 . ./pins.env
86 curl -fsSL --retry 3 -o "$RUNNER_TEMP/src.tar.gz" "https://github.com/aien-dev/omega-mv/archive/$OMEGA_MV_COMMIT.tar.gz"
87 - name: "Control 1: tampered seed0.hex byte (must FAIL)"
88 run: |
89 set -u
90 rc=0; TAMPER_SEED=1 SRC_ARCHIVE="$RUNNER_TEMP/src.tar.gz" sh scripts/omc-from-seed.sh c1 2> c1.err || rc=$?
91 cat c1.err
92 [ "$rc" = 1 ] && grep -q '^FAIL seed/omega-from-seed.sh refused' c1.err && [ ! -e c1/omc ] \
93 || { echo "tampered seed was not refused (rc=$rc)"; exit 1; }
94 echo "control 1 failed as required"
95 - name: "Control 2: wrong expected omc sha256 (must FAIL)"
96 run: |
97 set -u
98 rc=0; EXPECT_OMC_SHA256=1c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f \
99 SRC_ARCHIVE="$RUNNER_TEMP/src.tar.gz" sh scripts/omc-from-seed.sh c2 2> c2.err || rc=$?
100 cat c2.err
101 [ "$rc" = 1 ] && grep -q '^FAIL omc sha256 2c82480596bbdc50' c2.err && [ ! -e c2/omc ] \
102 || { echo "wrong omc hash was not refused (rc=$rc)"; exit 1; }
103 echo "control 2 failed as required"
104 - name: "Control 3: a changed source archive (must FAIL)"
105 run: |
106 set -u
107 cp "$RUNNER_TEMP/src.tar.gz" bad.tar.gz; printf 'x' >> bad.tar.gz
108 rc=0; SRC_ARCHIVE=bad.tar.gz sh scripts/omc-from-seed.sh c3 2> c3.err || rc=$?
109 cat c3.err
110 [ "$rc" = 1 ] && grep -q '^FAIL source archive sha256' c3.err || { echo "changed archive accepted (rc=$rc)"; exit 1; }
111 echo "control 3 failed as required"
112 - name: "Control 4: pin checker catches a drifted recipe (must FAIL)"
113 run: |
114 set -u
115 sed -i 's/2c82480596bbdc50/3c82480596bbdc50/' flake.nix
116 rc=0; sh scripts/check-pins.sh || rc=$?
117 git checkout flake.nix
118 [ "$rc" = 1 ] || { echo "drifted flake.nix passed check-pins (rc=$rc)"; exit 1; }
119 echo "control 4 failed as required"
120
121 nix:
122 runs-on: ubuntu-24.04-arm
123 timeout-minutes: 30
124 steps:
125 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
126 with:
127 persist-credentials: false
128 - uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31.11.3
129 - run: nix --version
130 - name: nix build (seed birth + pinned-hash check + hello check inside the derivation)
131 run: nix build -L .#omc && ls -l result/bin/omc && sha256sum result/bin/omc
132 - run: nix flake check -L
133 - name: nix run from a clean dir
134 run: |
135 set -eu
136 d=$(mktemp -d); cp examples/hello.om "$d"; repo=$PWD; cd "$d"
137 nix run "$repo" < hello.om > hello; chmod +x hello
138 out=$(./hello); echo "hello prints: $out"; [ "$out" = "omega 55" ]
139 - name: "Control: wrong omc hash in the flake (must FAIL)"
140 run: |
141 set -u
142 sed -i 's/omcSha256 = "2c82/omcSha256 = "3c82/' flake.nix
143 rc=0; nix build -L .#omc --no-link 2> nix.err || rc=$?
144 tail -5 nix.err; git checkout flake.nix
145 [ "$rc" != 0 ] && grep -q 'FAILED' nix.err || { echo "flake accepted a wrong hash (rc=$rc)"; exit 1; }
146 echo "nix control failed as required"
147
148 guix:
149 runs-on: ubuntu-24.04-arm
150 timeout-minutes: 90
151 steps:
152 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
153 with:
154 persist-credentials: false
155 - name: Install Guix (Ubuntu package) and authorize the official substitute servers
156 run: |
157 set -eu
158 sudo apt-get update -q
159 sudo apt-get install -y -q guix
160 guix --version | sed -n 1p
161 for k in /usr/share/guix/*.pub; do echo "$k"; sudo guix archive --authorize < "$k"; done
162 sudo systemctl restart guix-daemon || true
163 - name: guix build -L guix omc
164 run: |
165 set -eu
166 guix build -L guix omc --keep-failed --fallback 2>&1 | tail -40
167 out=$(guix build -L guix omc)
168 sha256sum "$out/bin/omc"
169 echo "2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f $out/bin/omc" | sha256sum -c -
170 d=$(mktemp -d); cp examples/hello.om "$d"; cd "$d"
171 "$out/bin/omc" < hello.om > hello; chmod +x hello; out=$(./hello); echo "hello prints: $out"; [ "$out" = "omega 55" ]
172 - name: "Control: wrong omc hash in the Guix package (must FAIL)"
173 run: |
174 set -u
175 sed -i 's/(define %omc-sha256 "2c82/(define %omc-sha256 "3c82/' guix/aien/omega.scm
176 rc=0; guix build -L guix omc > g.log 2>&1 || rc=$?
177 git checkout guix/aien/omega.scm
178 grep -E 'FAILED|error' g.log | tail -5
179 [ "$rc" != 0 ] && grep -q 'seed/out/omc: FAILED' g.log || { echo "guix accepted a wrong hash (rc=$rc)"; exit 1; }
180 echo "guix control failed as required"
181
182 aur:
183 runs-on: ubuntu-24.04-arm
184 timeout-minutes: 30
185 steps:
186 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
187 with:
188 persist-credentials: false
189 # menci/archlinuxarm:latest index digest, resolved 2026-11-02 (tag last pushed 2026-11-01).
190 - name: makepkg in Arch Linux ARM (menci/archlinuxarm), .SRCINFO must match
191 run: |
192 docker run --rm -v "$PWD/aur:/src:ro" menci/archlinuxarm@sha256:627906fdc1d96fb8d83ba7b38906344577cbd108375b1724ce99e3b0991f8f33 bash -euc '
193 uname -m
194 # pacman 7 sandboxes downloads with Landlock, which the runner kernel refuses inside docker.
195 sed -i "s/^\[options\]/[options]\nDisableSandbox/" /etc/pacman.conf
196 pacman -Syu --noconfirm --needed base-devel >/dev/null
197 useradd -m b
198 cp -r /src /home/b/omc; chown -R b /home/b/omc
199 cd /home/b/omc
200 su b -c "makepkg --printsrcinfo" | diff -u .SRCINFO -
201 su b -c "makepkg --cleanbuild --noconfirm"
202 pacman -U --noconfirm omc-*.pkg.tar.*
203 pacman -Qi omc | sed -n "1,3p"
204 cd "$(mktemp -d)"
205 printf "global out uchar 4\nfn main to int\nput out 0 111\nput out 1 107\nput out 2 10\nw = write 1 out 0 3\nret 0\nend\n" > ok.om
206 omc < ok.om > ok; chmod +x ok; [ "$(./ok)" = ok ] && echo "installed omc compiled ok.om"
207 '
208
209 docker:
210 runs-on: ubuntu-24.04-arm
211 timeout-minutes: 30
212 steps:
213 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
214 with:
215 persist-credentials: false
216 # Same BuildKit index digest as release.yml (moby/buildkit:buildx-stable-1, v0.33.1).
217 - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
218 with:
219 driver-opts: image=moby/buildkit@sha256:cec9f139f45e93c5c69c60f8b07cfad9f43f4ef6b6a6cd917527fea5ff2e3dea
220 - name: Build the image from the seed inside BusyBox
221 run: docker buildx build --platform linux/arm64 --load -t omc:ci docker/
222 - name: The image compiles examples/hello.om
223 run: |
224 set -eu
225 docker run --rm -i omc:ci < examples/hello.om > hello; chmod +x hello
226 out=$(./hello); echo "hello prints: $out"; [ "$out" = "omega 55" ]
227 - name: "Control: wrong OMC_SHA256 build-arg (must FAIL)"
228 run: |
229 set -u
230 rc=0; docker buildx build --platform linux/arm64 --build-arg OMC_SHA256=3c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f docker/ 2> d.err || rc=$?
231 tail -5 d.err
232 [ "$rc" != 0 ] && grep -q 'FAILED' d.err || { echo "image built with a wrong hash (rc=$rc)"; exit 1; }
233 echo "docker control failed as required"