Skip to content

Commit 0ba0738

Browse files
authored
Merge pull request #6217 from blish/github-actions
2 parents 32aa5cf + 3e27ad4 commit 0ba0738

File tree

5 files changed

+171
-122
lines changed

5 files changed

+171
-122
lines changed

.circleci/config.yml

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -136,128 +136,7 @@ commands:
136136
command: |
137137
sudo apt-get install -y libvips-dev
138138
139-
install_solidus:
140-
parameters:
141-
flags:
142-
type: string
143-
default: "# no options"
144-
description: "flags to be passed to `bin/rails g solidus:install"
145-
steps:
146-
- run:
147-
name: "Cleanup & check rails version"
148-
command: |
149-
sudo gem update --system
150-
gem install bundler -v"~> 2.4"
151-
gem environment path
152-
rm -rf /tmp/my_app /tmp/.ruby-versions # cleanup previous runs
153-
rm -rf /tmp/my_app /tmp/.gems-versions # cleanup previous runs
154-
155-
ruby -v >> /tmp/.ruby-versions
156-
gem --version >> /tmp/.gems-versions
157-
bundle --version >> /tmp/.gems-versions
158-
gem search -eq rails -v "~> 7" -v "< 8.0" >> /tmp/.gems-versions # get the latest rails from rubygems
159-
gem search -eq solidus >> /tmp/.gems-versions # get the latest solidus from rubygems
160-
161-
cat /tmp/.ruby-versions
162-
cat /tmp/.gems-versions
163-
- restore_cache:
164-
keys:
165-
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
166-
- solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-
167-
- run:
168-
name: "Prepare the rails application"
169-
command: |
170-
cd /tmp
171-
test -d my_app || (gem install rails -v "< 8.0" && gem install solidus)
172-
test -d my_app || rails new my_app --skip-git
173-
- save_cache:
174-
key: solidus-installer-v11-{{ checksum "/tmp/.ruby-versions" }}-{{ checksum "/tmp/.gems-versions" }}
175-
paths:
176-
- /tmp/my_app
177-
- /home/circleci/.rubygems
178-
- run:
179-
name: "Run `solidus:install` with `<<parameters.flags>>`"
180-
command: |
181-
cd /tmp/my_app
182-
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
183-
unset RAILS_ENV # avoid doing everything on the test environment
184-
bin/rails generate solidus:install --auto-accept <<parameters.flags>>
185-
186-
test_page:
187-
parameters:
188-
app_root:
189-
type: string
190-
default: "/tmp/my_app"
191-
path:
192-
type: string
193-
default: "/"
194-
expected_text:
195-
type: string
196-
197-
steps:
198-
- run:
199-
name: "Check the contents of the <<parameters.path>> page"
200-
command: |
201-
cd <<parameters.app_root>>
202-
unset RAILS_ENV # avoid doing everything on the test environment
203-
bin/rails server -p 3000 &
204-
wget --quiet --output-document - --tries=30 --retry-connrefused "http://localhost:3000<<parameters.path>>" | grep "<<parameters.expected_text>>"
205-
echo "Exited with $?"
206-
kill $(cat "tmp/pids/server.pid")
207-
208-
install_dummy_app:
209-
parameters:
210-
extra_gems:
211-
type: string
212-
default: ""
213-
description: "Gems to be added to the extension's Gemfile before running the installer"
214-
steps:
215-
- run:
216-
name: "Test `rake task: extensions:test_app` <<#parameters.extra_gems>>(with <<parameters.extra_gems>>)<</parameters.extra_gems>>"
217-
command: |
218-
rm -rf /tmp/dummy_extension # cleanup previous runs
219-
mkdir -p /tmp/dummy_extension
220-
cd /tmp/dummy_extension
221-
bundle init
222-
bundle add rails -v "< 8.1" --skip-install
223-
bundle add sqlite3 -v "~> 2.0" --skip-install
224-
test -n "<<parameters.extra_gems>>" && bundle add <<parameters.extra_gems>> --skip-install
225-
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['CIRCLE_WORKING_DIRECTORY']")"
226-
export LIB_NAME=set # dummy requireable file
227-
bundle exec rake -rrails -rspree/testing_support/extension_rake -e'Rake::Task["extension:test_app"].invoke'
228-
229139
jobs:
230-
solidus_installer:
231-
executor:
232-
name: sqlite
233-
ruby: "3.1"
234-
steps:
235-
- checkout
236-
- run:
237-
name: "Skip for Solidus older than 4.2"
238-
command: |
239-
ruby -I. -rcore/lib/spree/core/version.rb -e "exit Spree.solidus_gem_version >= Gem::Version.new('4.2')" ||
240-
circleci-agent step halt
241-
- libvips
242-
- install_solidus:
243-
flags: "--sample=false --frontend=starter --authentication=devise"
244-
- test_page:
245-
expected_text: "<title>Sample Store</title>"
246-
- run:
247-
name: Ensure the correct PayPal is installed for SSF
248-
command: |
249-
cd /tmp/my_app
250-
bundle list | grep 'solidus_paypal_commerce_platform (1.'
251-
- install_solidus:
252-
flags: "--sample=false --frontend=starter --authentication=devise --payment-method=stripe"
253-
- test_page:
254-
expected_text: "<title>Sample Store</title>"
255-
- install_dummy_app
256-
- run:
257-
name: "Ensure extension test app is created"
258-
command: |
259-
test -d /tmp/dummy_extension/spec/dummy
260-
261140
test_solidus:
262141
parameters:
263142
database:
@@ -336,7 +215,6 @@ jobs:
336215
workflows:
337216
build:
338217
jobs:
339-
- solidus_installer
340218
- test_solidus_with_coverage # Only test with coverage support with the default versions
341219

342220
# Based on supported versions for the current Solidus release and recommended versions from
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Install Solidus"
2+
3+
inputs:
4+
app_root:
5+
type: string
6+
default: "/tmp/my_app"
7+
path:
8+
type: string
9+
default: "/"
10+
expected_text:
11+
type: string
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: "Check the contents of the `${{ inputs.path }}` page"
17+
shell: bash
18+
run: |
19+
cd $RUNNER_TEMP/my_app
20+
unset RAILS_ENV # avoid doing everything on the test environment
21+
bin/rails server -p 3000 &
22+
wget --quiet --output-document - --tries=30 --retry-connrefused "http://localhost:3000/" | grep "<title>Sample Store</title>"
23+
echo "Exited with $?"
24+
kill $(cat "tmp/pids/server.pid")
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "Install Solidus"
2+
3+
inputs:
4+
flags:
5+
type: string
6+
default: "# no options"
7+
description: "flags to be passed to `bin/rails g solidus:install"
8+
rails_version:
9+
type: string
10+
default: "7.2"
11+
ruby_version:
12+
type: string
13+
default: "3.2"
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Set up Ruby
19+
uses: ruby/setup-ruby@v1
20+
with:
21+
ruby-version: ${{ inputs.ruby_version }}
22+
bundler-cache: true
23+
rubygems: "latest"
24+
- name: "Cleanup & check rails version"
25+
shell: bash
26+
run: |
27+
gem environment path
28+
rm -rf $RUNNER_TEMP/my_app $RUNNER_TEMP/.ruby-versions # cleanup previous runs
29+
rm -rf $RUNNER_TEMP/my_app $RUNNER_TEMP/.gems-versions # cleanup previous runs
30+
31+
ruby -v >> $RUNNER_TEMP/.ruby-versions
32+
gem --version >> $RUNNER_TEMP/.gems-versions
33+
bundle --version >> $RUNNER_TEMP/.gems-versions
34+
gem search -eq rails -v "${{ inputs.rails_version }}" >> $RUNNER_TEMP/.gems-versions # get the latest rails from rubygems
35+
gem search -eq solidus >> $RUNNER_TEMP/.gems-versions # get the latest solidus from rubygems
36+
37+
cat $RUNNER_TEMP/.ruby-versions
38+
cat $RUNNER_TEMP/.gems-versions
39+
- uses: actions/cache@v4
40+
with:
41+
path: |
42+
/home/runner/.rubygems
43+
key: |
44+
solidus-installer-v1-${{ hashFiles('${{ runner.temp }}/.ruby-versions') }}-${{ hashFiles('${{ runner.temp }}/.gems-versions') }}
45+
restore-keys: |
46+
solidus-installer-v1-${{ hashFiles('${{ runner.temp }}/.ruby-versions') }}-
47+
- name: "Prepare the rails application"
48+
shell: bash
49+
run: |
50+
cd $RUNNER_TEMP
51+
test -d my_app || (gem install solidus rails:'${{ inputs.rails_version }}' -N)
52+
test -d my_app || rails new my_app --skip-git
53+
- name: "Run `solidus:install` with `${{ inputs.flags }}`"
54+
shell: bash
55+
run: |
56+
cd $RUNNER_TEMP/my_app
57+
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['GITHUB_WORKSPACE']")"
58+
unset RAILS_ENV # avoid doing everything on the test environment
59+
60+
# Due to [a bug in `sprockets-rails`](https://github.com/rails/sprockets-rails/pull/546) we need to manually add
61+
# the sprockets manifest into the generated rails app **before** running any rails commands inside the rails app folder.
62+
mkdir -p app/assets/config
63+
cat <<MANIFEST > app/assets/config/manifest.js
64+
//= link_tree ../images
65+
//= link_directory ../javascripts .js
66+
//= link_directory ../stylesheets .css
67+
MANIFEST
68+
69+
bin/rails generate solidus:install --auto-accept ${{ inputs.flags }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Extension Generator"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
install_dummy_app:
13+
name: Dummy App
14+
runs-on: ubuntu-24.04
15+
env:
16+
RUBY_VERSION: "3.2"
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: ${{ env.RUBY_VERSION }}
23+
bundler-cache: true
24+
rubygems: "latest"
25+
- name: "Test `rake extension:test_app`"
26+
run: |
27+
rm -rf $RUNNER_TEMP/dummy_extension # cleanup previous runs
28+
mkdir -p $RUNNER_TEMP/dummy_extension
29+
cd $RUNNER_TEMP/dummy_extension
30+
bundle init
31+
bundle add rails -v "< 8.1" --skip-install
32+
bundle add sqlite3 -v "~> 2.0" --skip-install
33+
test -n "${{ inputs.extra_gems }}" && bundle add ${{ inputs.extra_gems }} --skip-install
34+
bundle add solidus --path "$(ruby -e"puts File.expand_path ENV['GITHUB_WORKSPACE']")"
35+
export LIB_NAME=set # dummy requireable file
36+
bundle exec rake -rrails -rspree/testing_support/extension_rake -e'Rake::Task["extension:test_app"].invoke'
37+
- name: "Ensure extension test app is created"
38+
run: |
39+
test -d ${{ runner.temp }}/dummy_extension/spec/dummy
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Solidus Installer"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: solidus-installer-${{ github.ref_name }}
13+
cancel-in-progress: ${{ github.ref_name != 'main' }}
14+
15+
jobs:
16+
solidus_installer:
17+
name: Test Installer
18+
runs-on: ubuntu-24.04
19+
env:
20+
DB: sqlite
21+
RUBY_VERSION: "3.2"
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Install libvips
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -yq libvips-dev
28+
- name: Install Solidus
29+
uses: ./.github/actions/install_solidus
30+
with:
31+
flags: "--sample=false --frontend=starter --authentication=devise"
32+
- name: "Check homepage"
33+
uses: ./.github/actions/check_page_content
34+
with:
35+
expected_text: "<title>Sample Store</title>"
36+
- name: Ensure the correct PayPal is installed for SSF
37+
run: |
38+
cd $RUNNER_TEMP/my_app
39+
bundle list | grep 'solidus_paypal_commerce_platform (1.'

0 commit comments

Comments
 (0)