Skip to content

Commit

Permalink
ci: Use official GHA templates for homebrew
Browse files Browse the repository at this point in the history
Copied artefacts from `brew tap-new rnpgp/rnp`.
  • Loading branch information
ribose-jeffreylau committed Aug 10, 2021
1 parent bfda5bc commit bf17564
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 20 deletions.
51 changes: 31 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
name: CI

on: [push]

env:
FORMULA: ./Formula/rnp.rb
OPTS: ""
name: brew pr-pull
on:
pull_request_target:
types:
- labeled
jobs:
build:
runs-on: macos-latest
pr-pull:
if: contains(github.event.pull_request.labels.*.name, 'pr-pull')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build the formula
run: brew install --build-bottle ${FORMULA}
- name: Test the formula
run: brew test ${FORMULA}
- name: Audit the formula
run: brew audit --new-formula ${FORMULA}
- name: Build the bottle
run: |
brew bottle --json --force-core-tap --no-rebuild ${FORMULA}
source ci/read_bottle_metadata.sh
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Set up git
uses: Homebrew/actions/git-user-config@master

- name: Pull bottles
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST

- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ github.token }}
branch: main

- name: Delete branch
if: github.event.pull_request.head.repo.fork == false
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
run: git push --delete origin $BRANCH
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: brew test-bot
on:
push:
branches:
- main
pull_request:
jobs:
test-bot:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

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

- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems

- 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: Upload bottles as artifact
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@main
with:
name: bottles
path: '*.bottle.*'

0 comments on commit bf17564

Please sign in to comment.