Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Simplify Circle CI config (#12524)

Damian Legawiec309a6bff6322
diff --git a/.circleci/config.yml b/.circleci/config.yml
index f328483717..854f021063 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,40 +1,42 @@
version: 2.1
defaults: &defaults
- parameters: &default_parameters
- restore_cache_key_1:
- type: string
- default: 'spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}-{{ .Branch }}'
- restore_cache_key_2:
- type: string
- default: 'spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}'
- save_cache_key:
- type: string
- default: 'spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}-{{ .Branch }}'
- run_file_path:
- type: string
- rails_version:
- type: string
- default: '~> 7.2.0'
- store_artefacts:
- type: boolean
- default: false
environment: &environment
CIRCLE_TEST_REPORTS: /tmp/test-results
CIRCLE_ARTIFACTS: /tmp/test-artifacts
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: ~/spree/vendor/bundle
- RAILS_VERSION: << parameters.rails_version >>
DB: postgres # default value, this will speed up bundle install for all postgres builds
DB_HOST: localhost
DB_USERNAME: postgres
-
working_directory: ~/spree
docker:
- image: &ruby_image cimg/ruby:3.3.0-browsers
jobs:
+ build:
+ <<: *defaults
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}-{{ .Branch }}
+ - spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}
+ - run:
+ name: Install libvips
+ command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 32EE5355A6BC6E42 && sudo apt-get update && sudo apt-get install libvips42
+ - run:
+ name: Install global dependencies
+ command: bundle check || bundle install
+ - run:
+ name: Install per-project gem dependencies
+ command: bin/build-ci.rb install
+ - save_cache:
+ key: spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}-{{ .Branch }}
+ paths:
+ - ~/spree/vendor/bundle
+
run_test: &run_test
<<: *defaults
steps: &default_steps
@@ -43,37 +45,30 @@ jobs:
at: /tmp
- restore_cache:
keys:
- - << parameters.restore_cache_key_1 >>
- - << parameters.restore_cache_key_2 >>
+ - spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}-{{ .Branch }}
+ - spree-bundle-v10-ruby-{{ checksum ".ruby-version" }}
+ - run:
+ name: Install libvips
+ command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 32EE5355A6BC6E42 && sudo apt-get update && sudo apt-get install libvips42
- run:
- name: Allow executing given file
- command: chmod +x << parameters.run_file_path >>
+ name: Ensure gems are installed
+ command: bin/build-ci.rb install
- run:
- name: Run << parameters.run_file_path >> file
- command: bash << parameters.run_file_path >>
- - when:
- condition: << parameters.save_cache_key >>
- steps:
- - save_cache:
- key: << parameters.save_cache_key >>
- paths:
- - ~/spree/vendor/bundle
- - when:
- condition: << parameters.store_artefacts >>
- steps:
- - store_artifacts:
- path: /tmp/test-artifacts
- destination: test-artifacts
- - store_artifacts:
- path: /tmp/failed_tests
- destination: failed_tests
- - store_artifacts:
- path: /tmp/test-results
- destination: raw-test-output
- - store_test_results:
- path: /tmp/test-results
+ name: Run tests
+ command: bin/build-ci.rb test
+ - store_artifacts:
+ path: /tmp/test-artifacts
+ destination: test-artifacts
+ - store_artifacts:
+ path: /tmp/failed_tests
+ destination: failed_tests
+ - store_artifacts:
+ path: /tmp/test-results
+ destination: raw-test-output
+ - store_test_results:
+ path: /tmp/test-results
- tests_core:
+ tests_core: &tests_core
<<: *run_test
docker:
- image: *ruby_image
@@ -85,7 +80,7 @@ jobs:
<<: *environment
PROJECTS: core
- tests_api:
+ tests_api: &tests_api
<<: *run_test
parallelism: 4
docker:
@@ -97,7 +92,7 @@ jobs:
<<: *environment
PROJECTS: api
- tests_admin:
+ tests_admin: &tests_admin
<<: *run_test
docker:
- image: *ruby_image
@@ -108,7 +103,7 @@ jobs:
<<: *environment
PROJECTS: admin
- tests_storefront:
+ tests_storefront: &tests_storefront
<<: *run_test
docker:
- image: *ruby_image
@@ -119,7 +114,7 @@ jobs:
<<: *environment
PROJECTS: storefront
- tests_other:
+ tests_other: &tests_other
<<: *run_test
docker:
- image: *ruby_image
@@ -130,64 +125,27 @@ jobs:
<<: *environment
PROJECTS: emails,sample
- # tests_mysql:
- # <<: *run_test
- # parallelism: 12
- # parameters:
- # <<: *default_parameters
- # environment:
- # <<: *environment_mysql
- # docker:
- # - image: *ruby_image
- # - image: cimg/mysql:8.0
- # command: [--default-authentication-plugin=mysql_native_password]
-
workflows:
main:
jobs:
- - run_test:
- name: build
- run_file_path: ./bin/bundle_ruby.sh
+ - build
- tests_core:
name: tests_rails_postgres_core
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
requires:
- build
- tests_api:
name: tests_rails_postgres_api
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
requires:
- build
- tests_admin:
name: tests_rails_postgres_admin
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
requires:
- build
- tests_storefront:
name: tests_rails_postgres_storefront
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
requires:
- build
- tests_other:
name: tests_rails_postgres_other
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
- requires:
- - build
- - run_test:
- name: brakeman
- restore_cache_key_1: spree-brakeman-{{ .Branch }}
- restore_cache_key_2: spree-brakeman
- save_cache_key: spree-brakeman-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- run_file_path: ./bin/brakeman.sh
requires:
- build
- - tests_rails_postgres_core
- - tests_rails_postgres_api
- - tests_rails_postgres_admin
- - tests_rails_postgres_storefront
- - tests_rails_postgres_other
diff --git a/bin/bundle_ruby.sh b/bin/bundle_ruby.sh
deleted file mode 100644
index 99d464b948..0000000000
--- a/bin/bundle_ruby.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -euxo pipefail
-
-sudo apt-get update && sudo apt-get install libvips42
-bundle check || bundle install
-./bin/build-ci.rb install
diff --git a/bin/tests_database_ci.sh b/bin/tests_database_ci.sh
deleted file mode 100644
index 543f8d4824..0000000000
--- a/bin/tests_database_ci.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-set -euxo pipefail
-
-sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 32EE5355A6BC6E42
-sudo apt-get update && sudo apt-get install libvips42
-bundle install
-./bin/build-ci.rb install
-./bin/build-ci.rb test