This repository has been archived by the owner on Jan 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (51 loc) · 1.88 KB
/
ci.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
name: ci
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: [2.5.x, 2.6.x, 2.7.x]
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
- name: Calculate variable dynamic values
id: dynamic_values
run: |
echo "::set-output name=installed_ruby_version::$(ruby -e 'print RUBY_VERSION')"
echo "::set-output name=cacheTimeAnchor::$(ruby -e 'require %Q{date}; cacheExpirationSeconds = 60*60*24; print (Time.now.to_i / cacheExpirationSeconds)')"
- name: Download CodeClimate reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
env:
CC_TEST_REPORTER_ID: 0caaf0c68cbf5597ac7eb5207944c878a0b3fba46dbfa113093b861f2d25762e
- name: Install and config bundler
run: |
gem install bundler:2.1.4
- name: Generate 'Gemfile.lock' before caching gems
run: |
bundle lock --update
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-ruby_v${{ steps.dynamic_values.outputs.installed_ruby_version }}-time_${{steps.dynamic_values.outputs.cacheTimeAnchor}}-gems-${{ hashFiles('**/Gemfile.lock') }}
- name: Install dependencies
run: |
bundle config set path 'vendor/bundle'
bundle install --jobs 4 --retry 3
- name: Run code analysis
run: |
bundle exec rake code_analysis
- name: Run tests
run: |
bundle exec rspec
- name: Report to CodeClimate
run: |
./cc-test-reporter after-build --exit-code 0
env:
CC_TEST_REPORTER_ID: 0caaf0c68cbf5597ac7eb5207944c878a0b3fba46dbfa113093b861f2d25762e