Merge branch 'master' into man-page-text
This commit is contained in:
commit
c1960b2fd6
38
.github/workflows/tests.yml
vendored
Normal file
38
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: GitHub Actions CI
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request: []
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Set up Git repository
|
||||
uses: actions/checkout@master
|
||||
|
||||
- name: Set up Homebrew
|
||||
run: |
|
||||
HOMEBREW_REPOSITORY="$(brew --repo)"
|
||||
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
||||
sudo rm -rf "$HOMEBREW_REPOSITORY"
|
||||
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY"
|
||||
brew update-reset Library/Taps/homebrew/homebrew-core
|
||||
if: matrix.os == 'macOS-latest'
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker-compose -f Dockerfile.yml build sut
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
|
||||
- name: Run brew test-bot
|
||||
run: |
|
||||
if [ "$RUNNER_OS" = "Linux" ]; then
|
||||
docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut
|
||||
else
|
||||
brew test-bot
|
||||
fi
|
||||
env:
|
||||
HOMEBREW_COVERALLS_REPO_TOKEN: ${{ secrets.HOMEBREW_COVERALLS_REPO_TOKEN }}
|
||||
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -4,16 +4,24 @@ sut:
|
||||
- sh
|
||||
- -xc
|
||||
- |
|
||||
sudo -E -u linuxbrew /home/linuxbrew/.linuxbrew/bin/brew test-bot
|
||||
/home/linuxbrew/.linuxbrew/bin/brew test-bot
|
||||
status=$$?
|
||||
cp brew-test-bot.xml /tmp/test-bot/
|
||||
exit $$status
|
||||
environment:
|
||||
- HOME=/home/linuxbrew
|
||||
# GitHub Actions
|
||||
- GITHUB_ACTIONS
|
||||
- GITHUB_BASE_REF
|
||||
- GITHUB_EVENT_NAME
|
||||
- GITHUB_REF
|
||||
- GITHUB_REPOSITORY
|
||||
- GITHUB_SHA
|
||||
- HEAD_GITHUB_REF
|
||||
# Azure Pipelines
|
||||
- BUILD_REASON
|
||||
- BUILD_REPOSITORY_URI
|
||||
- BUILD_SOURCEVERSION
|
||||
- HOMEBREW_GITHUB_API_TOKEN
|
||||
- SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
|
||||
- SYSTEM_PULLREQUEST_TARGETBRANCH
|
||||
- TF_BUILD
|
||||
# GitHub API
|
||||
- HOMEBREW_GITHUB_API_TOKEN
|
||||
|
@ -46,19 +46,24 @@ module Homebrew
|
||||
Utils.popen_read("git", "rev-list", "-n1", "--before=#{date}", "origin/master").chomp
|
||||
elsif args.to_tag?
|
||||
tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname")
|
||||
previous_tag = tags.lines.second
|
||||
previous_tag ||= begin
|
||||
if (HOMEBREW_REPOSITORY/".git/shallow").exist?
|
||||
if tags.blank?
|
||||
tags = if (HOMEBREW_REPOSITORY/".git/shallow").exist?
|
||||
safe_system "git", "fetch", "--tags", "--depth=1"
|
||||
tags = Utils.popen_read("git", "tag", "--list", "--sort=-version:refname")
|
||||
Utils.popen_read("git", "tag", "--list", "--sort=-version:refname")
|
||||
elsif OS.linux?
|
||||
tags = Utils.popen_read("git tag --list | sort -rV")
|
||||
Utils.popen_read("git tag --list | sort -rV")
|
||||
end
|
||||
tags.lines.second
|
||||
end
|
||||
current_tag, previous_tag, = tags.lines
|
||||
current_tag = current_tag.to_s.chomp
|
||||
odie "Could not find current tag in:\n#{tags}" if current_tag.empty?
|
||||
# ^0 ensures this points to the commit rather than the tag object.
|
||||
end_commit = "#{current_tag}^0"
|
||||
|
||||
previous_tag = previous_tag.to_s.chomp
|
||||
odie "Could not find previous tag in:\n#{tags}" if previous_tag.empty?
|
||||
previous_tag
|
||||
# ^0 ensures this points to the commit rather than the tag object.
|
||||
"#{previous_tag}^0"
|
||||
else
|
||||
Utils.popen_read("git", "rev-parse", "origin/master").chomp
|
||||
end
|
||||
@ -67,8 +72,13 @@ module Homebrew
|
||||
start_commit = Utils.popen_read("git", "rev-parse", start_commit).chomp
|
||||
odie "Could not find start commit!" if start_commit.empty?
|
||||
|
||||
end_commit = Utils.popen_read("git", "rev-parse", "HEAD").chomp
|
||||
end_commit ||= "HEAD"
|
||||
end_commit = Utils.popen_read("git", "rev-parse", end_commit).chomp
|
||||
odie "Could not find end commit!" if end_commit.empty?
|
||||
|
||||
if Utils.popen_read("git", "branch", "--list", "master").blank?
|
||||
safe_system "git", "branch", "master", "origin/master"
|
||||
end
|
||||
end
|
||||
|
||||
puts "Start commit: #{start_commit}"
|
||||
@ -80,10 +90,12 @@ module Homebrew
|
||||
|
||||
oh1 "Setup test environment..."
|
||||
# copy Homebrew installation
|
||||
safe_system "git", "clone", "--local", "#{HOMEBREW_REPOSITORY}/.git", "."
|
||||
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", ".",
|
||||
"--local", "--branch", "master", "--single-branch"
|
||||
|
||||
# set git origin to another copy
|
||||
safe_system "git", "clone", "--local", "--bare", "#{HOMEBREW_REPOSITORY}/.git", "remote.git"
|
||||
safe_system "git", "clone", "#{HOMEBREW_REPOSITORY}/.git", "remote.git",
|
||||
"--local", "--bare", "--branch", "master", "--single-branch"
|
||||
safe_system "git", "config", "remote.origin.url", "#{curdir}/remote.git"
|
||||
|
||||
# force push origin to end_commit
|
||||
@ -100,7 +112,7 @@ module Homebrew
|
||||
oh1 "Running brew update..."
|
||||
safe_system "brew", "update", "--verbose"
|
||||
actual_end_commit = Utils.popen_read("git", "rev-parse", branch).chomp
|
||||
if start_commit != end_commit && start_commit == actual_end_commit
|
||||
if actual_end_commit != end_commit
|
||||
raise <<~EOS
|
||||
brew update didn't update #{branch}!
|
||||
Start commit: #{start_commit}
|
||||
@ -110,6 +122,6 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
ensure
|
||||
FileUtils.rm_r "update-test" unless args.keep_tmp?
|
||||
FileUtils.rm_rf "update-test" unless args.keep_tmp?
|
||||
end
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ module Homebrew
|
||||
# `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew
|
||||
# repository. This only needs to support whatever CI providers
|
||||
# Homebrew/brew is currently using.
|
||||
return if ENV["HOMEBREW_AZURE_PIPELINES"] || ENV["HOMEBREW_GITHUB_ACTIONS"]
|
||||
return if ENV["HOMEBREW_GITHUB_ACTIONS"]
|
||||
|
||||
message = <<~EOS
|
||||
Your Xcode (#{MacOS::Xcode.version}) is outdated.
|
||||
@ -99,7 +99,7 @@ module Homebrew
|
||||
# `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew
|
||||
# repository. This only needs to support whatever CI providers
|
||||
# Homebrew/brew is currently using.
|
||||
return if ENV["HOMEBREW_AZURE_PIPELINES"] || ENV["HOMEBREW_GITHUB_ACTIONS"]
|
||||
return if ENV["HOMEBREW_GITHUB_ACTIONS"]
|
||||
|
||||
<<~EOS
|
||||
A newer Command Line Tools release is available.
|
||||
|
@ -27,11 +27,6 @@ if ENV["HOMEBREW_TESTS_COVERAGE"]
|
||||
ENV["COVERALLS_REPO_TOKEN"] = ENV["HOMEBREW_COVERALLS_REPO_TOKEN"]
|
||||
end
|
||||
|
||||
if ENV["HOMEBREW_AZURE_PIPELINES"]
|
||||
require "simplecov-cobertura"
|
||||
formatters << SimpleCov::Formatter::CoberturaFormatter
|
||||
end
|
||||
|
||||
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)
|
||||
end
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
jobs:
|
||||
- job: macOS
|
||||
pool:
|
||||
vmImage: macOS-10.14
|
||||
steps:
|
||||
- bash: |
|
||||
set -e
|
||||
sudo xcode-select --switch /Applications/Xcode_10.2.app/Contents/Developer
|
||||
HOMEBREW_REPOSITORY="$(brew --repo)"
|
||||
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
||||
sudo rm -rf "$HOMEBREW_REPOSITORY"
|
||||
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY"
|
||||
brew update-reset Library/Taps/homebrew/homebrew-core
|
||||
brew test-bot
|
||||
displayName: Run brew test-bot
|
||||
env:
|
||||
HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken)
|
||||
HOMEBREW_COVERALLS_REPO_TOKEN: $(coveralls.homebrewBrewApiToken)
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish test-bot test results
|
||||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
testRunner: JUnit
|
||||
testResultsFiles: brew-test-bot.xml
|
||||
|
||||
- task: PublishCodeCoverageResults@1
|
||||
displayName: Publish brew tests code coverage
|
||||
inputs:
|
||||
codeCoverageTool: Cobertura
|
||||
summaryFileLocation: $(Build.SourcesDirectory)/coverage/coverage.xml
|
||||
reportDirectory: $(Build.SourcesDirectory)/coverage
|
||||
failIfCoverageEmpty: true
|
||||
|
||||
- job: Linux
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- bash: docker-compose -f Dockerfile.yml build sut
|
||||
displayName: Build Docker image
|
||||
|
||||
- bash: docker-compose -f Dockerfile.yml run --rm -v $(Build.ArtifactStagingDirectory):/tmp/test-bot sut
|
||||
displayName: Run brew test-bot
|
||||
env:
|
||||
HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken)
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: Publish test-bot test results
|
||||
condition: succeededOrFailed()
|
||||
inputs:
|
||||
testRunner: JUnit
|
||||
testResultsFiles: $(Build.ArtifactStagingDirectory)/brew-test-bot.xml
|
5
bin/brew
5
bin/brew
@ -65,8 +65,9 @@ do
|
||||
export "$VAR_NEW"="${!VAR}"
|
||||
done
|
||||
|
||||
# Set CI variable for Azure Pipelines, Jenkins.
|
||||
if [[ -n "$TF_BUILD" || -n "$JENKINS_HOME" ]]
|
||||
# Set CI variable for GitHub Actions, Azure Pipelines, Jenkins
|
||||
# (Set by default on Circle and Travis CI)
|
||||
if [[ -n "$GITHUB_ACTIONS" || -n "$TF_BUILD" || -n "$JENKINS_HOME" ]]
|
||||
then
|
||||
export CI="1"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user