Skip to content

Commit

Permalink
👷 run test workflow on pull_request only [closes #129] (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
alaz authored May 19, 2024
1 parent 3bead0b commit 06700e7
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 75 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/autocorrect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: autocorrect

on:
schedule:
- cron: '29 6 * * 6'
- cron: "29 6 * * 6"

workflow_dispatch:

Expand All @@ -12,36 +12,36 @@ jobs:

strategy:
matrix:
ruby: [ 3.0 ]
ruby: [3.0]

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rake test
- name: Run linter
run: bundle exec rubocop -A
continue-on-error: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: update/lint-autocorrect
delete-branch: true
commit-message: '🔧 autocorrect by Rubocop'
title: '[rubocop] Automatic corrections'
body: |
Please review automatic changes proposed by `rubocop -a`.
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rake test
- name: Run linter
run: bundle exec rubocop -A
continue-on-error: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
branch: update/lint-autocorrect
delete-branch: true
commit-message: "🔧 autocorrect by Rubocop"
title: "[rubocop] Automatic corrections"
body: |
Please review automatic changes proposed by `rubocop -a`.
85 changes: 42 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: build

on:
pull_request:
push:

jobs:
test:
Expand All @@ -11,56 +10,56 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ jruby, 3.0, 3.1, 3.2 ]
ruby: [jruby, 3.0, 3.1, 3.2]

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rake test
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: coverage/coverage.xml
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec rake test
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: coverage/coverage.xml

lint:
needs: test
runs-on: ubuntu-latest

strategy:
matrix:
ruby: [ 3.0 ]
ruby: [3.0]

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run linter
run: bundle exec rubocop
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ruby }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run linter
run: bundle exec rubocop

0 comments on commit 06700e7

Please sign in to comment.