Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .buildkite/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3'
services:
app:
build:
context: ../
dockerfile: Dockerfile.test
args:
# Overridden per-step via the RUBY_VERSION env var (see pipeline.yml's
# test matrix). Defaults to 3.4 for the Sorbet and Rubocop steps.
RUBY_VERSION: ${RUBY_VERSION:-3.4}
environment:
BUILDKITE:
BUILDKITE_AGENT_ACCESS_TOKEN:
BUILDKITE_BRANCH:
BUILDKITE_BUILD_ID:
BUILDKITE_BUILD_NUMBER:
BUILDKITE_BUILD_URL:
BUILDKITE_COMMIT:
BUILDKITE_JOB_ID:
BUILDKITE_PIPELINE_SLUG:
BUILDKITE_PULL_REQUEST:
BUILDKITE_PULL_REQUEST_BASE_BRANCH:
BUILDKITE_REPO:
36 changes: 36 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
steps:
- name: ':sorbet: Sorbet'
command: bundle exec srb tc
plugins:
- docker-compose#v5.6.0:
run: app
config: .buildkite/docker-compose.yml

- name: ':rubocop: Rubocop'
command: bundle exec rubocop
plugins:
- docker-compose#v5.6.0:
run: app
config: .buildkite/docker-compose.yml

# Tests run against every supported Ruby (matches the gemspec's
# `required_ruby_version >= 3.3` and the old GitHub Actions matrix). The
# matrix value is exported as RUBY_VERSION so docker-compose builds the
# image on that Ruby (see the build arg in docker-compose.yml).
- name: ':minitest: Tests (Ruby {{matrix}})'
command: bundle exec rake test
env:
RUBY_VERSION: '{{matrix}}'
matrix:
- '3.3'
- '3.4'
- '4.0'
plugins:
- docker-compose#v5.6.0:
run: app
config: .buildkite/docker-compose.yml

# NOTE: gem publishing is intentionally NOT handled here. It currently lives in
# .github/workflows/cd.yml. Moving releases to Buildkite would require a
# `wait` + publish step with credentials available only on dedicated agents,
# so it is left out of this pipeline.
10 changes: 6 additions & 4 deletions .github/workflows/dependabot-tapioca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
bundler-cache: true
- name: Regenerate gem RBIs
run: bundle exec tapioca gems
- name: Commit, push, and type-check updated RBIs
- name: Commit and push updated RBIs
run: |
if [[ -z "$(git status --porcelain sorbet/rbi)" ]]; then
echo "No RBI changes to commit."
Expand All @@ -33,7 +33,9 @@ jobs:
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add sorbet/rbi
git commit -m "Regenerate gem RBIs [dependabot skip]"
# Buildkite builds this commit via its GitHub webhook integration
# regardless of the pushing credential, so Sorbet, Rubocop, and the
# tests all run against the RBI commit. (GitHub Actions would ignore
# a GITHUB_TOKEN push here — that recursion guard does not apply to
# Buildkite.)
git push
# The push above uses GITHUB_TOKEN, which doesn't re-trigger CI.
# RBI changes only affect Sorbet, so type-check them here instead.
bundle exec srb tc
36 changes: 36 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Test image for the Buildkite pipeline. RUBY_VERSION is supplied as a build
# arg by .buildkite/docker-compose.yml (defaults to 3.4; the test matrix
# overrides it to 3.3 / 3.4 / 4.0).
ARG RUBY_VERSION=3.4
FROM ruby:${RUBY_VERSION}

# packwerk shells out to ripgrep to resolve files, so it must be on PATH.
RUN apt-get update && \
apt-get install -y --no-install-recommends ripgrep && \
rm -rf /var/lib/apt/lists/*

# Set up the buildkite-agent user/group the docker-compose plugin runs as.
RUN groupadd -r buildkite-agent && \
useradd -u 9999 -r -g buildkite-agent buildkite-agent && \
mkdir -p /home/buildkite-agent

ENV APP_HOME=/var/www
WORKDIR $APP_HOME

# Pin Bundler to match Gemfile.lock's `BUNDLED WITH` so no version swap happens
# at runtime. `--default` replaces the base image's preinstalled Bundler.
ENV BUNDLER_VERSION=4.0.7
RUN gem install bundler --version 4.0.7 --default

# Install dependencies first so the bundle layer caches across source changes.
# The gemspec hardcodes its version and globs files with Dir[...], so it loads
# fine with only the Gemfile and gemspec present.
COPY Gemfile* packwerk-extensions.gemspec $APP_HOME/
RUN bundle install

# Add the rest of the source now that dependencies are installed.
COPY . $APP_HOME

RUN chown -R buildkite-agent:buildkite-agent $APP_HOME /home/buildkite-agent

USER buildkite-agent