Skip to content

Commit

Permalink
Run GitHub Actions on PRs
Browse files Browse the repository at this point in the history
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)

Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
  • Loading branch information
tagliala committed Sep 3, 2024
1 parent 2d5c4d1 commit 2db6e82
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 33 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Integration Tests

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

permissions:
contents: read

jobs:
build:
Expand All @@ -11,9 +18,9 @@ jobs:
timeout-minutes: 20
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
ref: ${{ matrix.test-branch }}
Expand All @@ -22,14 +29,13 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.7
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 Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
name: Rails 6 Webpacker Integration Tests (unreliable)
name: Rails 7 Shakapacker 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: [rails6-webpacker]
test-branch: [rails7-shakapacker]
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
ref: ${{ matrix.test-branch }}
path: test_app
- name: Set up Ruby 3.1
- name: Set up Ruby 3.3
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
ruby-version: '3.3'
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,21 +47,17 @@ jobs:
run: |
cd $GITHUB_WORKSPACE/test_app
bundle install --jobs 4 --retry 3
- name: Set up Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16
if: matrix.test-branch == 'rails6-webpacker'
- name: Set up Python 2.7
uses: actions/setup-python@v4
- name: Set up Node.js 20.x
uses: actions/setup-node@v4
with:
python-version: '2.7'
- name: Generate Webpacker config
node-version: 20
if: matrix.test-branch == 'rails7-shakapacker'
- name: Generate Shakapacker config
run: |
cd $GITHUB_WORKSPACE/test_app
CXXFLAGS="--std=c++17" yarn install --check-files
bundle exec rake webpacker:compile
if: matrix.test-branch == 'rails6-webpacker'
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
16 changes: 11 additions & 5 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: Ruby

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

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

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

0 comments on commit 2db6e82

Please sign in to comment.