rggen/rggen-veryl

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on: [push, pull_request]

jobs:
  rspec:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        ruby: ['3.3', '3.2', '3.1', '3.0']
        frozen_string_literal: ['yes', 'no']

    env:
      BUNDLE_WITH: 'development_common development_test'
      BUNDLE_WITHOUT: 'development_lint development_local'
      RUBYOPT: ${{ (matrix.frozen_string_literal == 'yes' && '--enable-frozen-string-literal') || '' }}
      USE_GEM_PATCHED_LOCALLY: ${{ matrix.frozen_string_literal }}

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Setup RgGen env variables
        run: |
          echo "RGGEN_ROOT=${GITHUB_WORKSPACE}" >> ${GITHUB_ENV}
          echo "RGGEN_REPOSITORY=${GITHUB_REPOSITORY#rggen/}" >> ${GITHUB_ENV}
          echo "RGGEN_BRANCH=${GITHUB_REF#refs/heads/}" >> ${GITHUB_ENV}

      - name: Checkout RgGen devtools
        uses: actions/checkout@v4
        with:
          repository: rggen/rggen-devtools
          path: rggen-devtools
          fetch-depth: 0

      - name: Checkout RgGen library list
        uses: actions/checkout@v4
        with:
          repository: rggen/rggen-checkout
          path: rggen-checkout
          fetch-depth: 0

      - name: Checkout RgGen libraries
        run: |
          ${RGGEN_ROOT}/rggen-devtools/bin/checkout.rb

      - name: Checkout stdgems-version gem
        uses: actions/checkout@v4
        with:
          repository: taichi-ishitani/stdgems-version
          path: stdgems-version
          fetch-depth: 0
          submodules: true

      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
          bundler-cache: true

      - name: Run RSpec
        run: |
          bundle exec rake coverage

      - name: Upload coverage report
        uses: codecov/codecov-action@v5
        with:
          name: ${{ runner.os }}-${{ matrix.ruby }}-frozen_string_literal-${{ matrix.frozen_string_literal }}
          files: ./coverage/coverage.xml
          fail_ci_if_error: true
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}