Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: optimize tests on CI #92

Merged
merged 1 commit into from
Dec 21, 2023
Merged
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
96 changes: 34 additions & 62 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ env:
BUNDLE_GEMFILE: gemfiles/rails71_gems.rb
DEBIAN_FRONTEND: noninteractive
FERRUM_PROCESS_TIMEOUT: 40
MALLOC_ARENA_MAX: 2
RUBY_YJIT_ENABLE: 1
WD_CACHE_TIME: 864000 # 10 days

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -37,11 +37,7 @@ jobs:
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:
Expand All @@ -53,23 +49,17 @@ jobs:
- 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
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libvips libglib2.0-0 libglib2.0-dev libwebp-dev libvips42 libpng-dev
version: tests-v1

- 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
Expand Down Expand Up @@ -103,68 +93,56 @@ jobs:
- 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
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libvips libglib2.0-0 libglib2.0-dev libwebp-dev libvips42 libpng-dev
version: tests-v1

- 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' ||
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 ]
ruby-version: [ 3.3.0-rc1, 3.2, 3.1, jruby ]
gemfile:
- rails71_gems.rb
- rails70_gems.rb
- rails61_gems.rb
- rails70_gems.rb
- rails71_gems.rb
experimental: [ false ]
exclude:
# We already tested last version
- ruby-version: 3.2
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.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 }}
Expand All @@ -180,16 +158,10 @@ jobs:
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
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers
packages: libvips libglib2.0-0 libglib2.0-dev libwebp-dev libvips42 libpng-dev
version: tests-v1

- name: Run tests
uses: nick-fields/retry@v2
Expand All @@ -201,10 +173,10 @@ jobs:
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
github.ref == 'refs/heads/master' ||
github.event.inputs ||
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.requested_reviewers.length > 0
needs: [ 'test' ]

strategy:
Expand All @@ -226,17 +198,17 @@ jobs:
ruby-version: 3.2
bundler-cache: true

- name: Install libvips
- uses: awalsh128/cache-apt-pkgs-action@latest
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
with:
packages: libvips libglib2.0-0 libglib2.0-dev libwebp-dev libvips42 libpng-dev
version: tests-v1

- name: Cache Webdrivers
- name: Cache Selenium
uses: actions/cache@v3
with:
path: ~/.webdrivers
key: ${{ runner.os }}-webdrivers-${{ matrix.capybara-driver }}
path: ~/.cache/selenium
key: ${{ runner.os }}-selenium-${{ matrix.capybara-driver }}

- name: Run tests
run: bin/rake test:integration
Expand Down
1 change: 1 addition & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ruby_version: 3.0 # default: RUBY_VERSION
default_ignores: false # default: true

ignore: # default: []
- '.*'
- 'bin/**/*'
- 'coverage/**/*'
- 'gemfiles/**/*':
Expand Down
2 changes: 2 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ rules:
indent-sequences: whatever

ignore: |
bin
coverage
gemfiles
scripts
sig
test
tmp
Expand Down
5 changes: 2 additions & 3 deletions gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
gem "rake"

# Image processing libraries
gem "chunky_png", "~> 1.3", require: false
gem "chunky_png", ">= 1.3", require: false
gem "oily_png", platform: :ruby, git: "https://github.com/wvanbergen/oily_png", ref: "44042006e79efd42ce4b52c1d78a4c70f0b4b1b2"
gem "ruby-vips", require: false

Expand All @@ -23,8 +23,7 @@

# Capybara Drivers
gem "cuprite", require: false
gem "selenium-webdriver", require: false
gem "webdrivers", "~> 5.0", require: false
gem "selenium-webdriver", ">= 4.11", require: false

# Test Frameworks
# gem "cucumber", require: false
Expand Down
Binary file modified test/fixtures/app/doc/screenshots/chrome/macos/index-cropped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/app/doc/screenshots/chrome/macos/index-vips.webp
Binary file not shown.
Binary file modified test/fixtures/app/doc/screenshots/chrome/macos/index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions test/support/setup_capybara_drivers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@
window_size: SCREEN_SIZE
)
end
elsif ENV["CAPYBARA_DRIVER"].include?("chrome")
require "webdrivers/chromedriver"
Webdrivers::Chromedriver.update
else
require "webdrivers/geckodriver"
Webdrivers::Geckodriver.update
end

Capybara.save_path = Pathname.new("tmp/capybara").expand_path
Expand Down
Loading