From 67f960ba67084f180326e055e13faaef2f028a35 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 19 Aug 2019 08:48:05 +0100 Subject: [PATCH] GitHub Actions CI Try to setup GitHub Actions CI. --- .github/workflows/tests.yml | 38 ++++++++++++++++++++++++++++ Dockerfile.yml | 16 +++++++++--- Library/Homebrew/test/spec_helper.rb | 5 ---- azure-pipelines.yml | 23 ----------------- 4 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000000..f95ac9fc08 --- /dev/null +++ b/.github/workflows/tests.yml @@ -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 }} diff --git a/Dockerfile.yml b/Dockerfile.yml index e672123b73..b147f7c74b 100644 --- a/Dockerfile.yml +++ b/Dockerfile.yml @@ -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 diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 8388cfc9e3..1ded62cb16 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -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 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 30bbdd14f3..c7c4eb9c76 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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