[EM-380] Remove code climate and blog metrics jobs #415
Workflow file for this run
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake | |
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby | |
name: CI | |
on: [pull_request] | |
jobs: | |
linters: | |
name: Linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
- name: Ruby gem cache | |
uses: actions/cache@v2 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install gems | |
run: | | |
bundle config path vendor/bundle --local build.sassc --disable-march-tune-native | |
bundle install --jobs 4 --retry 3 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 15.5.0 | |
- name: Find yarn cache location | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: JS package cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install packages | |
run: | | |
yarn install --pure-lockfile | |
- name: Copy database.yml | |
run: cp config/database.yml.example config/database.yml | |
- name: Run Code Quality checks | |
run: | | |
bundle exec rake code_analysis | |
yarn lint | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:12 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DB: github_analyzer_test | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
CODE_CLIMATE_API_URL: https://api.codeclimate.com/v1 | |
CODE_CLIMATE_API_ORG_NAME: rootstrap | |
GITHUB_ORGANIZATION: rootstrap | |
SLACK_WEBHOOK_URL: https://hooks.slack.com/services/abc | |
PGHOST: localhost | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
RAILS_ENV: test | |
JIRA_ENVIRONMENT_FIELD: customfield_10000 | |
SENDGRID_USERNAME: metrics@example.com | |
ENGINEERING_METRICS_URL: http://engineering-metrics.com/ | |
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} | |
SONAR_URL: ${{ secrets.SONAR_URL }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
- name: Ruby gem cache | |
uses: actions/cache@v2 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install gems | |
run: | | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 15.5.0 | |
- name: Find yarn cache location | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: JS package cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install packages | |
run: | | |
yarn install --pure-lockfile | |
- name: Install PostgreSQL 12 client | |
run: | | |
sudo apt-get -yqq install libpq-dev | |
- name: Install dependencies | |
run: bundle install | |
- name: Setup CodeClimate | |
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 | |
- name: Copy database.yml | |
run: cp config/database.yml.example config/database.yml | |
- name: Setup Database | |
run: | | |
bundle exec rails db:setup | |
- name: Run tests and upload coverage report | |
run: | | |
bundle exec rspec | |
- name: Report to CodeClimate | |
run: | | |
./cc-test-reporter after-build --exit-code 0 | |
- name: Setup sonar scanner | |
uses: warchant/setup-sonar-scanner@v3 | |
- name: Run Sonarqube analysis | |
run: | | |
sonar-scanner \ | |
-Dsonar.qualitygate.wait=true \ | |
-Dsonar.host.url=$SONAR_URL \ | |
-Dsonar.login=$SONAR_TOKEN \ | |
-Dsonar.projectKey=$SONAR_PROJECT_KEY \ | |
-Dsonar.scm.provider=git \ | |
-Dsonar.nodejs.executable=$(which node) \ | |
-Dsonar.projectVersion=$(echo $GITHUB_SHA | cut -c1-8) \ | |
-Dsonar.sources=app/controllers,app/jobs,app/mailers,app/models,app/views \ | |
-Dsonar.tests=spec \ | |
-Dsonar.test.inclusions=**/*_spec.rb \ | |
-Dsonar.test.exclusions=bin,config,db,app/javascript,app/assets \ | |
-Dsonar.projectBaseDir=. \ | |
-Dsonar.ruby.coverage.reportPaths=coverage/coverage.json \ |