Skip to content

GoodJob.cleanup_preserved_jobs: add :include_discarded option #3274

GoodJob.cleanup_preserved_jobs: add :include_discarded option

GoodJob.cleanup_preserved_jobs: add :include_discarded option #3274

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
steps:
- name: Checkout code
uses: actions/checkout@v4
# Dependencies
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
# Lint
- name: Run linter
run: bin/lint --nofix
development_environment:
name: Development Environment
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PGHOST: localhost
PGUSER: good_job
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
DISABLE_SPRING: 1
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: good_job
POSTGRES_DB: good_job_test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports: [ "5432:5432" ]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
# Dependencies
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
# Validate Development Environment
- name: bin/setup
run: bin/rails db:test:prepare
- name: bin/rspec
run: bin/rspec --require ./spec/support/pre_documentation_formatter.rb --format PreDocumentationFormatter
# Archive
- name: Archive system spec screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots-devenv
path: |
demo/tmp/screenshots
demo/tmp/capybara
- name: Archive Rails logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: rails_logs-devenv
path: demo/log
test:
name: Test - ${{ matrix.gemfile }} - Ruby ${{ matrix.ruby }} - PG ${{ matrix.pg }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
ruby: ["3.0", 3.1, 3.2, 3.3]
gemfile: [rails_6.1, rails_7.0, rails_7.1, rails_7.2, rails_8.0, rails_head]
pg: [17]
include:
- ruby: 3.3
gemfile: rails_7.2
pg: 10
exclude:
# Rails 7.2 is >= 3.1
- ruby: "3.0"
gemfile: rails_7.2
# Rails 8.0 is >= 3.2
- ruby: "3.0"
gemfile: rails_8.0
- ruby: 3.1
gemfile: rails_8.0
# Rails head is >= 3.2
- ruby: "3.0"
gemfile: rails_head
- ruby: 3.1
gemfile: rails_head
env:
PGHOST: localhost
PGUSER: good_job
RAILS_ENV: test
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
BUNDLE_WITHOUT: debug:lint:demo:production
RAILS_LOG_TO_STDOUT: false
services:
postgres:
image: postgres:${{ matrix.pg }}
env:
POSTGRES_USER: good_job
POSTGRES_DB: good_job_test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: Checkout code
uses: actions/checkout@v4
- name: Update .ruby-version with matrix value
run: echo "${{ matrix.ruby }}" >| .ruby-version
# Dependencies
- name: Set up Ruby and bundle install
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
- name: Print Lockfile
run: cat ${{ env.BUNDLE_GEMFILE }}.lock
# Test
- name: Set up test database
run: bundle exec demo/bin/rails db:test:prepare
- name: Run Unit tests
run: |
bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb, spec/generators/**/*_spec.rb" \
--require ./spec/support/pre_documentation_formatter.rb \
--format PreDocumentationFormatter
- name: Run System tests
run: |
bundle exec rspec --require ./spec/support/pre_documentation_formatter.rb \
--format PreDocumentationFormatter \
spec/system
- name: Run Generators tests
run: |
bundle exec rspec --require ./spec/support/pre_documentation_formatter.rb \
--format PreDocumentationFormatter \
spec/generators
# Archive
- name: Archive system spec screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots-${{ matrix.gemfile }}-${{ matrix.ruby }}-${{ matrix.pg }}
path: |
demo/tmp/screenshots
demo/tmp/capybara
- name: Archive Rails logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: rails_logs-${{ matrix.gemfile }}-${{ matrix.ruby }}-${{ matrix.pg }}
path: demo/log