Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize CI configuration from homebrew/cask. #53

Merged
merged 2 commits into from
Jun 26, 2024
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
160 changes: 86 additions & 74 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
name: CI

on: pull_request
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
casks:
description: List of casks to audit (comma-separated)
required: true
skip_install:
description: Skip installation of casks
required: false
default: true
type: boolean
new_cask:
description: Apply new cask audit
required: false
default: false
type: boolean

env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}

concurrency:
Expand All @@ -18,135 +38,137 @@ jobs:
generate-matrix:
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: true
test-bot: false

- name: Check out Pull Request
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Generate CI matrix
id: generate-matrix
run: |
brew tap homebrew/cask
brew ruby -- "$(brew --repository homebrew/cask)/cmd/lib/generate-matrix.rb" "${{ github.event.pull_request.url }}"
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]
then
brew ruby -- "$(brew --repository homebrew/cask)/cmd/lib/generate-matrix.rb" ${{ github.event.inputs.skip_install && '--skip-install' }} ${{ github.event.inputs.new_cask && '--new' }} --casks=${{ github.event.inputs.casks }}
elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]
then
brew ruby -- "$(brew --repository homebrew/cask)/cmd/lib/generate-matrix.rb" --syntax-only
else
brew ruby -- "$(brew --repository homebrew/cask)/cmd/lib/generate-matrix.rb" --url="${{ github.event.pull_request.url }}"
fi

test:
name: ${{ matrix.name }}
needs: generate-matrix
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
test-bot: false
core: false
cask: true
test-bot: true

- name: Enable debug mode
run: |
echo 'HOMEBREW_DEBUG=1' >> "${GITHUB_ENV}"
echo 'HOMEBREW_VERBOSE=1' >> "${GITHUB_ENV}"
if: runner.debug

- name: Check out Pull Request
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Clean up CI machine
run: |
if ! brew list --cask visual-studio &>/dev/null; then
if ! rm -r '/Applications/Visual Studio.app'; then
echo '::warning::Removing Visual Studio is no longer necessary.'
fi
fi

if ! brew uninstall --cask julia && ! rm -r /Applications/Julia-*.app; then
if [ "${{ matrix.runner }}" == 'macos-12' ] && ! brew uninstall --cask julia && ! rm -r /Applications/Julia-*.app; then
echo '::warning::Removing Julia is no longer necessary.'
fi

if ! rm /usr/local/share/man/man1/al.1 || \
! sudo rm /etc/paths.d/mono-commands || \
! sudo rm -r /Library/Frameworks/Mono.framework || \
! sudo rm -r /Library/Frameworks/Mono.framework || \
! sudo pkgutil --forget com.xamarin.mono-MDK.pkg; then
echo '::warning::Uninstalling Mono is no longer necessary.'
fi

if ! rm /usr/local/bin/dotnet; then
echo '::warning::Removing `dotnet` symlink is no longer necessary.'
echo "::warning::Removing \`dotnet\` symlink is no longer necessary."
fi

if ! rm /usr/local/bin/pod; then
echo '::warning::Removing `cocoapods` symlink is no longer necessary.'
echo "::warning::Removing \`cocoapods\` symlink is no longer necessary."
fi

if ! rm /usr/local/bin/conda; then
echo '::warning::Removing `conda` symlink is no longer necessary.'
if ! rm /usr/local/bin/chromedriver; then
echo "::warning::Removing \`chromedriver\` symlink is no longer necessary."
fi

brew unlink python && brew link --overwrite python
if: runner.os == 'macOS'

# Workaround until the `cache` action uses the changes from
# https://github.com/actions/toolkit/pull/580.
- name: Unlink workspace
run: |
mv "${GITHUB_WORKSPACE}" "${GITHUB_WORKSPACE}-link"
mkdir "${GITHUB_WORKSPACE}"

- name: Cache Homebrew Gems
uses: actions/cache@v3
id: cache
uses: actions/cache@v4
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-

# Workaround until the `cache` action uses the changes from
# https://github.com/actions/toolkit/pull/580.
- name: Re-link workspace
run: |
rmdir "${GITHUB_WORKSPACE}"
mv "${GITHUB_WORKSPACE}-link" "${GITHUB_WORKSPACE}"
key: ${{ matrix.runner }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ matrix.runner }}-rubygems-

- name: Install Homebrew Gems
id: gems
run: brew install-bundler-gems

- name: Run brew readall ${{ matrix.tap }}
id: readall
run: brew readall '${{ matrix.tap }}'
if: always() && steps.gems.outcome == 'success'
- name: Cache style cache
if: runner.os == 'macOS'
uses: actions/cache@v4
with:
path: ~/Library/Caches/Homebrew/style
key: macos-style-cache-${{ github.sha }}
restore-keys: macos-style-cache-

- name: Run brew style ${{ matrix.tap }}
run: brew style '${{ matrix.tap }}'
if: always() && steps.readall.outcome == 'success' && !matrix.cask
- name: Run brew test-bot --only-tap-syntax
id: tap-syntax
run: brew test-bot --tap '${{ matrix.tap }}' --only-tap-syntax
if: always() && !matrix.cask

- name: Run brew fetch --cask ${{ matrix.cask.token }}
id: fetch
run: |
brew fetch --cask --retry --force '${{ matrix.cask.path }}'
brew fetch --cask --retry --force ${{ join(matrix.fetch_args, ' ') }} '${{ matrix.cask.path }}'
timeout-minutes: 30
if: always() && steps.readall.outcome == 'success' && matrix.cask
if: >
always() &&
contains(fromJSON('["success", "skipped"]'), steps.tap-syntax.outcome) &&
matrix.cask

- name: Run brew audit --cask${{ (matrix.cask && ' ') || ' --tap ' }}${{ matrix.cask.token || matrix.tap }}
id: audit
run: |
brew audit --cask ${{ join(matrix.audit_args, ' ') }}${{ (matrix.cask && ' --signing ') || ' --tap ' }}'${{ matrix.cask.path || matrix.tap }}'
brew audit --cask ${{ join(matrix.audit_args, ' ') }}${{ (matrix.cask && ' ') || ' --tap ' }}'${{ matrix.cask.token || matrix.tap }}'
timeout-minutes: 30
if: >
always() && steps.readall.outcome == 'success' &&
always() &&
contains(fromJSON('["success", "skipped"]'), steps.tap-syntax.outcome) &&
(!matrix.cask || steps.fetch.outcome == 'success') &&
!matrix.skip_audit

- name: Gather cask information
id: info
run: |
brew tap homebrew/cask-versions
brew ruby <<'EOF'
require 'cask/cask_loader'
require 'cask/installer'
Expand All @@ -173,13 +195,15 @@ jobs:
cask_dependencies = cask_and_formula_dependencies.select { |d| d.is_a?(Cask::Cask) }.map(&:full_name)
formula_dependencies = cask_and_formula_dependencies.select { |d| d.is_a?(Formula) }.map(&:full_name)

puts "::set-output name=was_installed::#{JSON.generate(was_installed)}"
puts "::set-output name=manual_installer::#{JSON.generate(manual_installer)}"
puts "::set-output name=macos_requirement_satisfied::#{JSON.generate(macos_requirement_satisfied)}"
puts "::set-output name=cask_conflicts::#{JSON.generate(cask_conflicts)}"
puts "::set-output name=cask_dependencies::#{JSON.generate(cask_dependencies)}"
puts "::set-output name=formula_conflicts::#{JSON.generate(formula_conflicts)}"
puts "::set-output name=formula_dependencies::#{JSON.generate(formula_dependencies)}"
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") do |f|
f.puts "was_installed=#{JSON.generate(was_installed)}"
f.puts "manual_installer=#{JSON.generate(manual_installer)}"
f.puts "macos_requirement_satisfied=#{JSON.generate(macos_requirement_satisfied)}"
f.puts "cask_conflicts=#{JSON.generate(cask_conflicts)}"
f.puts "cask_dependencies=#{JSON.generate(cask_dependencies)}"
f.puts "formula_conflicts=#{JSON.generate(formula_conflicts)}"
f.puts "formula_dependencies=#{JSON.generate(formula_dependencies)}"
end
EOF
if: always() && steps.fetch.outcome == 'success' && matrix.cask

Expand All @@ -205,7 +229,9 @@ jobs:
id: snapshot
run: |
brew ruby -r "$(brew --repository homebrew/cask)/cmd/lib/check.rb" <<'EOF'
puts "::set-output name=before::#{JSON.generate(Check.all)}"
File.open(ENV.fetch("GITHUB_OUTPUT"), "a") do |f|
f.puts "before=#{JSON.generate(Check.all)}"
end
EOF
if: always() && steps.info.outcome == 'success'

Expand All @@ -217,20 +243,12 @@ jobs:
fromJSON(steps.info.outputs.macos_requirement_satisfied) &&
!matrix.skip_install
timeout-minutes: 30
env:
HOMEBREW_DEBUG: 1

- name: Run brew uninstall --cask ${{ matrix.cask.token }}
run: brew uninstall --cask '${{ matrix.cask.path }}'
if: always() && steps.install.outcome == 'success' && !fromJSON(steps.info.outputs.manual_installer)
timeout-minutes: 30

- name: Uninstall formula dependencies
run: |
brew uninstall --formula ${{ join(fromJSON(steps.info.outputs.formula_dependencies), ' ') }}
if: always() && steps.install.outcome == 'success' && join(fromJSON(steps.info.outputs.formula_dependencies)) != ''
timeout-minutes: 30

- name: Uninstall cask dependencies
run: |
brew uninstall --cask ${{ join(fromJSON(steps.info.outputs.cask_dependencies), ' ') }}
Expand Down Expand Up @@ -260,12 +278,6 @@ jobs:
EOF
if: always() && steps.snapshot.outcome == 'success'

# Workaround until the `cache` action uses the changes from
# https://github.com/actions/toolkit/pull/580.
- name: Unlink workspace
run: |
rm "${GITHUB_WORKSPACE}"
mkdir "${GITHUB_WORKSPACE}"
conclusion:
name: conclusion
needs: test
Expand Down
8 changes: 3 additions & 5 deletions Casks/iconvert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
url "https://github.com/reitermarkus/mirror/raw/HEAD/iConvert.zip",
verified: "github.com/reitermarkus/mirror/"
name "iConvert"
homepage "http://www.rmartijnr.eu/iconvert.html"
homepage "https://web.archive.org/web/20231002175808/http://www.rmartijnr.eu/iconvert.html"

app "iConvert.app"
deprecate! date: "2016-01-01", because: :discontinued

caveats do
discontinued
end
app "iConvert.app"
end
8 changes: 3 additions & 5 deletions Casks/ihelp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
url "https://github.com/reitermarkus/mirror/raw/HEAD/iHelp.zip",
verified: "github.com/reitermarkus/mirror/"
name "iHelp"
homepage "http://www.rmartijnr.eu/iHelp/index.html"
homepage "https://web.archive.org/web/20231003180144/http://www.rmartijnr.eu/ihelp.html"

app "iHelp.app"
deprecate! date: "2016-01-01", because: :discontinued

caveats do
discontinued
end
app "iHelp.app"
end
8 changes: 3 additions & 5 deletions Casks/ilearn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
url "https://github.com/reitermarkus/mirror/raw/HEAD/iLearn.zip",
verified: "github.com/reitermarkus/mirror/"
name "iLearn"
homepage "http://www.rmartijnr.eu/iLearn/index.html"
homepage "https://web.archive.org/web/20240224113726/http://www.rmartijnr.eu/ilearn.html"

app "iLearn.app"
deprecate! date: "2016-01-01", because: :discontinued

caveats do
discontinued
end
app "iLearn.app"
end
8 changes: 3 additions & 5 deletions Casks/itest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
url "https://github.com/reitermarkus/mirror/raw/HEAD/iTest.zip",
verified: "github.com/reitermarkus/mirror/"
name "iTest"
homepage "http://www.rmartijnr.eu/iTest/index.html"
homepage "https://web.archive.org/web/20230606095017/http://www.rmartijnr.eu/itest.html"

app "iTest.app"
deprecate! date: "2016-01-01", because: :discontinued

caveats do
discontinued
end
app "iTest.app"
end
13 changes: 9 additions & 4 deletions Casks/sheepshaver.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
cask "sheepshaver" do

Check failure on line 1 in Casks/sheepshaver.rb

View workflow job for this annotation

GitHub Actions / test sheepshaver (macos-14, arm)

Version '2.5.20240228' differs from '' retrieved by livecheck.

Check failure on line 1 in Casks/sheepshaver.rb

View workflow job for this annotation

GitHub Actions / test sheepshaver (macos-13, intel)

Version '2.5.20240228' differs from '' retrieved by livecheck.
version "2.4.20140201"
sha256 "545bcd5348c5ce88d18f3f0f01971107472208d1c84361d94c8ce2c238212788"
version "2.5.20240228"
sha256 "07628738b0f62f5f61e7f3312b75b33e421db981674e1fd17b53aee9757edc93"

url "http://www.xs4all.nl/~ronaldpr/sheepshaverforum/SheepShaver_UB_#{version.patch}.zip",
verified: "www.xs4all.nl/~ronaldpr/sheepshaverforum/"
url "https://www.emaculation.com/sheepshaver/SheepShaver_universal_#{version.patch}.zip",
verified: "emaculation.com/sheepshaver/"
name "SheepShaver"
homepage "http://sheepshaver.cebix.net/"

livecheck do
url "https://www.emaculation.com/forum/viewtopic.php?t=7360"
regex(/Version:?\s*(\d+\.\d+).*SheepShaver[._-]?(?:universal[._-]?)?(\d{4})(\d{2})(\d{2})\.zip/)
end

app "SheepShaver_UB_#{version.patch}/SheepShaver.app"
end
4 changes: 2 additions & 2 deletions Casks/ssd-fan-control.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

pkg "SSD Fan Control.pkg"

uninstall pkgutil: "net.exirion.pkg.SSDFanControl",
launchctl: "net.exirion.ssdfanctrl"
uninstall launchctl: "net.exirion.ssdfanctrl",
pkgutil: "net.exirion.pkg.SSDFanControl"
end
Loading