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)
- Use Python 3

Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
  • Loading branch information
tagliala committed May 22, 2024
1 parent 6a603dc commit 27eb03d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 19 deletions.
16 changes: 11 additions & 5 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,10 +29,9 @@ 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
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/rails_6_webpacker_integration_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
name: Rails 6 Webpacker Integration Tests (unreliable)

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

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
test-branch: [rails6-webpacker]
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: 3.1
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 @@ -42,7 +48,7 @@ jobs:
cd $GITHUB_WORKSPACE/test_app
bundle install --jobs 4 --retry 3
- name: Set up Node.js 16.x
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 16
if: matrix.test-branch == 'rails6-webpacker'
Expand All @@ -53,7 +59,7 @@ jobs:
- name: Generate Webpacker config
run: |
cd $GITHUB_WORKSPACE/test_app
CXXFLAGS="--std=c++17" yarn install --check-files
yarn install --check-files
bundle exec rake webpacker:compile
if: matrix.test-branch == 'rails6-webpacker'
- name: Test
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 27eb03d

Please sign in to comment.