Merge pull request #36 from storyblok/feature/INT-1120 #83
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- uses: actions/cache@v3 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Bundle Install | |
run: | | |
gem install bundler:1.17.2 -N | |
bundle config path vendor/bundle | |
bundle _1.17.2_ install --jobs 4 --retry 3 | |
- name: Rubocop | |
run: bundle exec rubocop | |
test: | |
name: Test ${{ matrix.ruby }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ 'ubuntu' ] | |
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1] | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
REDIS_URL: redis://localhost:6379 | |
COVERAGE: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: 6 | |
- name: Cache Test Reporter | |
id: cache-binary-test-reporter | |
uses: actions/cache@v3 | |
with: | |
path: cc-test-reporter | |
key: ${{ runner.os }}-binary-test-reporter | |
- name: Download the test binary reporter from CodeClimate | |
if: steps.cache-binary-test-reporter.outputs.cache-hit != 'true' | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler: 1.17.2 | |
bundler-cache: true | |
- name: Reporter setup | |
run: ./cc-test-reporter -d before-build | |
- name: Run Rspec | |
run: bundle exec rspec | |
- name: Send coverage report | |
run: ./cc-test-reporter -d after-build -t simplecov |