-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.95 KB
/
Copy pathtest-formula.yml
File metadata and controls
54 lines (46 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Test Formula
on:
pull_request:
paths:
- 'Formula/*.rb'
- '.github/workflows/test-formula.yml'
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
formula: [denvig, denvig-alpha]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
# Homebrew 6.0 sandboxes Linux source builds with Bubblewrap and aborts when a
# rootless `bwrap` cannot run. The ubuntu-latest image doesn't ship bwrap, and
# Ubuntu 24.04 also blocks unprivileged user namespaces via AppArmor — both must
# be addressed before `brew install`. Install the system package, then relax the
# namespace restrictions so rootless Bubblewrap can create its sandbox.
- name: Enable Bubblewrap sandbox (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y bubblewrap
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 || true
sudo sysctl -w kernel.unprivileged_userns_clone=1 || true
- name: Audit formula
run: brew audit --strict ${{ matrix.formula }}
- name: Install formula
run: brew install --build-from-source ${{ matrix.formula }}
- name: Test formula
run: brew test ${{ matrix.formula }}
- name: Verify installed binary
run: |
# denvig-alpha is keg-only, so resolve the binary via its opt prefix
# rather than relying on it being symlinked onto PATH.
BIN="$(brew --prefix ${{ matrix.formula }})/bin/denvig"
EXPECTED=$(sed -nE 's#.*/denvig-([^"/]+)\.tgz".*#\1#p' "Formula/${{ matrix.formula }}.rb" | head -1)
echo "Expecting version: $EXPECTED"
ACTUAL="$("$BIN" --version)"
echo "denvig --version -> $ACTUAL"
echo "$ACTUAL" | grep -qF "$EXPECTED"