-
Notifications
You must be signed in to change notification settings - Fork 265
55 lines (51 loc) · 1.65 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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