tap-new: update GitHub Actions.

This should be using the split options for a better user experience
and can use both Linux and macOS now.
This commit is contained in:
Mike McQuaid 2020-08-04 11:57:39 +01:00
parent 9f80629f64
commit acfdbce6d4
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
2 changed files with 22 additions and 8 deletions

View File

@ -53,23 +53,37 @@ module Homebrew
pull_request: [] pull_request: []
jobs: jobs:
test-bot: test-bot:
runs-on: macos-latest runs-on: [ubuntu-latest, macos-latest]
steps: steps:
- name: Update Homebrew
run: brew update
- name: Set up Git repository - name: Set up Git repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run brew test-bot
- name: Set up Homebrew
run: | run: |
set -e
brew update
HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}" HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/#{tap.full_name}"
mkdir -p "$HOMEBREW_TAP_DIR" mkdir -p "$HOMEBREW_TAP_DIR"
rm -rf "$HOMEBREW_TAP_DIR" rm -rf "$HOMEBREW_TAP_DIR"
ln -s "$PWD" "$HOMEBREW_TAP_DIR" ln -s "$PWD" "$HOMEBREW_TAP_DIR"
brew test-bot
- name: Run brew test-bot --only-cleanup-before
run: brew test-bot --only-cleanup-before
- name: Run brew test-bot --only-setup
run: brew test-bot --only-setup
- name: Run brew test-bot --only-tap-syntax
run: brew test-bot --only-tap-syntax
- name: Run brew test-bot --only-formulae
if: github.event_name == 'pull_request'
run: brew test-bot --only-formulae
YAML YAML
(tap.path/".github/workflows").mkpath (tap.path/".github/workflows").mkpath
write_path(tap, ".github/workflows/main.yml", actions) write_path(tap, ".github/workflows/tests.yml", actions)
ohai "Created #{tap}" ohai "Created #{tap}"
puts tap.path.to_s puts tap.path.to_s
end end

View File

@ -7,13 +7,13 @@ describe "Homebrew.tap_new_args" do
end end
describe "brew tap-new", :integration_test do describe "brew tap-new", :integration_test do
it "initializes a new Tap with a ReadMe file and GitHub Actions CI" do it "initializes a new tap with a README file and GitHub Actions CI" do
expect { brew "tap-new", "homebrew/foo", "--verbose" } expect { brew "tap-new", "homebrew/foo", "--verbose" }
.to be_a_success .to be_a_success
.and output(%r{homebrew/foo}).to_stdout .and output(%r{homebrew/foo}).to_stdout
.and not_to_output.to_stderr .and not_to_output.to_stderr
expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/README.md").to exist expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/README.md").to exist
expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/.github/workflows/main.yml").to exist expect(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo/.github/workflows/tests.yml").to exist
end end
end end