-
-
Notifications
You must be signed in to change notification settings - Fork 141
111 lines (84 loc) · 2.97 KB
/
ubuntu.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: ubuntu
on:
pull_request:
push:
branches:
- master
env:
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-0.7.0-linux-amd64
jobs:
test:
runs-on: ubuntu-18.04
strategy:
matrix:
ruby: [2.4.9, 2.5.7, 2.6.5, 2.7.0]
env:
BUNDLE_PATH: .bundle
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: eregon/use-ruby-action@master
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v1
with:
path: ${{ env.BUNDLE_PATH }}
key: dependencies-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: dependencies-
- name: Install dependencies
run: |
gem install bundler -v 2.1.4
bundle install --jobs 3 --retry 3
- name: Run tests
run: RUBYOPT="-E UTF-8" bundle exec rake
- name: Set ENV for codeclimate (pull_request)
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF
echo "::set-env name=GIT_BRANCH::$GITHUB_HEAD_REF"
echo "::set-env name=GIT_COMMIT_SHA::$(git rev-parse origin/$GITHUB_HEAD_REF)"
if: github.event_name == 'pull_request'
- name: Set ENV for codeclimate (push)
run: |
echo "::set-env name=GIT_BRANCH::$GITHUB_REF"
echo "::set-env name=GIT_COMMIT_SHA::$GITHUB_SHA"
if: github.event_name == 'push'
- name: Download test coverage reporter
run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter
- name: Give test coverage reporter executable permissions
run: chmod +x cc-test-reporter
- name: Save coverage
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
- uses: actions/upload-artifact@v1
with:
name: coverage-${{ matrix.ruby }}
path: coverage/codeclimate.${{ matrix.ruby }}.json
upload_coverage:
runs-on: ubuntu-18.04
env:
CC_TEST_REPORTER_ID: f06a22b27a507a3054eb69873c9e3bbc9ef97476d6ef22eec8cd24686494cb2b
needs: test
steps:
- name: Download test coverage reporter
run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter
- name: Give test coverage reporter executable permissions
run: chmod +x cc-test-reporter
- uses: actions/download-artifact@v1
with:
name: coverage-2.4.9
path: coverage
- uses: actions/download-artifact@v1
with:
name: coverage-2.5.7
path: coverage
- uses: actions/download-artifact@v1
with:
name: coverage-2.6.5
path: coverage
- uses: actions/download-artifact@v1
with:
name: coverage-2.7.0
path: coverage
- name: Aggregate & upload results to Code Climate
run: |
./cc-test-reporter sum-coverage coverage/codeclimate.*.json
./cc-test-reporter upload-coverage