From 7c80205b58666d99a8810c40fbd29a811e7da448 Mon Sep 17 00:00:00 2001 From: mmeest Date: Tue, 5 Aug 2025 12:05:57 +0300 Subject: [PATCH 1/3] initial --- .github/workflows/ruby.yml | 129 +++++++++++-------------------------- 1 file changed, 38 insertions(+), 91 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 15ccf7cae..1be5d9a58 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -1,13 +1,13 @@ name: Github Testing on: [push] - jobs: test: services: postgres: image: postgres:16 - ports: ["5432:5432"] + ports: + - "5432:5432" env: POSTGRES_PASSWORD: password POSTGRES_USERNAME: postgres @@ -17,100 +17,47 @@ jobs: fail-fast: false matrix: os: [ubuntu-22.04] - ruby: [ '3.0.3' ] + ruby: ['3.0.3'] runs-on: ${{ matrix.os }} continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} steps: + - uses: actions/checkout@v4 - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: config bundler - run: | - bundle config set without 'development staging production' - bundle config set deployment '[secure]' - bundle env - 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 - env: - PG_DATABASE: postgres - PG_HOST: localhost - PG_USER: postgres - PG_PASSWORD: password - PG_PORT: ${{ job.services.postgres.ports[5432] }} - RAILS_ENV: test - COVERAGE: true - DISABLE_SPRING: 1 - run: | - cp config/application.yml.sample config/application.yml - cp config/database_travis.yml config/database.yml - echo "openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'" >> config/application.yml - echo "crl_dir: 'test/fixtures/files/test_ca/crl'" >> config/application.yml - echo "crl_path: 'test/fixtures/files/test_ca/crl/crl.pem'" >> config/application.yml - echo "ca_cert_path: 'test/fixtures/files/test_ca/certs/ca.crt.pem'" >> config/application.yml - echo "ca_key_path: 'test/fixtures/files/test_ca/private/ca.key.pem'" >> config/application.yml - echo "ca_key_password: 'password'" >> config/application.yml - bundle exec rake db:setup:all - 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 + - uses: ruby/setup-ruby@v1 with: - name: coverage-${{ matrix.ruby }} - path: coverage + ruby-version: ${{ matrix.ruby }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - name: Aggregate & upload results to Code Climate + - name: Config bundler run: | - ./cc-test-reporter sum-coverage coverage/codeclimate.*.json - ./cc-test-reporter upload-coverage + bundle config set without 'development staging production' + bundle config set deployment '[secure]' + bundle env + head -n1 $(which bundle) + - name: Run Tests + env: + PG_DATABASE: postgres + PG_HOST: localhost + PG_USER: postgres + PG_PASSWORD: password + PG_PORT: ${{ job.services.postgres.ports[5432] }} + RAILS_ENV: test + COVERAGE: true + DISABLE_SPRING: 1 + run: | + cp config/application.yml.sample config/application.yml + cp config/database_travis.yml config/database.yml + echo "openssl_config_path: 'test/fixtures/files/test_ca/openssl.cnf'" >> config/application.yml + echo "crl_dir: 'test/fixtures/files/test_ca/crl'" >> config/application.yml + echo "crl_path: 'test/fixtures/files/test_ca/crl/crl.pem'" >> config/application.yml + echo "ca_cert_path: 'test/fixtures/files/test_ca/certs/ca.crt.pem'" >> config/application.yml + echo "ca_key_path: 'test/fixtures/files/test_ca/private/ca.key.pem'" >> config/application.yml + echo "ca_key_password: 'password'" >> config/application.yml + bundle exec rake db:setup:all + bundle exec rails test test/* + + - name: Upload coverage to Qlty + env: + QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }} + run: npx --yes qlty coverage --token "$QLTY_TOKEN" coverage/.resultset.json From 5bd6babd19083850afdf5493bb09c354042ae948 Mon Sep 17 00:00:00 2001 From: mmeest Date: Tue, 5 Aug 2025 13:16:41 +0300 Subject: [PATCH 2/3] changed qlty token --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 1be5d9a58..dc2239810 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -60,4 +60,4 @@ jobs: - name: Upload coverage to Qlty env: QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }} - run: npx --yes qlty coverage --token "$QLTY_TOKEN" coverage/.resultset.json + run: npx --yes @qlty/cli coverage --token "$QLTY_TOKEN" coverage/.resultset.json From acf74afd3fb9c3ca80874833687f900b98a62427 Mon Sep 17 00:00:00 2001 From: mmeest Date: Tue, 5 Aug 2025 13:37:06 +0300 Subject: [PATCH 3/3] added token check --- .github/workflows/ruby.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index dc2239810..0deb16726 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -57,7 +57,7 @@ jobs: bundle exec rake db:setup:all bundle exec rails test test/* - - name: Upload coverage to Qlty - env: - QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }} - run: npx --yes @qlty/cli coverage --token "$QLTY_TOKEN" coverage/.resultset.json + # - name: Upload coverage to Qlty + # env: + # QLTY_TOKEN: ${{ secrets.QLTY_TOKEN }} + # run: npx --yes @qlty/cli coverage --token "$QLTY_TOKEN" coverage/.resultset.json