Skip to content

Commit 55f4384

Browse files
committed
Run GitHub Actions on PRs
Also: - 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) - Move Shakapacker checks to the main integration workflow Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
1 parent 2d5c4d1 commit 55f4384

File tree

3 files changed

+37
-76
lines changed

3 files changed

+37
-76
lines changed

.github/workflows/integration_test.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
name: Integration Tests
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
411

512
jobs:
613
build:
714
runs-on: ubuntu-latest
815
strategy:
916
matrix:
10-
test-branch: [rails5, rails6, rails7]
17+
test-branch: [rails6, rails7, rails7-shakapacker]
1118
timeout-minutes: 20
1219
steps:
1320
- name: Checkout
14-
uses: actions/checkout@v2
21+
uses: actions/checkout@v4
1522
- name: Checkout test app
16-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
1724
with:
1825
repository: jamesmartin/inline_svg_test_app
1926
ref: ${{ matrix.test-branch }}
2027
path: test_app
21-
- name: Set up Ruby 2.7
28+
- name: Set up Ruby
2229
uses: ruby/setup-ruby@v1
2330
with:
24-
ruby-version: 2.7.7
31+
ruby-version: 3.3.4
32+
bundler-cache: true
2533
- name: Build local gem
2634
run: |
27-
gem install bundler
28-
bundle install --jobs 4 --retry 3
2935
bundle exec rake build
3036
- name: Use the local gem in the test App
3137
id: uselocalgem
32-
uses: jacobtomlinson/gha-find-replace@0.1.1
38+
uses: jacobtomlinson/gha-find-replace@v3
3339
with:
3440
find: "gem 'inline_svg'"
3541
replace: "gem 'inline_svg', path: '${{github.workspace}}'"
@@ -41,6 +47,17 @@ jobs:
4147
run: |
4248
cd $GITHUB_WORKSPACE/test_app
4349
bundle install --jobs 4 --retry 3
50+
- name: Set up Node.js 20.x
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: 20
54+
if: matrix.test-branch == 'rails7-shakapacker'
55+
- name: Generate Shakapacker config
56+
run: |
57+
cd $GITHUB_WORKSPACE/test_app
58+
yarn install --check-files
59+
bundle exec rake shakapacker:compile
60+
if: matrix.test-branch == 'rails7-shakapacker'
4461
- name: Test
4562
run: |
4663
cd $GITHUB_WORKSPACE/test_app

.github/workflows/rails_6_webpacker_integration_tests.yaml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/ruby.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
name: Ruby
22

3-
on: [push]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
411

512
jobs:
613
build:
714

815
runs-on: ubuntu-latest
916

1017
steps:
11-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1219
- name: Set up Ruby 2.7
1320
uses: ruby/setup-ruby@v1
1421
with:
1522
ruby-version: 2.7.7
16-
- name: Build and test with Rake
23+
bundler-cache: true
24+
- name: Test with Rake
1725
run: |
18-
gem install bundler
19-
bundle install --jobs 4 --retry 3
2026
bundle exec rake

0 commit comments

Comments
 (0)