Skip to content

Commit

Permalink
Experiment: brew.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreatwood committed Dec 28, 2024
1 parent aa18b7d commit 95cb2a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/brew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ jobs:
# --force Run even if pistache brew formula unchanged
# --HEAD Test with head of pistacheio/pistache master branch
unset HOMEBREW_GITHUB_API_TOKEN
homebrew/runformula.sh --auditonly --force --HEAD
# if brew list pistache &>/dev/null; then brew remove pistache; fi
## Use release (not HEAD), do audit (-y), and force even if pistache
## formula unchanged
Expand Down
26 changes: 18 additions & 8 deletions homebrew/runformula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ do_yes=false
do_usage=false
use_head=false
skip_audit=false
audit_only=false
do_force=false
optspec=":hfy-:"
while getopts "$optspec" optchar; do
Expand All @@ -51,6 +52,9 @@ while getopts "$optspec" optchar; do
skipaudit)
skip_audit=true
;;
auditonly)
audit_only=true
;;
force)
do_force=true
;;
Expand Down Expand Up @@ -87,6 +91,7 @@ if [ "$do_usage" = true ]; then
echo " -f, --force Test even if forumla already up-to-date"
echo " -y Answer yes to questions (i.e. do audit)"
echo " --skipaudit Skips brew audit; overrides -y for audit question"
echo " --auditonly Skips brew install, does audit"
if [ "$do_yes" = true ] || [ "$do_head" = true ]; then
echo "Error: Usage requested with other options"
do_error=true
Expand Down Expand Up @@ -161,19 +166,24 @@ else
echo "Copying $MY_SCRIPT_DIR/pistache.rb to $pist_form_file"
fi

# Drop copyright + license SPDX message when adding forumla to homebrew/core
sed '1,6d' "$MY_SCRIPT_DIR/pistache.rb" >"$pist_form_file"
if [ "$audit_only" != true ]; then
# Drop copyright + license SPDX message when adding forumla to homebrew/core
sed '1,6d' "$MY_SCRIPT_DIR/pistache.rb" >"$pist_form_file"

if brew list pistache &>/dev/null; then brew remove pistache; fi
if [ "$use_head" = true ]; then
brew install --HEAD pistache
else
brew install --build-from-source pistache
if brew list pistache &>/dev/null; then brew remove pistache; fi
if [ "$use_head" = true ]; then
brew install --HEAD pistache
else
brew install --build-from-source pistache
fi
brew test --verbose pistache
fi
brew test --verbose pistache

if [ "$skip_audit" != true ]; then
do_audit=$do_yes
if [ "$do_audit" != true ]; then
do_audit=$audit_only
fi
if [ "$do_audit" != true ]; then
read -e -p 'brew audit? [y/N]> '
if [[ "$REPLY" == [Yy]* ]]; then
Expand Down

0 comments on commit 95cb2a8

Please sign in to comment.