diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8aba3219..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,63 +0,0 @@ -version: 2.1 - -orbs: - # Always take the latest version of the orb, this allows us to - # run specs against Solidus supported versions only without the need - # to change this configuration every time a Solidus version is released - # or goes EOL. - solidusio_extensions: solidusio/extensions@volatile - -commands: - setup: - steps: - - checkout - - run: - name: "Update bundler" - command: | - sudo gem update --system - gem --version - gem install bundler -v '>=2.3.21' --conservative - bundle --version - -jobs: - solidus-main: - executor: - name: solidusio_extensions/sqlite - ruby_version: '3.2' - steps: ['setup', 'solidusio_extensions/run-tests-solidus-main'] - solidus-current: - executor: - name: solidusio_extensions/sqlite - ruby_version: '3.1' - steps: ['setup', 'solidusio_extensions/run-tests-solidus-current'] - solidus-older: - executor: - name: solidusio_extensions/sqlite - ruby_version: '3.0' - steps: ['setup', 'solidusio_extensions/run-tests-solidus-older'] - lint-code: - executor: - name: solidusio_extensions/sqlite - ruby_version: '3.1' - steps: ['setup', 'solidusio_extensions/lint-code'] - -workflows: - "Run specs on supported Solidus versions": - jobs: - - solidus-main - - solidus-current - - solidus-older - - lint-code - - "Weekly run specs against main": - triggers: - - schedule: - cron: "0 0 * * 4" # every Thursday - filters: - branches: - only: - - main - jobs: - - solidus-main - - solidus-current - - solidus-older diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..dc2a0cfa --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: [pull_request] + +concurrency: + group: lint-${{ github.ref_name }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +permissions: + contents: read + +jobs: + ruby: + name: Check Ruby + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true + - name: Lint Ruby files + run: bundle exec rubocop -ESP diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..5c281a5d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,64 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + schedule: + - cron: "0 0 * * 4" # every Thursday + +concurrency: + group: test-${{ github.ref_name }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +permissions: + contents: read + +jobs: + rspec: + name: Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: true + matrix: + rails-version: + - "7.1" + - "7.2" + - "8.0" + ruby-version: + - "3.1" + - "3.4" + solidus-branch: + - "v4.3" + - "v4.4" + - "v4.5" + - "main" + database: + - "postgresql" + - "mysql" + - "sqlite" + exclude: + - rails-version: "7.2" + solidus-branch: "v4.3" + - ruby-version: "3.1" + rails-version: "8.0" + - solidus-branch: "v4.3" + rails-version: "8.0" + - solidus-branch: "v4.4" + rails-version: "8.0" + steps: + - uses: actions/checkout@v4 + - name: Run extension tests + uses: solidusio/test-solidus-extension@main + with: + database: ${{ matrix.database }} + rails-version: ${{ matrix.rails-version }} + ruby-version: ${{ matrix.ruby-version }} + solidus-branch: ${{ matrix.solidus-branch }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + continue-on-error: true + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/coverage.xml diff --git a/Gemfile b/Gemfile index 41b9bc14..ce5c8603 100644 --- a/Gemfile +++ b/Gemfile @@ -10,8 +10,8 @@ gemspec branch = ENV.fetch('SOLIDUS_BRANCH', 'main') gem 'solidus', github: 'solidusio/solidus', branch: branch -rails_version = ENV.fetch("RAILS_VERSION", "~> 7.0") -gem 'rails', rails_version +rails_version = ENV.fetch("RAILS_VERSION", "7.0") +gem 'rails', "~> #{rails_version}" gem 'bundler' gem 'rake' @@ -21,13 +21,13 @@ group :test do gem 'mysql2' gem 'pg' gem 'solidus_auth_devise' - gem 'sqlite3', rails_version < '~> 7.2' ? '~> 1.4' : '~> 2.0' + gem 'sqlite3', rails_version < '7.2' ? '~> 1.4' : '~> 2.0' end # Use a local Gemfile to include development dependencies that might not be # relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`. eval_gemfile 'Gemfile-local' if File.exist? 'Gemfile-local' -if rails_version == "~> 7.0" +if rails_version == "7.0" gem 'concurrent-ruby', '< 1.3.5' end diff --git a/README.md b/README.md index 36a82d4d..113eb50d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # solidus_dev_support -[![CircleCI](https://circleci.com/gh/solidusio/solidus_dev_support.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_dev_support) +[![Test](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml/badge.svg)](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/solidusio/solidus_dev_support/branch/main/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_dev_support) This gem contains common development functionality for Solidus extensions. @@ -138,15 +138,10 @@ require 'solidus_dev_support/rspec/coverage' **Note: Make sure to add this at the VERY TOP of your spec_helper, otherwise you'll get skewed coverage reports!** -If your extension is in a public repo and being tested on Travis or CircleCI, there's nothing else +If your extension is in a public repo and being tested on GitHub actions, there's nothing else you need to do! If your setup is more complex, look at the [SimpleCov](https://github.com/colszowka/simplecov) -and [codecov-ruby](https://github.com/codecov/codecov-ruby) docs. - -> [!WARNING] -> The Codecov ruby uploader is deprecated. -> Please use the Codecov CLI uploader to upload code coverage reports. -> See https://docs.codecov.com/docs/deprecated-uploader-migration-guide#ruby-uploader for more information on upgrading. +and [codecov](https://about.codecov.io/language/ruby/) docs. #### Using GitHub Actions diff --git a/lib/solidus_dev_support/templates/extension/.github/workflows/lint.yml b/lib/solidus_dev_support/templates/extension/.github/workflows/lint.yml new file mode 100644 index 00000000..dc2a0cfa --- /dev/null +++ b/lib/solidus_dev_support/templates/extension/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: [pull_request] + +concurrency: + group: lint-${{ github.ref_name }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +permissions: + contents: read + +jobs: + ruby: + name: Check Ruby + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true + - name: Lint Ruby files + run: bundle exec rubocop -ESP diff --git a/lib/solidus_dev_support/templates/extension/.github/workflows/test.yml b/lib/solidus_dev_support/templates/extension/.github/workflows/test.yml new file mode 100644 index 00000000..4579edbb --- /dev/null +++ b/lib/solidus_dev_support/templates/extension/.github/workflows/test.yml @@ -0,0 +1,71 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + schedule: + - cron: "0 0 * * 4" # every Thursday + +concurrency: + group: test-${{ github.ref_name }} + cancel-in-progress: ${{ github.ref_name != 'main' }} + +permissions: + contents: read + +jobs: + rspec: + name: Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: true + matrix: + rails-version: + - "7.0" + - "7.1" + - "7.2" + ruby-version: + - "3.1" + - "3.4" + solidus-branch: + - "v4.1" + - "v4.2" + - "v4.3" + - "v4.4" + - "v4.5" + database: + - "postgresql" + - "mysql" + - "sqlite" + exclude: + - rails-version: "7.2" + solidus-branch: "v4.3" + - rails-version: "7.2" + solidus-branch: "v4.2" + - rails-version: "7.2" + solidus-branch: "v4.1" + - rails-version: "7.1" + solidus-branch: "v4.2" + - rails-version: "7.1" + solidus-branch: "v4.1" + - ruby-version: "3.4" + rails-version: "7.0" + env: + CODECOV_COVERAGE_PATH: ./coverage/coverage.xml + steps: + - uses: actions/checkout@v4 + - name: Run extension tests + uses: solidusio/test-solidus-extension@main + with: + database: ${{ matrix.database }} + rails-version: ${{ matrix.rails-version }} + ruby-version: ${{ matrix.ruby-version }} + solidus-branch: ${{ matrix.solidus-branch }} + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + continue-on-error: true + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ${{ env.CODECOV_COVERAGE_PATH }} diff --git a/lib/solidus_dev_support/templates/extension/Gemfile.tt b/lib/solidus_dev_support/templates/extension/Gemfile.tt index fc31ca2a..c6ece8c9 100644 --- a/lib/solidus_dev_support/templates/extension/Gemfile.tt +++ b/lib/solidus_dev_support/templates/extension/Gemfile.tt @@ -15,8 +15,8 @@ else gem 'solidus_frontend', github: 'solidusio/solidus', branch: branch end -rails_version = ENV.fetch('RAILS_VERSION', '~> 7.0') -gem 'rails', rails_version +rails_version = ENV.fetch('RAILS_VERSION', '7.0') +gem 'rails', "~> #{rails_version}" case ENV.fetch('DB', nil) when 'mysql' @@ -24,13 +24,18 @@ when 'mysql' when 'postgresql' gem 'pg' else - gem 'sqlite3', rails_version < '~> 7.2' ? '~> 1.4' : '~> 2.0' + gem 'sqlite3', rails_version < '7.2' ? '~> 1.4' : '~> 2.0' end -if rails_version == '~> 7.0' +if rails_version == '7.0' gem 'concurrent-ruby', '< 1.3.5' end +if RUBY_VERSION >= '3.4' + # Solidus Promotions uses CSV but does not have it as dependency yet. + gem 'csv' +end + # While we still support Ruby < 3 we need to workaround a limitation in # the 'async' gem that relies on the latest ruby, since RubyGems doesn't # resolve gems based on the required ruby version. diff --git a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt index 389af2bb..7aa2f394 100755 --- a/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +++ b/lib/solidus_dev_support/templates/extension/bin/sandbox.tt @@ -61,6 +61,14 @@ group :test, :development do end RUBY +echo "Generating manifest file" +mkdir -p app/assets/config +cat < app/assets/config/manifest.js +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css +MANIFESTJS + unbundled bundle install --gemfile Gemfile unbundled bundle exec rake db:drop db:create