Cleanup Travis and CI configuration.

Use the environment variables set by `brew test-bot`. Eventually we'll
disable Travis CI running CodeCov so move `TRAVIS` references to
`HOMEBREW_TRAVIS_CI` so it doesn't need whitelisted.

Also, fix `azure-pipelines.yml` so it's testing the correct version of
Homebrew/brew (the one checked out in the `pwd`).
This commit is contained in:
Mike McQuaid 2018-09-19 14:45:06 +01:00
parent d8f53486f5
commit 59c858a8e8
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
5 changed files with 25 additions and 11 deletions

View File

@ -74,7 +74,7 @@ module Homebrew
# `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew # `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew
# repository. This only needs to support whatever CI provider # repository. This only needs to support whatever CI provider
# Homebrew/brew is currently using. # Homebrew/brew is currently using.
return if ENV["TRAVIS"] return if ENV["HOMEBREW_TRAVIS_CI"]
message = <<~EOS message = <<~EOS
Your Xcode (#{MacOS::Xcode.version}) is outdated. Your Xcode (#{MacOS::Xcode.version}) is outdated.
@ -101,7 +101,7 @@ module Homebrew
# `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew # `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew
# repository. This only needs to support whatever CI provider # repository. This only needs to support whatever CI provider
# Homebrew/brew is currently using. # Homebrew/brew is currently using.
return if ENV["TRAVIS"] return if ENV["HOMEBREW_TRAVIS_CI"]
<<~EOS <<~EOS
A newer Command Line Tools release is available. A newer Command Line Tools release is available.

View File

@ -729,7 +729,7 @@ class FormulaInstaller
Utils.safe_fork do Utils.safe_fork do
# Invalidate the current sudo timestamp in case a build script calls sudo. # Invalidate the current sudo timestamp in case a build script calls sudo.
# Travis CI's Linux sudoless workers have a weird sudo that fails here. # Travis CI's Linux sudoless workers have a weird sudo that fails here.
system "/usr/bin/sudo", "-k" unless ENV["TRAVIS_SUDO"] == "false" system "/usr/bin/sudo", "-k" if ENV["HOMEBREW_TRAVIS_SUDO"] != "false"
if Sandbox.formula?(formula) if Sandbox.formula?(formula)
sandbox = Sandbox.new sandbox = Sandbox.new

View File

@ -1,10 +1,14 @@
if ENV["HOMEBREW_TESTS_COVERAGE"] if ENV["HOMEBREW_TESTS_COVERAGE"]
require "simplecov" require "simplecov"
if ENV["CODECOV_TOKEN"] || ENV["TRAVIS"] formatters = [SimpleCov::Formatter::HTMLFormatter]
if ENV["HOMEBREW_CODECOV_TOKEN"] || ENV["HOMEBREW_TRAVIS_CI"]
require "codecov" require "codecov"
SimpleCov.formatter = SimpleCov::Formatter::Codecov formatters << SimpleCov::Formatter::Codecov
ENV["CODECOV_TOKEN"] = ENV["HOMEBREW_CODECOV_TOKEN"]
end end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)
end end
require "rspec/its" require "rspec/its"

View File

@ -32,7 +32,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)
args << "--fail" args << "--fail"
args << "--progress-bar" unless ARGV.verbose? args << "--progress-bar" unless ARGV.verbose?
args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
args << "--silent" if !$stdout.tty? || ENV["TRAVIS"] args << "--silent" if !$stdout.tty? || ENV["HOMEBREW_TRAVIS_CI"]
end end
args + extra_args args + extra_args

View File

@ -4,18 +4,28 @@ jobs:
vmImage: xcode9-macos10.13 vmImage: xcode9-macos10.13
steps: steps:
- bash: | - bash: |
rm -rf /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask* HOMEBREW_REPOSITORY="$(brew --repo)";
brew update-reset mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library";
brew test-bot sudo rm -rf "$HOMEBREW_REPOSITORY";
displayName: brew test-bot sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY";
brew update-reset Library/Taps/homebrew/homebrew-core
brew test-bot --coverage
displayName: Run brew test-bot
env: env:
HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken) HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken)
- task: PublishTestResults@2
displayName: Publish test-bot test results
inputs:
testRunner: JUnit
testResultsFiles: brew-test-bot.xml
- job: Linux - job: Linux
pool: pool:
vmImage: ubuntu-16.04 vmImage: ubuntu-16.04
steps: steps:
- bash: | - bash: |
"$PWD/bin/brew" test-bot "$PWD/bin/brew" test-bot
displayName: brew test-bot displayName: Run brew test-bot
env: env:
HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken) HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken)