Merge pull request #6217 from blish/github-actions
This commit is contained in:
commit
0ba073802f
@ -136,128 +136,7 @@ commands:
|
||||
command: |
|
||||
sudo apt-get install -y libvips-dev
|
||||
|
||||
install_solidus:
|
||||
parameters:
|
||||
flags:
|
||||
type: string
|
||||
default: "# no options"
|
||||
description: "flags to be passed to `bin/rails g solidus:install"
|
||||
steps:
|
||||
- run:
|
||||
name: "Cleanup & check rails version"
|
||||
command: |
|
||||
sudo gem update --system
|
||||
gem install bundler -v"~> 2.4"
|
||||
gem environment path
|
||||
rm -rf /tmp/my_app /tmp/.ruby-versions # cleanup previous runs
|
||||
rm -rf /tmp/my_app /tmp/.gems-versions # cleanup previous runs
|
||||
|
||||
ruby -v >> /tmp/.ruby-versions
|
||||
gem --version >> /tmp/.gems-versions
|
||||
bundle --version >> /tmp/.gems-versions
|
||||
gem search -eq rails -v "~> 7" -v "< 8.0" >> /tmp/.gems-versions # get the latest rails from rubygems
|
||||
gem search -eq solidus >> /tmp/.gems-versions # get the latest solidus from rubygems
|
||||
|
||||
cat /tmp/.ruby-versions
|
||||
cat /tmp/.gems-versions
|
||||
- restore_cache:
|
||||
keys:
|
||||
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
|
||||
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-
|
||||
- run:
|
||||
name: "Prepare the rails application"
|
||||
command: |
|
||||
cd /tmp
|
||||
test -d my_app || (gem install rails -v "< 8.0" && gem install solidus)
|
||||
test -d my_app || rails new my_app --skip-git
|
||||
- save_cache:
|
||||
key: solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
|
||||
paths:
|
||||
- /tmp/my_app
|
||||
- /home/circleci/.rubygems
|
||||
- run:
|
||||
name: "Run `solidus:install` with `<<parameters.flags>>`"
|
||||
command: |
|
||||
cd /tmp/my_app
|
||||
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
|
||||
unset RAILS_ENV # avoid doing everything on the test environment
|
||||
bin/rails generate solidus:install --auto-accept <<parameters.flags>>
|
||||
|
||||
test_page:
|
||||
parameters:
|
||||
app_root:
|
||||
type: string
|
||||
default: "/tmp/my_app"
|
||||
path:
|
||||
type: string
|
||||
default: "/"
|
||||
expected_text:
|
||||
type: string
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Check the contents of the <<parameters.path>> page"
|
||||
command: |
|
||||
cd <<parameters.app_root>>
|
||||
unset RAILS_ENV # avoid doing everything on the test environment
|
||||
bin/rails server -p 3000 &
|
||||
wget --quiet --output-document - --tries=30 --retry-connrefused "http://localhost:3000<<parameters.path>>" | grep "<<parameters.expected_text>>"
|
||||
echo "Exited with $?"
|
||||
kill $(cat "tmp/pids/server.pid")
|
||||
|
||||
install_dummy_app:
|
||||
parameters:
|
||||
extra_gems:
|
||||
type: string
|
||||
default: ""
|
||||
description: "Gems to be added to the extension's Gemfile before running the installer"
|
||||
steps:
|
||||
- run:
|
||||
name: "Test `rake task: extensions:test_app` <<#parameters.extra_gems>>(with <<parameters.extra_gems>>)<</parameters.extra_gems>>"
|
||||
command: |
|
||||
rm -rf /tmp/dummy_extension # cleanup previous runs
|
||||
mkdir -p /tmp/dummy_extension
|
||||
cd /tmp/dummy_extension
|
||||
bundle init
|
||||
bundle add rails -v "< 8.1" --skip-install
|
||||
bundle add sqlite3 -v "~> 2.0" --skip-install
|
||||
test -n "<<parameters.extra_gems>>" && bundle add <<parameters.extra_gems>> --skip-install
|
||||
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
|
||||
export LIB_NAME=set # dummy requireable file
|
||||
bundle exec rake -rrails -rspree/testing_support/extension_rake -e'Rake::Task["extension:test_app"].invoke'
|
||||
|
||||
jobs:
|
||||
solidus_installer:
|
||||
executor:
|
||||
name: sqlite
|
||||
ruby: "3.1"
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: "Skip for Solidus older than 4.2"
|
||||
command: |
|
||||
ruby -I. -rcore/lib/spree/core/version.rb -e "exit Spree.solidus_gem_version >= Gem::Version.new('4.2')" ||
|
||||
circleci-agent step halt
|
||||
- libvips
|
||||
- install_solidus:
|
||||
flags: "--sample=false --frontend=starter --authentication=devise"
|
||||
- test_page:
|
||||
expected_text: "<title>Sample Store</title>"
|
||||
- run:
|
||||
name: Ensure the correct PayPal is installed for SSF
|
||||
command: |
|
||||
cd /tmp/my_app
|
||||
bundle list | grep 'solidus_paypal_commerce_platform (1.'
|
||||
- install_solidus:
|
||||
flags: "--sample=false --frontend=starter --authentication=devise --payment-method=stripe"
|
||||
- test_page:
|
||||
expected_text: "<title>Sample Store</title>"
|
||||
- install_dummy_app
|
||||
- run:
|
||||
name: "Ensure extension test app is created"
|
||||
command: |
|
||||
test -d /tmp/dummy_extension/spec/dummy
|
||||
|
||||
test_solidus:
|
||||
parameters:
|
||||
database:
|
||||
@ -336,7 +215,6 @@ jobs:
|
||||
workflows:
|
||||
build:
|
||||
jobs:
|
||||
- solidus_installer
|
||||
- test_solidus_with_coverage # Only test with coverage support with the default versions
|
||||
|
||||
# Based on supported versions for the current Solidus release and recommended versions from
|
||||
|
24
.github/actions/check_page_content/action.yml
vendored
Normal file
24
.github/actions/check_page_content/action.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
name: "Install Solidus"
|
||||
|
||||
inputs:
|
||||
app_root:
|
||||
type: string
|
||||
default: "/tmp/my_app"
|
||||
path:
|
||||
type: string
|
||||
default: "/"
|
||||
expected_text:
|
||||
type: string
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Check the contents of the `${{ inputs.path }}` page"
|
||||
shell: bash
|
||||
run: |
|
||||
cd $RUNNER_TEMP/my_app
|
||||
unset RAILS_ENV # avoid doing everything on the test environment
|
||||
bin/rails server -p 3000 &
|
||||
wget --quiet --output-document - --tries=30 --retry-connrefused "http://localhost:3000/" | grep "<title>Sample Store</title>"
|
||||
echo "Exited with $?"
|
||||
kill $(cat "tmp/pids/server.pid")
|
69
.github/actions/install_solidus/action.yml
vendored
Normal file
69
.github/actions/install_solidus/action.yml
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
name: "Install Solidus"
|
||||
|
||||
inputs:
|
||||
flags:
|
||||
type: string
|
||||
default: "# no options"
|
||||
description: "flags to be passed to `bin/rails g solidus:install"
|
||||
rails_version:
|
||||
type: string
|
||||
default: "7.2"
|
||||
ruby_version:
|
||||
type: string
|
||||
default: "3.2"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ inputs.ruby_version }}
|
||||
bundler-cache: true
|
||||
rubygems: "latest"
|
||||
- name: "Cleanup & check rails version"
|
||||
shell: bash
|
||||
run: |
|
||||
gem environment path
|
||||
rm -rf $RUNNER_TEMP/my_app $RUNNER_TEMP/.ruby-versions # cleanup previous runs
|
||||
rm -rf $RUNNER_TEMP/my_app $RUNNER_TEMP/.gems-versions # cleanup previous runs
|
||||
|
||||
ruby -v >> $RUNNER_TEMP/.ruby-versions
|
||||
gem --version >> $RUNNER_TEMP/.gems-versions
|
||||
bundle --version >> $RUNNER_TEMP/.gems-versions
|
||||
gem search -eq rails -v "${{ inputs.rails_version }}" >> $RUNNER_TEMP/.gems-versions # get the latest rails from rubygems
|
||||
gem search -eq solidus >> $RUNNER_TEMP/.gems-versions # get the latest solidus from rubygems
|
||||
|
||||
cat $RUNNER_TEMP/.ruby-versions
|
||||
cat $RUNNER_TEMP/.gems-versions
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/home/runner/.rubygems
|
||||
key: |
|
||||
solidus-installer-v1-${{ hashFiles('${{ runner.temp }}/.ruby-versions') }}-${{ hashFiles('${{ runner.temp }}/.gems-versions') }}
|
||||
restore-keys: |
|
||||
solidus-installer-v1-${{ hashFiles('${{ runner.temp }}/.ruby-versions') }}-
|
||||
- name: "Prepare the rails application"
|
||||
shell: bash
|
||||
run: |
|
||||
cd $RUNNER_TEMP
|
||||
test -d my_app || (gem install solidus rails:'${{ inputs.rails_version }}' -N)
|
||||
test -d my_app || rails new my_app --skip-git
|
||||
- name: "Run `solidus:install` with `${{ inputs.flags }}`"
|
||||
shell: bash
|
||||
run: |
|
||||
cd $RUNNER_TEMP/my_app
|
||||
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['GITHUB_WORKSPACE']")"
|
||||
unset RAILS_ENV # avoid doing everything on the test environment
|
||||
|
||||
# Due to [a bug in `sprockets-rails`](https://github.com/rails/sprockets-rails/pull/546) we need to manually add
|
||||
# the sprockets manifest into the generated rails app **before** running any rails commands inside the rails app folder.
|
||||
mkdir -p app/assets/config
|
||||
cat <<MANIFEST > app/assets/config/manifest.js
|
||||
//= link_tree ../images
|
||||
//= link_directory ../javascripts .js
|
||||
//= link_directory ../stylesheets .css
|
||||
MANIFEST
|
||||
|
||||
bin/rails generate solidus:install --auto-accept ${{ inputs.flags }}
|
39
.github/workflows/install_dummy_app.yml
vendored
Normal file
39
.github/workflows/install_dummy_app.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: "Extension Generator"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
install_dummy_app:
|
||||
name: Dummy App
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
RUBY_VERSION: "3.2"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.RUBY_VERSION }}
|
||||
bundler-cache: true
|
||||
rubygems: "latest"
|
||||
- name: "Test `rake extension:test_app`"
|
||||
run: |
|
||||
rm -rf $RUNNER_TEMP/dummy_extension # cleanup previous runs
|
||||
mkdir -p $RUNNER_TEMP/dummy_extension
|
||||
cd $RUNNER_TEMP/dummy_extension
|
||||
bundle init
|
||||
bundle add rails -v "< 8.1" --skip-install
|
||||
bundle add sqlite3 -v "~> 2.0" --skip-install
|
||||
test -n "${{ inputs.extra_gems }}" && bundle add ${{ inputs.extra_gems }} --skip-install
|
||||
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['GITHUB_WORKSPACE']")"
|
||||
export LIB_NAME=set # dummy requireable file
|
||||
bundle exec rake -rrails -rspree/testing_support/extension_rake -e'Rake::Task["extension:test_app"].invoke'
|
||||
- name: "Ensure extension test app is created"
|
||||
run: |
|
||||
test -d ${{ runner.temp }}/dummy_extension/spec/dummy
|
39
.github/workflows/solidus_installer.yml
vendored
Normal file
39
.github/workflows/solidus_installer.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: "Solidus Installer"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: solidus-installer-${{ github.ref_name }}
|
||||
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
||||
|
||||
jobs:
|
||||
solidus_installer:
|
||||
name: Test Installer
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
DB: sqlite
|
||||
RUBY_VERSION: "3.2"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install libvips
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -yq libvips-dev
|
||||
- name: Install Solidus
|
||||
uses: ./.github/actions/install_solidus
|
||||
with:
|
||||
flags: "--sample=false --frontend=starter --authentication=devise"
|
||||
- name: "Check homepage"
|
||||
uses: ./.github/actions/check_page_content
|
||||
with:
|
||||
expected_text: "<title>Sample Store</title>"
|
||||
- name: Ensure the correct PayPal is installed for SSF
|
||||
run: |
|
||||
cd $RUNNER_TEMP/my_app
|
||||
bundle list | grep 'solidus_paypal_commerce_platform (1.'
|
Loading…
x
Reference in New Issue
Block a user