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.

Reversed changes in config.yml, deleted bash files

Mateusz Porębski6f53d8405d4b
diff --git a/.circleci/config.yml b/.circleci/config.yml
index ce1830e72a..791e63e3c1 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,107 +1,132 @@
-version: 2.1
+version: 2.1 # use CircleCI 2.0
defaults: &defaults
- parameters: &default_parameters
- ruby_image:
- type: string
- redis_image:
- type: string
- restore_cache_key_1:
- type: string
- default: 'spree-bundle-v10-ruby-3-2-{{ .Branch }}'
- restore_cache_key_2:
- type: string
- default: spree-bundle-v10-ruby-3-2
- save_cache_key:
- type: string
- default: "n"
- run_file_path:
- type: string
- rails_version:
- type: string
- default: '~> 7.0.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 >>
+ CIRCLE_TEST_REPORTS: /tmp/test-results
+ CIRCLE_ARTIFACTS: /tmp/test-artifacts
+ BUNDLE_JOBS: 4
+ BUNDLE_RETRY: 3
+ BUNDLE_PATH: ~/spree/vendor/bundle
+ RAILS_VERSION: '~> 7.0.0'
working_directory: ~/spree
docker:
- - image: &ruby_image << parameters.ruby_image >>
- - image: &redis_image << parameters.redis_image >>
+ - image: &ruby_3_2_image cimg/ruby:3.2.0-browsers
+ - image: &redis_image circleci/redis:6.2-alpine
+run_tests_3_2: &run_tests_3_2
+ <<: *defaults
+ parallelism: 3
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - spree-bundle-v10-ruby-3-2-{{ .Branch }}
+ - spree-bundle-v10-ruby-3-2
+ - run:
+ name: Install libvips
+ command: sudo apt-get update && sudo apt-get install libvips42
+ - run:
+ name: Ensure Bundle Install
+ command: |
+ bundle install
+ ./bin/build-ci.rb install
+ - run:
+ name: Run rspec in parallel
+ command: ./bin/build-ci.rb test
+ - store_artifacts:
+ path: /tmp/test-artifacts
+ destination: test-artifacts
+ - store_artifacts:
+ path: /tmp/test-results
+ destination: raw-test-output
+ - store_test_results:
+ path: /tmp/test-results
jobs:
- run_test: &run_test
+ bundle_ruby_3_2:
<<: *defaults
- steps: &default_steps
+ steps:
- checkout
- restore_cache:
keys:
- - << parameters.restore_cache_key_1 >>
- - << parameters.restore_cache_key_2 >>
+ - spree-bundle-v10-ruby-3-2-{{ .Branch }}
+ - spree-bundle-v10-ruby-3-2
- run:
- name: Allow executing given file
- command: chmod +x << parameters.run_file_path >>
+ name: Install libvips
+ command: sudo apt-get update && sudo apt-get install libvips42
- 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/test-results
- destination: raw-test-output
- - store_test_results:
- path: /tmp/test-results
+ name: Bundle Install
+ command: |
+ bundle check || bundle install
+ ./bin/build-ci.rb install
+ - save_cache:
+ key: spree-bundle-v10-ruby-3-1-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
+ paths:
+ - ~/spree/vendor/bundle
- tests_postgres:
- <<: *run_test
- parallelism: << parameters.parallelism >>
- parameters:
- <<: *default_parameters
- postgres_image:
- type: string
- parallelism:
- type: integer
- default: 3
- environment:
+ brakeman:
+ <<: *defaults
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - spree-brakeman-{{ .Branch }}
+ - spree-brakeman
+ - run:
+ name: Ensure Bundle Install
+ command: |
+ bundle install
+ ./bin/build-ci.rb install
+ - run:
+ name: Run Brakeman spree/api
+ command: |
+ bundle exec brakeman -p api/ --ignore-config api/brakeman.ignore --skip-files app/controllers/spree/api/v1/ --exit-on-warn --exit-on-error
+ - run:
+ name: Run Brakeman spree/core
+ command: |
+ bundle exec brakeman -p core/ --ignore-config core/brakeman.ignore --exit-on-warn --exit-on-error
+ - save_cache:
+ key: spree-brakeman-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
+ paths:
+ - ~/spree/vendor/bundle
+
+ tests_ruby_3_2_rails_7_0_postgres: &tests_ruby_3_2_rails_7_0_postgres
+ <<: *run_tests_3_2
+ environment: &postgres_environment
+ <<: *environment
+ DB: postgres
+ DB_HOST: localhost
+ DB_USERNAME: postgres
+ docker:
+ - image: *ruby_3_2_image
+ - image: &postgres_image circleci/postgres:12-alpine
+ environment:
+ POSTGRES_USER: postgres
+ - image: *redis_image
+
+ tests_ruby_3_2_rails_7_1_postgres: &tests_ruby_3_2_rails_7_0_postgres
+ <<: *run_tests_3_2
+ environment: &postgres_environment
<<: *environment
DB: postgres
DB_HOST: localhost
DB_USERNAME: postgres
+ RAILS_VERSION: '~> 7.1.0'
docker:
- - image: *ruby_image
- - image: << parameters.postgres_image >>
+ - image: *ruby_3_2_image
+ - image: &postgres_image circleci/postgres:12-alpine
environment:
POSTGRES_USER: postgres
- image: *redis_image
- tests_mysql:
- <<: *run_test
- parallelism: << parameters.parallelism >>
- parameters:
- <<: *default_parameters
- mysql_image:
- type: string
- parallelism:
- type: integer
- default: 3
+ tests_ruby_3_2_rails_6_1_postgres:
+ <<: *tests_ruby_3_2_rails_7_0_postgres
+ environment:
+ <<: *postgres_environment
+ RAILS_VERSION: '~> 6.1.0'
+
+ tests_ruby_3_2_rails_7_0_mysql:
+ <<: *run_tests_3_2
environment:
<<: *environment
DB: mysql
@@ -110,10 +135,42 @@ jobs:
COVERAGE: true
COVERAGE_DIR: /tmp/workspace/simplecov
docker:
- - image: *ruby_image
+ - image: *ruby_3_2_image
- image: *redis_image
- - image: << parameters.mysql_image >>
+ - image: circleci/mysql:8-ram
command: [--default-authentication-plugin=mysql_native_password]
+ steps:
+ - checkout
+ - restore_cache:
+ keys:
+ - spree-bundle-v10-ruby-3-2-{{ .Branch }}
+ - spree-bundle-v10-ruby-3-2
+ - run:
+ name: Add keyserver
+ command: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
+ - run:
+ name: Install libvips
+ command: sudo apt-get update && sudo apt-get install libvips
+ - run:
+ name: Ensure Bundle Install
+ command: |
+ bundle install
+ ./bin/build-ci.rb install
+ - run:
+ name: Run rspec in parallel
+ command: ./bin/build-ci.rb test
+ - store_artifacts:
+ path: /tmp/test-artifacts
+ destination: test-artifacts
+ - store_artifacts:
+ path: /tmp/test-results
+ destination: raw-test-output
+ - store_test_results:
+ path: /tmp/test-results
+ - persist_to_workspace:
+ root: /tmp/workspace
+ paths:
+ - simplecov
send_test_coverage:
<<: *defaults
@@ -122,83 +179,49 @@ jobs:
- attach_workspace:
at: /tmp/workspace
- run:
- name: Allow executing given file
- command: chmod +x << parameters.run_file_path >>
+ name: Download cc-test-reporter
+ command: |
+ mkdir -p tmp/
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
+ chmod +x ./tmp/cc-test-reporter
+ - run:
+ name: Setup ENVs
+ command: |
+ export GIT_BRANCH="$CIRCLE_BRANCH"
+ export GIT_COMMIT_SHA="$CIRCLE_SHA1"
+ export GIT_COMMITTED_AT="$(date +%s)"
+ - run:
+ name: Format test coverage
+ command: |
+ ./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.api.json /tmp/workspace/simplecov/api/.resultset.json
+ ./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.core.json /tmp/workspace/simplecov/core/.resultset.json
+ ./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.emails.json /tmp/workspace/simplecov/emails/.resultset.json
- run:
- name: Send test coverage
- command: bash << parameters.run_file_path >>
-
+ name: Upload coverage results to Code Climate
+ command: |
+ ./tmp/cc-test-reporter sum-coverage tmp/codeclimate.*.json -p 3 -o tmp/codeclimate.total.json
+ ./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.total.json
workflows:
version: 2
main:
jobs:
- - run_test:
- name: bundle_ruby_3_2
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- save_cache_key: spree-bundle-v10-ruby-3-1-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- run_file_path: ./bin/bundle_ruby.sh
- - run_test:
- name: brakeman
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- 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
+ - bundle_ruby_3_2
+ - brakeman:
requires:
- - bundle_ruby_3_2
- - tests_postgres:
- name: tests_ruby_3_2_rails_7_0_postgres
- rails_version: '~> 7.0.0'
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- postgres_image: circleci/postgres:12-alpine
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
+ - bundle_ruby_3_2
+ - tests_ruby_3_2_rails_7_0_postgres:
requires:
- - bundle_ruby_3_2
- - tests_postgres:
- name: tests_ruby_3_2_rails_7_1_postgres
- rails_version: '~> 7.1.0'
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- postgres_image: circleci/postgres:12-alpine
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
+ - bundle_ruby_3_2
+ - tests_ruby_3_2_rails_7_1_postgres:
requires:
- - bundle_ruby_3_2
- - tests_postgres:
- name: tests_ruby_3_2_rails_6_1_postgres
- rails_version: '~> 6.1.0'
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- postgres_image: circleci/postgres:12-alpine
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
+ - bundle_ruby_3_2
+ - tests_ruby_3_2_rails_6_1_postgres:
requires:
- - bundle_ruby_3_2
- - tests_mysql:
- name: tests_ruby_3_2_rails_7_0_mysql
- rails_version: '~> 7.0.0'
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- mysql_image: circleci/mysql:8-ram
- store_artefacts: true
- run_file_path: ./bin/tests_database_ci.sh
- post-steps:
- - persist_to_workspace:
- root: /tmp/workspace
- paths:
- - simplecov
+ - bundle_ruby_3_2
+ - tests_ruby_3_2_rails_7_0_mysql:
requires:
- - bundle_ruby_3_2
+ - bundle_ruby_3_2
- send_test_coverage:
- name: send_test_coverage
- rails_version: '~> 7.0.0'
- ruby_image: cimg/ruby:3.2.0-browsers
- redis_image: circleci/redis:6.2-alpine
- run_file_path: ./bin/tests_coverage.sh
requires:
- - tests_ruby_3_2_rails_7_0_mysql
+ - tests_ruby_3_2_rails_7_0_mysql
\ No newline at end of file
diff --git a/bin/brakeman.sh b/bin/brakeman.sh
deleted file mode 100644
index da72f3e125..0000000000
--- a/bin/brakeman.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -euxo pipefail
-
-./bin/build-ci.rb install
-bundle exec brakeman -p api/ --ignore-config api/brakeman.ignore --skip-files app/controllers/spree/api/v1/ --exit-on-warn --exit-on-error
-bundle exec brakeman -p core/ --ignore-config core/brakeman.ignore --exit-on-warn --exit-on-error
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_coverage.sh b/bin/tests_coverage.sh
deleted file mode 100644
index 880a411f50..0000000000
--- a/bin/tests_coverage.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-set -euxo pipefail
-
-mkdir -p tmp/
-curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
-chmod +x ./tmp/cc-test-reporter
-
-export GIT_BRANCH="$CIRCLE_BRANCH"
-export GIT_COMMIT_SHA="$CIRCLE_SHA1"
-export GIT_COMMITTED_AT="$(date +%s)"
-
-./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.api.json /tmp/workspace/simplecov/api/.resultset.json
-./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.core.json /tmp/workspace/simplecov/core/.resultset.json
-./tmp/cc-test-reporter format-coverage -t simplecov -o tmp/codeclimate.emails.json /tmp/workspace/simplecov/emails/.resultset.json
-
-./tmp/cc-test-reporter sum-coverage tmp/codeclimate.*.json -p 3 -o tmp/codeclimate.total.json
-./tmp/cc-test-reporter upload-coverage -i tmp/codeclimate.total.json
\ No newline at end of file
diff --git a/bin/tests_database_ci.sh b/bin/tests_database_ci.sh
deleted file mode 100644
index 7901979e26..0000000000
--- a/bin/tests_database_ci.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-set -euxo pipefail
-
-if [$DB -eq "mysql"]
-then
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4EB27DB2A3B88B8B
-fi
-
-ls -l /tmp
-
-sudo apt-get update && sudo apt-get install libvips42
-bundle install
-./bin/build-ci.rb install
-./bin/build-ci.rb test