Merge pull request #2837 from internetee/adding-qlty-tool

Replacing codeclimate with qlty.sh
This commit is contained in:
Martin 2025-08-06 05:08:03 -07:00 committed by GitHub
commit c3b5829d86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,13 +1,13 @@
name: Github Testing name: Github Testing
on: [push] on: [push]
jobs: jobs:
test: test:
services: services:
postgres: postgres:
image: postgres:16 image: postgres:16
ports: ["5432:5432"] ports:
- "5432:5432"
env: env:
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
POSTGRES_USERNAME: postgres POSTGRES_USERNAME: postgres
@ -17,44 +17,24 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-22.04] os: [ubuntu-22.04]
ruby: [ '3.0.3' ] ruby: ['3.0.3']
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
with: with:
ruby-version: ${{ matrix.ruby }} ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: config bundler
- name: Config bundler
run: | run: |
bundle config set without 'development staging production' bundle config set without 'development staging production'
bundle config set deployment '[secure]' bundle config set deployment '[secure]'
bundle env bundle env
head -n1 $(which bundle) head -n1 $(which bundle)
- 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 "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV
if: github.event_name == 'pull_request'
- name: Set ENV for codeclimate (push)
run: |
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
if: github.event_name == 'push'
- name: Prepare CodeClimate
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -LSs '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: Run Tests - name: Run Tests
env: env:
PG_DATABASE: postgres PG_DATABASE: postgres
@ -76,41 +56,8 @@ jobs:
echo "ca_key_password: 'password'" >> config/application.yml echo "ca_key_password: 'password'" >> config/application.yml
bundle exec rake db:setup:all bundle exec rake db:setup:all
bundle exec rails test test/* bundle exec rails test test/*
- name: Save coverage
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
- uses: actions/upload-artifact@v4.6.2
with:
name: coverage-${{ matrix.ruby }}
path: coverage/codeclimate.${{ matrix.ruby }}.json
upload_coverage:
strategy:
fail-fast: false
matrix:
ruby: [ '3.0.3' ]
runs-on: ubuntu-24.04
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
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@v4.2.1
with:
name: coverage-${{ matrix.ruby }}
path: coverage
- name: Aggregate & upload results to Code Climate
run: |
./cc-test-reporter sum-coverage coverage/codeclimate.*.json
./cc-test-reporter upload-coverage
# - name: Upload coverage to Qlty
# env:
# QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }}
# run: npx --yes @qlty/cli coverage --token "$QLTY_TOKEN" coverage/.resultset.json