Skip to content

Commit

Permalink
Modernize CI
Browse files Browse the repository at this point in the history
Also:

- Run GitHub Actions on PRs
- Set explicit permissions to read for better security. Workflows run
  with extended set of permissions by default. By specifying
  any permission explicitly, all others are set to none.
- Update actions to prevent deprecation warning messages
- Remove redundant `gem install bundler` (bundler is already available after
  setup-ruby action)
- Test against Rails 7.1 / Shakapacker 8 (allow failures)
- Test against multiple Ruby version
- Experimental tests against ruby-head

Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
  • Loading branch information
tagliala committed Jun 24, 2024
1 parent 12dc925 commit 074a014
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 80 deletions.
42 changes: 31 additions & 11 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
name: Integration Tests

on: [push]
on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
test-branch: [rails5, rails6, rails7]
timeout-minutes: 20
test-branch: [rails6, rails7, rails7-shakapacker]

continue-on-error: ${{ matrix.test-branch == 'rails7-shakapacker' }} # TODO: jamesmartin/inline_svg#156

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Checkout test app
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: jamesmartin/inline_svg_test_app
repository: tagliala/inline_svg_test_app
ref: ${{ matrix.test-branch }}
path: test_app
- name: Set up Ruby 2.7
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.7
ruby-version: '3.3.2' # Ref: ruby/ruby#11006
bundler-cache: true
- name: Build local gem
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rake build
- name: Use the local gem in the test App
id: uselocalgem
uses: jacobtomlinson/gha-find-replace@0.1.1
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "gem 'inline_svg'"
replace: "gem 'inline_svg', path: '${{github.workspace}}'"
Expand All @@ -41,6 +50,17 @@ jobs:
run: |
cd $GITHUB_WORKSPACE/test_app
bundle install --jobs 4 --retry 3
- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
if: matrix.test-branch == 'rails7-shakapacker'
- name: Generate Shakapacker config
run: |
cd $GITHUB_WORKSPACE/test_app
yarn install --check-files
bundle exec rake shakapacker:compile
if: matrix.test-branch == 'rails7-shakapacker'
- name: Test
run: |
cd $GITHUB_WORKSPACE/test_app
Expand Down
62 changes: 0 additions & 62 deletions .github/workflows/rails_6_webpacker_integration_tests.yaml

This file was deleted.

30 changes: 23 additions & 7 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
name: Ruby

on: [push]
on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3']
channel: ['stable']

include:
- ruby-version: 'head'
channel: 'experimental'

continue-on-error: ${{ matrix.channel != 'stable' }}

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.7
- name: Build and test with Rake
ruby-version: '3.3'
bundler-cache: true
- name: Test with Rake
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rake

0 comments on commit 074a014

Please sign in to comment.