Skip to content

fix: workflow for coverage upload to codeclimate #596

fix: workflow for coverage upload to codeclimate

fix: workflow for coverage upload to codeclimate #596

Workflow file for this run

name: Lint, Test, Coverage and Deploy
on:
push:
branches:
- main
- beta
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
# ruby-version: ["3.0", "3.1", "3.2"]
ruby-version: [ "3.2" ]
packages:
# - forest_admin_agent
- forest_admin_datasource_active_record
# - forest_admin_datasource_customizer
# - forest_admin_datasource_toolkit
# - forest_admin_test_toolkit
# - forest_admin_rails
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install dependencies on main repo
run: |
gem install bundler
bundle install
- name: Install dependencies on packages
run: cd packages/${{ matrix.packages }} && bundle install && cd -
- name: Run RuboCop
run: bundle exec rubocop
test:
name: Test
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
# ruby-version: ["3.0", "3.1", "3.2"]
ruby-version: [ "3.2" ]
packages:
# - forest_admin_agent
- forest_admin_datasource_active_record
# - forest_admin_datasource_customizer
# - forest_admin_datasource_toolkit
# - forest_admin_rails
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install dependencies on main repo
run: |
gem install bundler
bundle install
- name: Test
run: cd packages/${{ matrix.packages }} && BUNDLE_GEMFILE=Gemfile-test bundle install && BUNDLE_GEMFILE=Gemfile-test bundle exec rspec --color --format doc && cd -
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.ruby-version }}-${{ matrix.packages }}
path: packages/${{ matrix.packages }}/coverage/*
retention-days: 1
coverage:
name: Send Coverage
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download coverage reports
uses: actions/download-artifact@v4
with:
path: reports
- name: Send coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/reports/3.2-forest_admin_datasource_active_record/coverage.json:simplecov
debug: true
# deploy:
# name: Release package
# runs-on: ubuntu-latest
# needs: [coverage]
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# persist-credentials: false # GITHUB_TOKEN must not be set for the semantic release
#
# - uses: actions/setup-node@v4
# with:
# node-version: 18.14.0
#
# - uses: actions/cache@v4
# with:
# path: "**/node_modules"
# key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
#
# - name: Install semantic release dependencies
# run: yarn
#
# - name: Setup credentials
# run: |
# mkdir -p $HOME/.gem
# touch $HOME/.gem/credentials
# chmod 0600 $HOME/.gem/credentials
# printf -- "---\n:rubygems_api_key: ${{secrets.GEM_HOST_API_KEY}}\n" > $HOME/.gem/credentials
#
# - name: Semantic Release
# uses: cycjimmy/semantic-release-action@v2
# id: semantic
# with:
# semantic_version: 17.3.0
# env:
# GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
# GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
# GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
# GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}