cask: fewer GitHub Actions warnings.

- don't care about no checksums being defined for official casks
- don't complain about Gatekeeper being disabled on GitHub Actions as
  it's been globally disabled for the team
This commit is contained in:
Mike McQuaid 2024-12-30 12:55:30 +00:00
parent 882bb52d1a
commit d490692b26
No known key found for this signature in database
3 changed files with 15 additions and 4 deletions

View File

@ -82,7 +82,8 @@ module Cask
sig { override.params(filename: Pathname).void }
def verify_download_integrity(filename)
if @cask.sha256 == :no_check
official_cask_tap = @cask.tap&.official?
if @cask.sha256 == :no_check && !official_cask_tap
opoo "No checksum defined for cask '#{@cask}', skipping verification."
return
end

View File

@ -107,7 +107,8 @@ module Cask
backup if force? && @cask.staged_path.exist? && @cask.metadata_versioned_path.exist?
oh1 "Installing Cask #{Formatter.identifier(@cask)}"
opoo "macOS's Gatekeeper has been disabled for this Cask" unless quarantine?
# GitHub Actions globally disables Gatekeeper.
opoo "macOS's Gatekeeper has been disabled for this Cask" if !quarantine? && !GitHub::Actions.env_set?
stage
@cask.config = @cask.default_config.merge(old_config)

View File

@ -4,7 +4,8 @@ RSpec.describe Cask::Download, :cask do
describe "#verify_download_integrity" do
subject(:verification) { described_class.new(cask).verify_download_integrity(downloaded_path) }
let(:cask) { instance_double(Cask::Cask, token: "cask", sha256: expected_sha256) }
let(:tap) { nil }
let(:cask) { instance_double(Cask::Cask, token: "cask", sha256: expected_sha256, tap:) }
let(:cafebabe) { "cafebabecafebabecafebabecafebabecafebabecafebabecafebabecafebabe" }
let(:deadbeef) { "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" }
let(:computed_sha256) { cafebabe }
@ -17,9 +18,17 @@ RSpec.describe Cask::Download, :cask do
context "when the expected checksum is :no_check" do
let(:expected_sha256) { :no_check }
it "skips the check" do
it "warns about skipping the check" do
expect { verification }.to output(/skipping verification/).to_stderr
end
context "with an official tap" do
let(:tap) { CoreCaskTap.instance }
it "does not warn about skipping the check" do
expect { verification }.not_to output(/skipping verification/).to_stderr
end
end
end
context "when expected and computed checksums match" do