Skip to content

Commit

Permalink
Merge pull request #1 from logchange/test-workflow
Browse files Browse the repository at this point in the history
Created test workflow
  • Loading branch information
witx98 authored Feb 16, 2025
2 parents 295753f + 7a3ee09 commit 3642512
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: brew test-bot

on:
push:
branches:
- main
pull_request:

jobs:
test-bot:
name: Test formula on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
os: [ubuntu-latest, macos-13, macos-latest]
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Cache Homebrew Bundler RubyGems
uses: actions/cache@v4
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ matrix.os }}-rubygems-

- run: brew test-bot --only-cleanup-before

- run: brew test-bot --only-setup

- run: brew test-bot --only-tap-syntax

- run: brew test-bot --only-formulae
if: github.event_name == 'pull_request'

- name: Install latest version of formula
run: brew install logchange/tap/logchange

- name: Run formula tests
run: brew test logchange/tap/logchange

- name: Upload bottles as artifact
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: bottles_${{ matrix.os }}
path: '*.bottle.*'
5 changes: 5 additions & 0 deletions Formula/logchange.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ def install
chmod 0755, "#{libexec}/logchange-#{os_arch}/logchange"
bin.write_exec_script "#{libexec}/logchange-#{os_arch}/logchange"
end

test do
output = shell_output("#{bin}/logchange --version")
assert_match version.to_s, output
end
end

0 comments on commit 3642512

Please sign in to comment.