2021-10-18 03:05:25 -07:00
|
|
|
version: 2.1
|
2018-04-20 04:46:08 -07:00
|
|
|
|
2021-10-18 03:05:25 -07:00
|
|
|
orbs:
|
2022-12-15 09:13:13 -08:00
|
|
|
ruby: circleci/ruby@2.0.0
|
|
|
|
node: circleci/node@5.0.3
|
2021-10-18 03:05:25 -07:00
|
|
|
|
|
|
|
executors:
|
|
|
|
default:
|
|
|
|
parameters:
|
|
|
|
ruby-version:
|
|
|
|
type: string
|
2018-04-20 04:46:08 -07:00
|
|
|
docker:
|
2021-10-18 03:05:25 -07:00
|
|
|
- image: cimg/ruby:<< parameters.ruby-version >>
|
|
|
|
environment:
|
2020-05-01 11:19:01 -07:00
|
|
|
BUNDLE_JOBS: 3
|
|
|
|
BUNDLE_RETRY: 3
|
2021-10-18 03:05:25 -07:00
|
|
|
CONTINUOUS_INTEGRATION: true
|
2018-04-20 04:46:08 -07:00
|
|
|
DB_HOST: localhost
|
|
|
|
DB_USER: root
|
2018-05-09 07:59:58 -07:00
|
|
|
DISABLE_SIMPLECOV: true
|
2021-10-18 03:05:25 -07:00
|
|
|
RAILS_ENV: test
|
2022-12-15 09:13:13 -08:00
|
|
|
- image: cimg/postgres:14.5
|
2021-10-18 03:05:25 -07:00
|
|
|
environment:
|
|
|
|
POSTGRES_USER: root
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2022-12-15 09:13:13 -08:00
|
|
|
- image: cimg/redis:7.0
|
2018-04-23 00:16:26 -07:00
|
|
|
|
2021-10-18 03:05:25 -07:00
|
|
|
commands:
|
|
|
|
install-system-dependencies:
|
2018-04-20 04:46:08 -07:00
|
|
|
steps:
|
2020-05-01 11:19:01 -07:00
|
|
|
- run:
|
2021-10-18 03:05:25 -07:00
|
|
|
name: Install system dependencies
|
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
2022-02-14 07:08:02 -08:00
|
|
|
sudo apt-get install -y libicu-dev libidn11-dev
|
2021-10-18 03:05:25 -07:00
|
|
|
install-ruby-dependencies:
|
|
|
|
parameters:
|
|
|
|
ruby-version:
|
|
|
|
type: string
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
command: |
|
|
|
|
bundle config clean 'true'
|
|
|
|
bundle config frozen 'true'
|
|
|
|
bundle config without 'development production'
|
|
|
|
name: Set bundler settings
|
|
|
|
- ruby/install-deps:
|
2022-12-15 09:13:13 -08:00
|
|
|
bundler-version: '2.3.26'
|
2023-02-14 23:30:27 -08:00
|
|
|
key: ruby<< parameters.ruby-version >>-gems-v2
|
2021-10-18 03:05:25 -07:00
|
|
|
wait-db:
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
command: dockerize -wait tcp://localhost:5432 -wait tcp://localhost:6379 -timeout 1m
|
|
|
|
name: Wait for PostgreSQL and Redis
|
2018-04-20 04:46:08 -07:00
|
|
|
|
|
|
|
jobs:
|
2018-04-23 00:16:26 -07:00
|
|
|
build:
|
2021-10-18 03:05:25 -07:00
|
|
|
docker:
|
2023-02-14 23:30:27 -08:00
|
|
|
- image: cimg/ruby:3.2-node
|
2021-10-18 03:05:25 -07:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: test
|
2018-04-23 00:16:26 -07:00
|
|
|
steps:
|
2021-10-18 03:05:25 -07:00
|
|
|
- checkout
|
|
|
|
- install-system-dependencies
|
|
|
|
- install-ruby-dependencies:
|
2023-02-14 23:30:27 -08:00
|
|
|
ruby-version: '3.2'
|
2021-10-18 03:05:25 -07:00
|
|
|
- node/install-packages:
|
|
|
|
cache-version: v1
|
|
|
|
pkg-manager: yarn
|
2020-05-01 11:19:01 -07:00
|
|
|
- run:
|
2022-11-30 00:56:27 -08:00
|
|
|
command: |
|
|
|
|
export NODE_OPTIONS=--openssl-legacy-provider
|
|
|
|
./bin/rails assets:precompile
|
2021-10-18 03:05:25 -07:00
|
|
|
name: Precompile assets
|
2018-07-30 13:22:55 -07:00
|
|
|
- persist_to_workspace:
|
2018-04-23 00:16:26 -07:00
|
|
|
paths:
|
2021-10-18 03:05:25 -07:00
|
|
|
- public/assets
|
|
|
|
- public/packs-test
|
|
|
|
root: .
|
|
|
|
|
|
|
|
test:
|
|
|
|
parameters:
|
|
|
|
ruby-version:
|
|
|
|
type: string
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
ruby-version: << parameters.ruby-version >>
|
|
|
|
environment:
|
|
|
|
ALLOW_NOPAM: true
|
|
|
|
PAM_ENABLED: true
|
|
|
|
PAM_DEFAULT_SERVICE: pam_test
|
|
|
|
PAM_CONTROLLED_SERVICE: pam_test_controlled
|
|
|
|
parallelism: 4
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- install-system-dependencies
|
|
|
|
- run:
|
2023-02-14 23:30:27 -08:00
|
|
|
command: sudo apt-get install -y ffmpeg imagemagick libmagickcore-dev libmagickwand-dev libjpeg-dev libpng-dev libtiff-dev libwebp-dev libpam-dev
|
2021-10-18 03:05:25 -07:00
|
|
|
name: Install additional system dependencies
|
|
|
|
- run:
|
|
|
|
command: bundle config with 'pam_authentication'
|
|
|
|
name: Enable PAM authentication
|
|
|
|
- install-ruby-dependencies:
|
|
|
|
ruby-version: << parameters.ruby-version >>
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
- wait-db
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:create db:schema:load db:seed
|
|
|
|
name: Load database schema
|
|
|
|
- ruby/rspec-test
|
2018-04-23 00:16:26 -07:00
|
|
|
|
2018-04-20 04:46:08 -07:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-test:
|
|
|
|
jobs:
|
2021-10-18 03:05:25 -07:00
|
|
|
- build
|
|
|
|
- test:
|
|
|
|
matrix:
|
|
|
|
parameters:
|
|
|
|
ruby-version:
|
|
|
|
- '2.7'
|
|
|
|
- '3.0'
|
2023-02-14 23:30:27 -08:00
|
|
|
- '3.1'
|
|
|
|
- '3.2'
|
2021-10-18 03:05:25 -07:00
|
|
|
name: test-ruby<< matrix.ruby-version >>
|
2021-05-06 05:22:54 -07:00
|
|
|
requires:
|
2020-01-09 20:34:25 -08:00
|
|
|
- build
|