Skip to content

Publish new releases by GitHub Actions (#78) #877

Publish new releases by GitHub Actions (#78)

Publish new releases by GitHub Actions (#78) #877

Workflow file for this run

---
name: Test
on:
push:
branches: [ master ]
pull_request:
type: [ opened, synchronize, reopened, review_requested ]
paths:
- '**.gemfile'
- '**.rb'
- '.github/workflows/**'
- '!bin/**'
workflow_dispatch:
env:
BUNDLE_GEMFILE: gemfiles/rails71_gems.rb
DEBIAN_FRONTEND: noninteractive
FERRUM_PROCESS_TIMEOUT: 40
JAVA_OPTS: -Xmn2g -Xms6g -Xmx6g -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -Xss1m
-XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:ReservedCodeCacheSize=256m
-XX:+UseCodeCacheFlushing
JRUBY_OPTS: --dev
MALLOC_ARENA_MAX: 2
RUBY_GC_HEAP_FREE_SLOTS: 600000
RUBY_GC_HEAP_GROWTH_FACTOR: 1.1
RUBY_GC_HEAP_INIT_SLOTS: 600000
RUBY_YJIT_ENABLE: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Test that new contributors can run the tests directly after checkout.
test-minimal-setup:
name: Test with minimal setup
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: 3.3
- run: bin/rake test
test:
name: Functional Testing
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: 3.3
cache-apt-packages: true
- run: bin/rake test
env:
COVERAGE: enabled
DISABLE_SKIP_TESTS: 1
SCREENSHOT_DRIVER: vips
- uses: ./.github/actions/upload-screenshots
with:
name: base-screenshots
- name: Uploading Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage
retention-days: 1
path: coverage
matrix:
name: Test Integration Rails & Ruby
# Test on master, when a review is requested or manually invoked.
if: >
github.ref == 'refs/heads/master' ||
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.requested_reviewers.length > 0
needs: [ test ]
runs-on: ubuntu-latest
timeout-minutes: ${{ contains(matrix.ruby-version, 'jruby') && 12 || 8 }}
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
ruby-version: [ 3.3, 3.2, 3.1, jruby ]
gemfile:
- rails61_gems.rb
- rails70_gems.rb
- rails71_gems.rb
experimental: [ false ]
exclude:
# We already tested last version
- ruby-version: 3.3
gemfile: rails71_gems.rb
experimental: false
# Tests for Rails 6.1 cannot exit properly on JRuby
- ruby-version: jruby
gemfile: rails61_gems.rb
experimental: false
include:
- ruby-version: 3.3
gemfile: edge_gems.rb
experimental: true
- ruby-version: 3.4.0-preview1
gemfile: edge_gems.rb
experimental: true
- ruby-version: jruby-head
gemfile: rails71_gems.rb
experimental: true
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: ${{ matrix.ruby-version }}
ruby-cache-version: ${{ matrix.ruby-version }}-${{ matrix.gemfile }}-1
cache-apt-packages: true
- name: Run tests (with 2 retries)
uses: nick-fields/retry@v3
with:
timeout_minutes: ${{ contains(matrix.ruby-version, 'jruby') && 5 || 3 }}
max_attempts: 2
command: bin/rake test
matrix-screenshot-driver:
name: Test Integration Capybara & Image Drivers
if: >
github.ref == 'refs/heads/master' ||
github.event.inputs ||
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.requested_reviewers.length > 0
needs: [ 'test' ]
strategy:
matrix:
screenshot-driver: [ vips, chunky_png ]
capybara-driver: [ selenium_headless, selenium_chrome_headless, cuprite ]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-ruby-and-dependencies
with:
ruby-version: 3.3
cache-apt-packages: ${{ matrix.screenshot-driver == 'vips' }}
- name: Cache Selenium
uses: actions/cache@v4
with:
path: ~/.cache/selenium
key: ${{ runner.os }}-selenium-${{ matrix.capybara-driver }}
- run: bin/rake test:integration
env:
SCREENSHOT_DRIVER: ${{ matrix.screenshot-driver }}
CAPYBARA_DRIVER: ${{ matrix.capybara-driver }}
- uses: ./.github/actions/upload-screenshots
with:
name: screenshots-${{ matrix.screenshot-driver }}-${{ matrix.capybara-driver }}