GitHub Actions CI

Try to setup GitHub Actions CI.
This commit is contained in:
Mike McQuaid 2019-08-19 08:48:05 +01:00
parent 86538a444a
commit 67f960ba67
4 changed files with 50 additions and 32 deletions

38
.github/workflows/tests.yml vendored Normal file
View 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 }}

View File

@ -4,16 +4,24 @@ sut:
- sh - sh
- -xc - -xc
- | - |
sudo -E -u linuxbrew /home/linuxbrew/.linuxbrew/bin/brew test-bot /home/linuxbrew/.linuxbrew/bin/brew test-bot
status=$$? status=$$?
cp brew-test-bot.xml /tmp/test-bot/
exit $$status exit $$status
environment: 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_REASON
- BUILD_REPOSITORY_URI - BUILD_REPOSITORY_URI
- BUILD_SOURCEVERSION - BUILD_SOURCEVERSION
- HOMEBREW_GITHUB_API_TOKEN
- SYSTEM_PULLREQUEST_PULLREQUESTNUMBER - SYSTEM_PULLREQUEST_PULLREQUESTNUMBER
- SYSTEM_PULLREQUEST_TARGETBRANCH - SYSTEM_PULLREQUEST_TARGETBRANCH
- TF_BUILD - TF_BUILD
# GitHub API
- HOMEBREW_GITHUB_API_TOKEN

View File

@ -27,11 +27,6 @@ if ENV["HOMEBREW_TESTS_COVERAGE"]
ENV["COVERALLS_REPO_TOKEN"] = ENV["HOMEBREW_COVERALLS_REPO_TOKEN"] ENV["COVERALLS_REPO_TOKEN"] = ENV["HOMEBREW_COVERALLS_REPO_TOKEN"]
end end
if ENV["HOMEBREW_AZURE_PIPELINES"]
require "simplecov-cobertura"
formatters << SimpleCov::Formatter::CoberturaFormatter
end
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters) SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)
end end

View File

@ -15,22 +15,6 @@ jobs:
displayName: Run brew test-bot displayName: Run brew test-bot
env: env:
HOMEBREW_GITHUB_API_TOKEN: $(github.publicApiToken) 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 - job: Linux
pool: pool:
@ -43,10 +27,3 @@ jobs:
displayName: Run brew test-bot 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
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: $(Build.ArtifactStagingDirectory)/brew-test-bot.xml