diff --git a/.buildkite/brewfile b/.buildkite/brewfile new file mode 100644 index 000000000..b81c12211 --- /dev/null +++ b/.buildkite/brewfile @@ -0,0 +1,4 @@ +brew "pkg-config" +brew "libxml2" +brew "imagemagick@6" +brew "git-lfs" \ No newline at end of file diff --git a/.buildkite/gem-push.sh b/.buildkite/gem-push.sh new file mode 100755 index 000000000..44999de32 --- /dev/null +++ b/.buildkite/gem-push.sh @@ -0,0 +1,18 @@ +#!/bin/bash -eu + +echo "--- :beer: Installing Dependencies" +brew bundle --file .buildkite/brewfile + +echo "--- :rubygems: Setting up Gems" +install_gems + +echo "--- :hammer: Build Gemspec" +gem build fastlane-plugin-wpmreleasetoolkit.gemspec + +echo "--- :sleuth_or_spy: Validate Gem Install" +gem install --user-install fastlane-plugin-wpmreleasetoolkit-*.gem + +echo "--- :rubygems: Gem Push" +echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >>".gem-credentials" +chmod 600 ".gem-credentials" +gem push --config-file ".gem-credentials" fastlane-plugin-wpmreleasetoolkit-*.gem diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml new file mode 100644 index 000000000..42b75e3c4 --- /dev/null +++ b/.buildkite/pipeline.yml @@ -0,0 +1,77 @@ +# Nodes with values to reuse in the pipeline. +common_params: + plugins: &common_plugins + - &bash_cache automattic/bash-cache#v1.3.2: ~ + env: &common_env + IMAGE_ID: xcode-12.5.1 + +steps: + ################# + # Build and Test + ################# + - label: "🧪 Build and Test" + key: "test" + command: | + echo "--- :beer: Installing Dependencies" + brew bundle --file .buildkite/brewfile + + echo "--- :rubygems: Setting up Gems" + install_gems + + echo "--- :hammer: Build DrawText" + bundle exec rake compile + + echo "--- :git: Setting up git-lfs" + git-lfs install + + echo "--- :rspec: Run Rspec" + bundle exec rspec --profile 10 --format progress + env: *common_env + plugins: *common_plugins + agents: + queue: "mac" + + ################# + # Lint + ################# + - label: "🧹 Lint" + command: | + echo "--- :rubygems: Setting up Gems" + install_gems + + echo "--- :rubocop: Run Rubocop" + bundle exec rubocop + env: *common_env + plugins: *common_plugins + agents: + queue: "mac" + + ################# + # Danger + ################# + - label: "⛔️ Danger" + command: | + echo "--- :rubygems: Setting up Gems" + install_gems + + echo "--- :rubocop: Run Danger" + bundle exec danger + env: *common_env + plugins: *common_plugins + agents: + queue: "mac" + + ################# + # Push to RubyGems + ################# + - label: ":rubygems: Publish to RubyGems" + key: "gem-push" + if: build.tag != null + # Note: We intentionally call a separate `.sh` script here (as opposed to having all the + # commands written inline) to avoid leaking a key used in the process in clear in the + # BUILDKITE_COMMAND environment variable. + command: .buildkite/gem-push.sh + env: *common_env + plugins: *common_plugins + agents: + queue: "mac" diff --git a/.bundle/config b/.bundle/config index 5fc4c9f0e..724931e27 100644 --- a/.bundle/config +++ b/.bundle/config @@ -1,3 +1,3 @@ --- +BUNDLE_PATH: "vendor/bundle" BUNDLE_SPECIFIC_PLATFORM: "false" -BUNDLE_WITH: "test" diff --git a/.circleci/.brewfile b/.circleci/.brewfile deleted file mode 100644 index 5b7ff29d0..000000000 --- a/.circleci/.brewfile +++ /dev/null @@ -1,3 +0,0 @@ -pkg-config -libxml2 -imagemagick@6 \ No newline at end of file diff --git a/.circleci/cache-version b/.circleci/cache-version deleted file mode 100644 index fc10ecf80..000000000 --- a/.circleci/cache-version +++ /dev/null @@ -1,2 +0,0 @@ -# To invalidate the cache, generate a new UUID using `uuidgen` on the command line then paste it here -24D38297-3B05-4032-96E8-4D606515BAC1 \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index d6d2f932c..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,100 +0,0 @@ -version: 2.1 - -orbs: - ios: wordpress-mobile/ios@1.0 - -# Common steps reused on various jobs -commands: - setup_tools: - description: "Install Homebrew and Ruby dependencies" - parameters: - skip_brew_install: - type: boolean - default: false - steps: - - restore_cache: - name: Restore Homebrew + Ruby Dependencies - keys: - - &cache_key brew-dependencies-{{ checksum ".circleci/cache-version" }}-{{ checksum ".circleci/.brewfile" }}-{{ checksum "Gemfile.lock" }} - - unless: - condition: <> - steps: - - run: - name: Install Homebrew dependencies, if neeeded - command: | - # Because the CircleCI image uses shallow clones, we need to unshallow them first. See https://bit.ly/3vx6EAL - git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow - git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow - brew update && xargs brew install --verbose < .circleci/.brewfile - - run: - name: Install Ruby dependencies, if neeeded - command: bundle check --path vendor/bundle || bundle install - - save_cache: - name: Cache Homebrew + Ruby Dependencies - key: *cache_key - paths: - - vendor/ - - /usr/local/Cellar - -jobs: - test: - executor: - name: ios/default - xcode-version: "11.2.1" - environment: - HOMEBREW_NO_AUTO_UPDATE: 1 - PKG_CONFIG_PATH: "/usr/local/opt/imagemagick@6/lib/pkgconfig" - steps: - - checkout - - setup_tools - - run: # Compile drawText - name: Compile drawText - command: bundle exec rake compile - - run: - name: Run rspec and upload coverage report - command: | - bundle exec rspec --profile 10 \ - --format RspecJunitFormatter \ - --out test_results/rspec.xml \ - --format progress \ - $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings) - # Save test results for timing analysis - - store_test_results: - path: test_results - - # Coverage reports are sent to Codecov as part of running `rspec`, not as a CircleCI step. - # We may wish to change this for consistency. - - gem-push: - executor: - name: ios/default - xcode-version: "11.2.1" # We need an Xcode-enabled CI image to build drawText during gem build - steps: - - checkout - - setup_tools: - skip_brew_install: true - - run: - name: Build gem - command: gem build fastlane-plugin-wpmreleasetoolkit.gemspec - - run: - name: Check the gem is installable - command: gem install --user-install fastlane-plugin-wpmreleasetoolkit-*.gem - - run: - name: Push to RubyGems - command: | - echo ":rubygems_api_key: ${GEM_HOST_API_KEY}" >>"$HOME/.gem/credentials" - chmod 600 "$HOME/.gem/credentials" - gem push fastlane-plugin-wpmreleasetoolkit-*.gem - -workflows: - test: - jobs: - - test - release: - jobs: - - gem-push: - filters: - tags: - only: /.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 1d9e3d7d9..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Danger -on: - pull_request: - types: [opened, reopened, synchronize] - -jobs: - danger: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 150 - - # This action reads the Ruby version from .ruby-version - - uses: ruby/setup-ruby@v1 - - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - - name: Install Gems - run: | - bundle config path vendor/bundle - BUNDLE_WITHOUT=test bundle install --jobs 4 --retry 3 - - - name: Run Danger - run: bundle exec danger - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index fa3db3f51..fdf34b19f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ _None_ ### Internal Changes -_None_ +- Replace CircleCI and GitHub Actions with Buildkite ## 2.0.0 diff --git a/Gemfile b/Gemfile index 3e5adfe1a..8bc3507e5 100644 --- a/Gemfile +++ b/Gemfile @@ -5,12 +5,9 @@ gemspec gem 'danger', '~> 8.0' gem 'danger-rubocop', '~> 0.6' -group :test do - gem 'codecov', require: false - gem 'rspec' - gem 'webmock', require: false, group: :test - gem 'yard' -end +gem 'codecov', require: false +gem 'webmock', require: false +gem 'yard' plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock index 0c2e14f4e..51c8b60d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -416,7 +416,9 @@ DEPENDENCIES fastlane-plugin-wpmreleasetoolkit! pry (~> 0.12.2) rmagick (~> 4.1) - rspec + rspec (~> 3.8) + rspec-expectations (~> 3.8) + rspec-mocks (~> 3.8) rspec_junit_formatter (~> 0.4.1) rubocop (~> 1.0) rubocop-require_tools (~> 0.1.2) @@ -426,4 +428,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.2.25 + 2.2.27 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a30e654b0..9fc311a64 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,7 @@ require 'simplecov' require 'codecov' +require 'webmock/rspec' # SimpleCov.minimum_coverage 95 SimpleCov.start