interplane.Get Omega
Read in your language

homebrew-omega

aien-dev/homebrew-omega

Brought by drakestapleton

branch main Branches Tags History

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

82 lines · 3551 bytes Raw Blame History
1name: brew
2# Installs Homebrew on GitHub's ubuntu-24.04-arm runner, taps this checkout as aien-dev/omega, builds
3# omc from the 408-byte seed and runs `brew test omc`. The control job installs a copy of the formula
4# whose pinned omc sha256 is wrong; that install must fail. A dispatch with control=wrong-omc-hash
5# makes the main install job itself go red on purpose.
6on:
7 push:
8 branches: [main]
9 pull_request:
10 workflow_dispatch:
11 inputs:
12 control:
13 description: "none = normal install; wrong-omc-hash must make the install FAIL"
14 type: choice
15 options: [none, wrong-omc-hash]
16 default: none
17permissions:
18 contents: read
19env:
20 HOMEBREW_NO_AUTO_UPDATE: 1
21 HOMEBREW_NO_ANALYTICS: 1
22 HOMEBREW_NO_INSTALL_CLEANUP: 1
23jobs:
24 install:
25 runs-on: ubuntu-24.04-arm
26 timeout-minutes: 45
27 steps:
28 - uses: actions/checkout@v4
29 with:
30 fetch-depth: 0
31 - name: Install Homebrew
32 run: |
33 NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
34 echo /home/linuxbrew/.linuxbrew/bin >> "$GITHUB_PATH"
35 - name: Tap this checkout as aien-dev/omega
36 env:
37 CONTROL: ${{ inputs.control || 'none' }}
38 run: |
39 set -eu
40 brew --version
41 if [ "$CONTROL" = wrong-omc-hash ]; then
42 sed -i 's/OMC_SHA256 = "2c82/OMC_SHA256 = "3c82/' Formula/omc.rb
43 git -c user.name=ci -c user.email=ci@localhost commit -qam "control: wrong omc sha256"
44 fi
45 git checkout -q -B main
46 brew tap aien-dev/omega "$GITHUB_WORKSPACE"
47 - name: brew install --build-from-source aien-dev/omega/omc
48 run: brew install --verbose --build-from-source aien-dev/omega/omc
49 - name: brew test omc
50 run: brew test --verbose omc
51 - name: The installed omc compiles from a clean dir
52 run: |
53 set -eu
54 sha256sum "$(brew --prefix)/bin/omc"
55 d=$(mktemp -d); cd "$d"
56 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
57 omc < ok.om > ok; chmod +x ok; [ "$(./ok)" = ok ]
58 - name: brew audit
59 run: brew audit --formula aien-dev/omega/omc || echo "audit findings above are advisory"
60
61 control:
62 runs-on: ubuntu-24.04-arm
63 timeout-minutes: 45
64 steps:
65 - uses: actions/checkout@v4
66 - name: Install Homebrew
67 run: |
68 NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
69 echo /home/linuxbrew/.linuxbrew/bin >> "$GITHUB_PATH"
70 - name: "Control: formula with a wrong pinned omc sha256 (must FAIL)"
71 run: |
72 set -u
73 mkdir -p ctl/Formula
74 sed 's/OMC_SHA256 = "2c82/OMC_SHA256 = "3c82/' Formula/omc.rb > ctl/Formula/omc.rb
75 cmp -s Formula/omc.rb ctl/Formula/omc.rb && { echo "edit did nothing"; exit 1; }
76 git -C ctl init -q -b main && git -C ctl -c user.name=ci -c user.email=ci@localhost add -A \
77 && git -C ctl -c user.name=ci -c user.email=ci@localhost commit -qm control
78 brew tap aien-dev/omegactl "$PWD/ctl"
79 rc=0; brew install --build-from-source aien-dev/omegactl/omc > ctl.log 2>&1 || rc=$?
80 tail -5 ctl.log
81 [ "$rc" != 0 ] && grep -q 'is not the pinned 3c82' ctl.log || { echo "wrong hash was accepted (rc=$rc)"; exit 1; }
82 echo "brew control failed as required"