Created
June 16, 2025 14:54
-
-
Save idStar/dcf9e813b8fc142883c9e7ba96ab3b93 to your computer and use it in GitHub Desktop.
lint.yml - Includes Instrumental Components activation in GitHub CI for Ruby on Rails project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linting | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ main, develop ] | |
paths: | |
- '**.rb' | |
- '**.rake' | |
- '**.js' | |
- '**.css' | |
- '**.json' | |
- '**.html' | |
- '**.erb' | |
- '**.yml' | |
- '**.yaml' | |
push: | |
branches: [ main, develop ] | |
paths: | |
- '**.rb' | |
- '**.rake' | |
- '**.js' | |
- '**.css' | |
- '**.json' | |
- '**.html' | |
- '**.erb' | |
- '**.yml' | |
- '**.yaml' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
environment: ci | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: false # Disable cache to ensure fresh install with license | |
- name: Activate Instrumental Components license and install dependencies | |
timeout-minutes: 15 | |
env: | |
IC_LICENSE_KEY: ${{ secrets.INSTRUMENTAL_COMPONENTS_LICENSE_KEY }} | |
IC_EMAIL: ${{ secrets.INSTRUMENTAL_COMPONENTS_EMAIL }} | |
run: | | |
if [ -n "$IC_LICENSE_KEY" ] && [ -n "$IC_EMAIL" ]; then | |
echo "π§ Installing Instrumental Components base gem..." | |
gem install instrumental-components | |
echo "πΎ Temporarily removing Gemfile.lock to prevent source conflicts..." | |
echo " Reason: install-instrumental runs internal 'bundle install' which fails when" | |
echo " Gemfile.lock points to old public gem source. Removing it allows clean resolution." | |
cp Gemfile.lock Gemfile.lock.backup | |
rm Gemfile.lock | |
echo "π Activating IC license (no stack trace with clean dependency resolution)..." | |
ruby -S install-instrumental --license-key "$IC_LICENSE_KEY" --email "$IC_EMAIL" | |
echo "π Restoring Gemfile.lock and updating to use newly accessible private gem source..." | |
mv Gemfile.lock.backup Gemfile.lock | |
bundle update instrumental-components-library | |
echo "β‘ Installing dependencies optimized for linting..." | |
bundle install --without test | |
else | |
echo "Warning: IC license not configured for CI - installing without IC gems" | |
bundle config set without 'development' | |
bundle install | |
fi | |
- name: Lint code for consistent style | |
run: bin/rubocop -f github |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment