From 73de7f9f971a0099a19f10f1bd6e2ac99e4a76f0 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 19 Nov 2024 04:38:44 +0000 Subject: [PATCH] Update `ci.yml`. --- .github/workflows/ci.yml | 51 ++++++++++++---------------------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b72f69c..229a53d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,15 +56,18 @@ jobs: - name: Generate CI matrix id: generate-matrix + env: + INPUT_CASKS: ${{ github.event.inputs.casks }} run: | 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 }} + # shellcheck disable=SC2086 # $INPUT_CASKS is a space-separated list of cask tokens + brew generate-cask-ci-matrix ${{ github.event.inputs.skip_install && '--skip-install' }} ${{ github.event.inputs.new_cask && '--new' }} --casks $INPUT_CASKS elif [[ "${GITHUB_EVENT_NAME}" == "push" ]] then - brew ruby -- "$(brew --repository homebrew/cask)/cmd/lib/generate-matrix.rb" --syntax-only + brew generate-cask-ci-matrix --url --syntax-only "${{ github.event.pull_request.url }}" else - brew ruby -- "$(brew --repository homebrew/cask)/cmd/lib/generate-matrix.rb" --url="${{ github.event.pull_request.url }}" + brew generate-cask-ci-matrix --url "${{ github.event.pull_request.url }}" fi test: @@ -97,32 +100,8 @@ jobs: persist-credentials: false - name: Clean up CI machine - run: | - 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 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." - fi - - if ! rm /usr/local/bin/pod; then - echo "::warning::Removing \`cocoapods\` symlink is no longer necessary." - fi - - 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' + run: brew test-bot --cleanup --only-cleanup-before - name: Cache Homebrew Gems id: cache @@ -175,10 +154,11 @@ jobs: cask = Cask::CaskLoader.load('${{ matrix.cask.path }}') - was_installed = cask.installed? - manual_installer = cask.artifacts.any? { |artifact| - artifact.is_a?(Cask::Artifact::Installer::ManualInstaller) - } + manual_installer = cask.artifacts.any? do |artifact| + if defined?(artifact.manual_install) + artifact.manual_install + end + end macos_requirement_satisfied = if macos_requirement = cask.depends_on.macos macos_requirement.satisfied? @@ -196,7 +176,6 @@ jobs: formula_dependencies = cask_and_formula_dependencies.select { |d| d.is_a?(Formula) }.map(&:full_name) 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)}" @@ -219,10 +198,10 @@ jobs: if: always() && steps.info.outcome == 'success' && join(fromJSON(steps.info.outputs.cask_conflicts)) != '' timeout-minutes: 30 - - name: Run brew uninstall --cask --zap ${{ matrix.cask.token }} + - name: Run brew uninstall --cask --force --zap ${{ matrix.cask.token }} run: | - brew uninstall --cask --zap '${{ matrix.cask.path }}' - if: always() && steps.info.outcome == 'success' && fromJSON(steps.info.outputs.was_installed) + brew uninstall --cask --force --zap '${{ matrix.cask.path }}' + if: always() && steps.info.outcome == 'success' timeout-minutes: 30 - name: Take snapshot of installed and running apps and services