-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (92 loc) · 2.67 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
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
name: Ruby CI
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
release:
types:
- published
jobs:
# Test and Lint
test:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os:
- ubuntu
- macos
ruby:
- head
- '3.3'
- '3.2'
- '3.1'
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install
- name: Run linting
run: bundle exec rubocop
- name: Run tests
run: bundle exec rspec spec
# SonarCloud, Codecov, etc.
external:
name: SonarCloud, Codecov and CodeClimate Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: bundle install
- name: Run linting
run: bundle exec rubocop --format progress --format json --out rubocop-result.json
- name: Run tests
run: bundle exec rspec spec
# Codecov
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# CodeClimate
- uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
debug: true
coverageLocations: |
coverage/lcov.info:lcov
# Update version for SonarCloud
- name: Set version in sonar-project.properties
run: sed -i -e "s/sonar.projectVersion=.*$/sonar.projectVersion=$(bundle exec rake version)/g" sonar-project.properties
# Fix paths for SonarCloud, because it uses a different container
- name: Fix paths for SonarCloud
run: |
sed -i -e "s#$(pwd)/#/github/workspace/#g" coverage/coverage.json
# SonarCloud
- name: SonarCloud Scan
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_SCANNER_JAVA_OPTS: '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED'
with:
args: >
-Dsonar.verbose=false