Remove activesupport due to its volatility and potential to generate … #14
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: Ruby Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| paths: | |
| - 'components/ruby/**' | |
| - '.github/workflows/ruby-tests.yml' | |
| pull_request: | |
| branches: [ main, master ] | |
| paths: | |
| - 'components/ruby/**' | |
| - '.github/workflows/ruby-tests.yml' | |
| jobs: | |
| test: | |
| name: Ruby ${{ matrix.ruby-version }} Tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| ruby-version: ['3.1', '3.4'] | |
| include: | |
| - os: windows-latest | |
| ruby-version: '3.1' | |
| - os: macos-latest | |
| ruby-version: '3.1' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler-cache: true | |
| working-directory: components/ruby | |
| # disable style checks for now | |
| # - name: Run style checks | |
| # working-directory: components/ruby | |
| # run: bundle exec rake style | |
| - name: Run RSpec tests | |
| working-directory: components/ruby | |
| run: bundle exec rake spec | |
| activesupport-replacement-validation: | |
| name: ActiveSupport Replacement Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| working-directory: components/ruby | |
| - name: Install dependencies without ActiveSupport | |
| working-directory: components/ruby | |
| run: | | |
| # Remove any cached activesupport | |
| bundle clean --force | |
| bundle install | |
| # Verify ActiveSupport is not installed | |
| if bundle list | grep -q activesupport; then | |
| echo "❌ ActiveSupport is still installed!" | |
| bundle list | grep activesupport | |
| exit 1 | |
| else | |
| echo "✅ ActiveSupport successfully removed from dependencies" | |
| fi | |
| - name: Test core functionality without ActiveSupport | |
| working-directory: components/ruby | |
| run: | | |
| bundle exec ruby -e " | |
| # Test that we can load the library without ActiveSupport | |
| require_relative 'lib/chef-licensing' | |
| # Test string pluralization | |
| require_relative 'lib/chef-licensing/string_refinements' | |
| using ChefLicensing::StringRefinements | |
| # Test pluralization rules | |
| test_cases = [ | |
| ['Day', 1, 'Day'], | |
| ['Day', 2, 'Days'], | |
| ['Box', 2, 'Boxes'], | |
| ['City', 2, 'Cities'], | |
| ['Leaf', 2, 'Leaves'], | |
| ['Life', 2, 'Lives'] | |
| ] | |
| test_cases.each do |word, count, expected| | |
| result = word.pluralize(count) | |
| if result != expected | |
| puts \"❌ Pluralization failed: '#{word}'.pluralize(#{count}) = '#{result}', expected '#{expected}'\" | |
| exit 1 | |
| end | |
| end | |
| puts '✅ String refinements work correctly' | |
| puts '✅ Library loads successfully without ActiveSupport' | |
| " | |
| - name: Run critical tests | |
| working-directory: components/ruby | |
| run: | | |
| # Run tests that specifically use the functionality we replaced | |
| bundle exec rspec spec/chef-licensing/restful_client/ --tag ~@slow || true | |
| # Run a minimal test suite to ensure basic functionality works | |
| bundle exec rspec spec/chef_licensing_spec.rb spec/config_spec.rb || true | |
| echo "✅ Critical functionality validated" |