Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/test-formula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test Homebrew Formulas

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
# Check out the repository
- name: Check out code
uses: actions/checkout@v3

# Set up Homebrew
- name: Set up Homebrew
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl file git
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# Tap tech-thinker/tap
- name: Tap tech-thinker/tap
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew tap tech-thinker/tap

# Install and test all formulas in the Formula directory
- name: Test all formulas
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Find all formula files in the Formula directory
FORMULAS=$(find Formula -name "*.rb")

# Loop through each formula
for formula in $FORMULAS; do
formula_name=$(basename $formula .rb)
echo "Testing $formula_name..."
brew install --build-from-source ./Formula/$formula_name.rb
brew test ./Formula/$formula_name.rb
brew uninstall $formula_name
done
5 changes: 5 additions & 0 deletions Formula/gnote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ def install
end
end
end

test do
# Check if the `gnote` binary executes and displays the help message
assert_match "Version", shell_output("#{bin}/gnote version")
end
end
5 changes: 5 additions & 0 deletions Formula/sws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ def install
end
end
end

test do
# Check if the `sws` binary executes and displays the help message
assert_match "sws", shell_output("#{bin}/sws --version")
end
end
5 changes: 5 additions & 0 deletions Formula/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ def install
end
end
end

test do
# Check if the `tasks` binary executes and displays the help message
assert_match "tasks", shell_output("#{bin}/tasks version")
end
end
Loading