[CI] Run tests for individual gems in GitHub Actions #1084
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Gem Tests" | |
on: | |
- "pull_request" | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby-version: | |
- "3.2" | |
gem: | |
- "bullet_train" | |
- "bullet_train-api" | |
- "bullet_train-fields" | |
- "bullet_train-has_uuid" | |
- "bullet_train-incoming_webhooks" | |
- "bullet_train-integrations" | |
- "bullet_train-integrations-stripe" | |
- "bullet_train-obfuscates_id" | |
- "bullet_train-outgoing_webhooks" | |
- "bullet_train-roles" | |
- "bullet_train-scope_questions" | |
- "bullet_train-scope_validator" | |
- "bullet_train-sortable" | |
- "bullet_train-super_load_and_authorize_resource" | |
- "bullet_train-super_scaffolding" | |
- "bullet_train-themes" | |
- "bullet_train-themes-light" | |
- "bullet_train-themes-tailwind_css" | |
name: ${{ format('{0} / {1}', matrix.gem, matrix.ruby-version) }} | |
runs-on: "ubuntu-latest" | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 2s | |
--health-timeout 2s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
env: | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
RAILS_ENV: test | |
defaults: | |
run: | |
working-directory: ${{ matrix.gem }} | |
steps: | |
- uses: "actions/checkout@v3" | |
- name: Install PostgreSQL client | |
run: sudo apt-get -yqq install libpq-dev | |
# - name: "Use latest gems" | |
# run: rm Gemfile.lock | |
#- name: Configure bundler | |
## We have to do this so that bundler doesn't complain about a frozen lockfile after we bump the gem versions | |
#run: bundle config set --local deployment false | |
- uses: "ruby/setup-ruby@v1" | |
with: | |
rubygems: latest | |
bundler: latest | |
# If we use the cache ruby/setup always assumes our lockfile should be frozen, and it is not | |
bundler-cache: false | |
ruby-version: ${{ matrix.ruby-version }} | |
working-directory: ${{ matrix.gem }} # setup-ruby does't pick up the job default. | |
- run: bundle install | |
- run: bin/rails db:setup | |
if: ${{ hashFiles(format('{0}/test/dummy/db/schema.rb', matrix.gem)) != '' }} | |
continue-on-error: true | |
- name: Run Tests | |
run: bin/rails test |