Skip to content

Cleanup code & configurations (#86) #667

Cleanup code & configurations (#86)

Cleanup code & configurations (#86) #667

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
RUBY_YJIT_ENABLE: 1
WD_CACHE_TIME: 864000 # 10 days
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: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Cache Webdrivers
uses: actions/cache@v3
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers
- run: bin/rake test
test:
name: Functional Testing
runs-on: ubuntu-latest # In order to install libvips 8.9+ version
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install libvips
run: |
sudo apt-get update -qq
sudo apt-get install --fix-missing -qq --no-install-recommends libvips libvips-dev libvips-tools
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Cache Webdrivers
uses: actions/cache@v3
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers
- name: Run Tests with coverage
env:
COVERAGE: enabled
DISABLE_SKIP_TESTS: 1
SCREENSHOT_DRIVER: vips
run: bin/rake test
- name: Upload Screenshots
if: always()
uses: actions/upload-artifact@v3
with:
name: screenshots
retention-days: 1
path: |
test/fixtures/app/doc/screenshots/
tmp/capybara/screenshots-diffs/
- name: Upload Coverage
uses: actions/upload-artifact@v3
with:
name: coverage
retention-days: 1
path: coverage
test-signature:
name: Testing Signatures
needs: [ 'test' ]
runs-on: ubuntu-latest # In order to install libvips 8.9+ version
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install libvips
run: |
sudo apt-get update -qq
sudo apt-get install -qq --no-install-recommends libvips libvips-dev libvips-tools
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Cache Webdrivers
uses: actions/cache@v3
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers
- name: Tests Signatures
env:
SCREENSHOT_DRIVER: vips
run: bin/rake test:signatures
matrix:
name: Test Integration Rails & Ruby
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: 8
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
ruby-version: [ 3.2, 3.1, 3.0, jruby ]
gemfile:
- rails71_gems.rb
- rails70_gems.rb
- rails61_gems.rb
experimental: [ false ]
exclude:
# We already tested last version
- ruby-version: 3.2
gemfile: rails71_gems.rb
experimental: false
include:
- ruby-version: 3.2
gemfile: edge_gems.rb
experimental: true
- ruby-version: ruby-head
gemfile: rails71_gems.rb
experimental: true
- ruby-version: 3.3.0-preview2
gemfile: rails71_gems.rb
experimental: true
- ruby-version: jruby-head
gemfile: rails71_gems.rb
experimental: true
- ruby-version: truffleruby
gemfile: rails71_gems.rb
experimental: true
- ruby-version: truffleruby+graalvm
gemfile: rails71_gems.rb
experimental: true
env:
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
cache-version: ${{ matrix.ruby-version }}-${{ matrix.gemfile }}-1
- name: Install libvips
run: |
sudo apt-get update -qq
sudo apt-get install --fix-missing -qq --no-install-recommends libvips libvips-dev libvips-tools
- name: Cache Webdrivers
uses: actions/cache@v3
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers
- name: Run tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 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:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Install libvips
if: matrix.screenshot-driver == 'vips'
run: |
sudo apt-get update -qq
sudo apt-get install --fix-missing -qq --no-install-recommends libvips libvips-dev libvips-tools
- name: Cache Webdrivers
uses: actions/cache@v3
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers-${{ matrix.capybara-driver }}
- name: Run tests
run: bin/rake test:integration
env:
SCREENSHOT_DRIVER: ${{ matrix.screenshot-driver }}
CAPYBARA_DRIVER: ${{ matrix.capybara-driver }}
- name: Upload Screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: screenshots-${{ matrix.screenshot-driver }}-${{ matrix.capybara-driver }}
retention-days: 1
path: |
test/fixtures/app/doc/screenshots/
tmp/capybara/screenshots-diffs/