20321 Fix linter errors #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
types: [ opened, synchronize ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.6' | |
bundler-cache: true | |
- name: Set-up RuboCop Problem Matcher | |
uses: r7kamura/rubocop-problem-matchers-action@v1 | |
- name: Run rubocop | |
run: bundle exec rubocop | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby-version: ['3.3', '3.2', '3.1', '3.0', '2.7', '2.6'] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
GOOGLE_TRANSLATE_API_KEY: ${{ secrets.GOOGLE_TRANSLATE_API_KEY }} | |
COVERAGE: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby ${{ matrix.ruby-version }} | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- name: "Determine whether to upload coverage" | |
if: ${{ env.CC_TEST_REPORTER_ID && startsWith(matrix.ruby-version, '3.0') && github.ref == 'refs/heads/main' }} | |
run: echo UPLOAD_COVERAGE=1 >> $GITHUB_ENV | |
- name: Ruby 2.6 gem update | |
if: ${{ startsWith(matrix.ruby-version, '2.6') }} | |
run: gem update --system 3.2.3 | |
- name: Install dependencies | |
run: bundle install | |
- name: Run tests | |
if: ${{ !env.UPLOAD_COVERAGE }} | |
run: bundle exec rake | |
- name: Run tests and upload coverage | |
uses: paambaati/codeclimate-action@v5 | |
if: ${{ env.UPLOAD_COVERAGE }} | |
with: | |
coverageCommand: bundle exec rake |