Skip to content

Commit c3b5829

Browse files
authored
Merge pull request #2837 from internetee/adding-qlty-tool
Replacing codeclimate with qlty.sh
2 parents 502443b + acf74af commit c3b5829

File tree

1 file changed

+38
-91
lines changed

1 file changed

+38
-91
lines changed

.github/workflows/ruby.yml

Lines changed: 38 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Github Testing
22
on: [push]
33

4-
54
jobs:
65
test:
76
services:
87
postgres:
98
image: postgres:16
10-
ports: ["5432:5432"]
9+
ports:
10+
- "5432:5432"
1111
env:
1212
POSTGRES_PASSWORD: password
1313
POSTGRES_USERNAME: postgres
@@ -17,100 +17,47 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-22.04]
20-
ruby: [ '3.0.3' ]
20+
ruby: ['3.0.3']
2121
runs-on: ${{ matrix.os }}
2222
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
2323
steps:
24+
- uses: actions/checkout@v4
2425

25-
- uses: actions/checkout@v4
26-
- uses: ruby/setup-ruby@v1
27-
with:
28-
ruby-version: ${{ matrix.ruby }}
29-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30-
- name: config bundler
31-
run: |
32-
bundle config set without 'development staging production'
33-
bundle config set deployment '[secure]'
34-
bundle env
35-
head -n1 $(which bundle)
36-
37-
- name: Set ENV for codeclimate (pull_request)
38-
run: |
39-
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF
40-
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
41-
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV
42-
if: github.event_name == 'pull_request'
43-
44-
- name: Set ENV for codeclimate (push)
45-
run: |
46-
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV
47-
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
48-
if: github.event_name == 'push'
49-
50-
- name: Prepare CodeClimate
51-
env:
52-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
53-
run: |
54-
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter;
55-
chmod +x ./cc-test-reporter
56-
./cc-test-reporter before-build
57-
58-
- name: Run Tests
59-
env:
60-
PG_DATABASE: postgres
61-
PG_HOST: localhost
62-
PG_USER: postgres
63-
PG_PASSWORD: password
64-
PG_PORT: ${{ job.services.postgres.ports[5432] }}
65-
RAILS_ENV: test
66-
COVERAGE: true
67-
DISABLE_SPRING: 1
68-
run: |
69-
cp config/application.yml.sample config/application.yml
70-
cp config/database_travis.yml config/database.yml
71-
echo "openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'" >> config/application.yml
72-
echo "crl_dir: 'test/fixtures/files/test_ca/crl'" >> config/application.yml
73-
echo "crl_path: 'test/fixtures/files/test_ca/crl/crl.pem'" >> config/application.yml
74-
echo "ca_cert_path: 'test/fixtures/files/test_ca/certs/ca.crt.pem'" >> config/application.yml
75-
echo "ca_key_path: 'test/fixtures/files/test_ca/private/ca.key.pem'" >> config/application.yml
76-
echo "ca_key_password: 'password'" >> config/application.yml
77-
bundle exec rake db:setup:all
78-
bundle exec rails test test/*
79-
- name: Save coverage
80-
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json
81-
82-
- uses: actions/[email protected]
83-
with:
84-
name: coverage-${{ matrix.ruby }}
85-
path: coverage/codeclimate.${{ matrix.ruby }}.json
86-
87-
upload_coverage:
88-
strategy:
89-
fail-fast: false
90-
matrix:
91-
ruby: [ '3.0.3' ]
92-
runs-on: ubuntu-24.04
93-
94-
env:
95-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
96-
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
97-
98-
needs: test
99-
100-
steps:
101-
- name: Download test coverage reporter
102-
run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter
103-
104-
- name: Give test coverage reporter executable permissions
105-
run: chmod +x cc-test-reporter
106-
107-
- uses: actions/[email protected]
26+
- uses: ruby/setup-ruby@v1
10827
with:
109-
name: coverage-${{ matrix.ruby }}
110-
path: coverage
28+
ruby-version: ${{ matrix.ruby }}
29+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
11130

112-
- name: Aggregate & upload results to Code Climate
31+
- name: Config bundler
11332
run: |
114-
./cc-test-reporter sum-coverage coverage/codeclimate.*.json
115-
./cc-test-reporter upload-coverage
33+
bundle config set without 'development staging production'
34+
bundle config set deployment '[secure]'
35+
bundle env
36+
head -n1 $(which bundle)
11637
38+
- name: Run Tests
39+
env:
40+
PG_DATABASE: postgres
41+
PG_HOST: localhost
42+
PG_USER: postgres
43+
PG_PASSWORD: password
44+
PG_PORT: ${{ job.services.postgres.ports[5432] }}
45+
RAILS_ENV: test
46+
COVERAGE: true
47+
DISABLE_SPRING: 1
48+
run: |
49+
cp config/application.yml.sample config/application.yml
50+
cp config/database_travis.yml config/database.yml
51+
echo "openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'" >> config/application.yml
52+
echo "crl_dir: 'test/fixtures/files/test_ca/crl'" >> config/application.yml
53+
echo "crl_path: 'test/fixtures/files/test_ca/crl/crl.pem'" >> config/application.yml
54+
echo "ca_cert_path: 'test/fixtures/files/test_ca/certs/ca.crt.pem'" >> config/application.yml
55+
echo "ca_key_path: 'test/fixtures/files/test_ca/private/ca.key.pem'" >> config/application.yml
56+
echo "ca_key_password: 'password'" >> config/application.yml
57+
bundle exec rake db:setup:all
58+
bundle exec rails test test/*
59+
60+
# - name: Upload coverage to Qlty
61+
# env:
62+
# QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }}
63+
# run: npx --yes @qlty/cli coverage --token "$QLTY_TOKEN" coverage/.resultset.json

0 commit comments

Comments
 (0)