GitHub Actions CI
Try to setup GitHub Actions CI.
This commit is contained in:
parent
86538a444a
commit
67f960ba67
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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -15,22 +15,6 @@ jobs:
|
||||
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:
|
||||
@ -43,10 +27,3 @@ jobs:
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user