2021-10-18 11:05:25 +01:00
|
|
|
version: 2.1
|
2018-04-20 12:46:08 +01:00
|
|
|
|
2021-10-18 11:05:25 +01:00
|
|
|
orbs:
|
|
|
|
ruby: circleci/ruby@1.2.0
|
|
|
|
node: circleci/node@4.7.0
|
|
|
|
|
|
|
|
executors:
|
|
|
|
default:
|
|
|
|
parameters:
|
|
|
|
ruby-version:
|
|
|
|
type: string
|
2018-04-20 12:46:08 +01:00
|
|
|
docker:
|
2021-10-18 11:05:25 +01:00
|
|
|
- image: cimg/ruby:<< parameters.ruby-version >>
|
|
|
|
environment:
|
2020-05-01 19:19:01 +01:00
|
|
|
BUNDLE_JOBS: 3
|
|
|
|
BUNDLE_RETRY: 3
|
2021-10-18 11:05:25 +01:00
|
|
|
CONTINUOUS_INTEGRATION: true
|
2018-04-20 12:46:08 +01:00
|
|
|
DB_HOST: localhost
|
|
|
|
DB_USER: root
|
2018-05-09 15:59:58 +01:00
|
|
|
DISABLE_SIMPLECOV: true
|
2021-10-18 11:05:25 +01:00
|
|
|
RAILS_ENV: test
|
2021-11-06 16:13:51 +00:00
|
|
|
- image: cimg/postgres:14.0
|
2021-10-18 11:05:25 +01:00
|
|
|
environment:
|
|
|
|
POSTGRES_USER: root
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2021-11-18 20:59:57 +00:00
|
|
|
- image: circleci/redis:6-alpine
|
2018-04-23 08:16:26 +01:00
|
|
|
|
2021-10-18 11:05:25 +01:00
|
|
|
commands:
|
|
|
|
install-system-dependencies:
|
2018-04-20 12:46:08 +01:00
|
|
|
steps:
|
2020-05-01 19:19:01 +01:00
|
|
|
- run:
|
2021-10-18 11:05:25 +01:00
|
|
|
name: Install system dependencies
|
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
2022-02-14 15:08:02 +00:00
|
|
|
sudo apt-get install -y libicu-dev libidn11-dev
|
2021-10-18 11:05:25 +01: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-02-28 07:44:49 +00:00
|
|
|
bundler-version: '2.3.8'
|
2021-10-18 11:05:25 +01:00
|
|
|
key: ruby<< parameters.ruby-version >>-gems-v1
|
|
|
|
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 12:46:08 +01:00
|
|
|
|
|
|
|
jobs:
|
2018-04-23 08:16:26 +01:00
|
|
|
build:
|
2021-10-18 11:05:25 +01:00
|
|
|
docker:
|
2021-11-18 20:59:57 +00:00
|
|
|
- image: cimg/ruby:3.0-node
|
2021-10-18 11:05:25 +01:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: test
|
2018-04-23 08:16:26 +01:00
|
|
|
steps:
|
2021-10-18 11:05:25 +01:00
|
|
|
- checkout
|
|
|
|
- install-system-dependencies
|
|
|
|
- install-ruby-dependencies:
|
2021-11-18 20:59:57 +00:00
|
|
|
ruby-version: '3.0'
|
2021-10-18 11:05:25 +01:00
|
|
|
- node/install-packages:
|
|
|
|
cache-version: v1
|
|
|
|
pkg-manager: yarn
|
2020-05-01 19:19:01 +01:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails assets:precompile
|
2021-10-18 11:05:25 +01:00
|
|
|
name: Precompile assets
|
2018-07-30 21:22:55 +01:00
|
|
|
- persist_to_workspace:
|
2018-04-23 08:16:26 +01:00
|
|
|
paths:
|
2021-10-18 11:05:25 +01: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:
|
|
|
|
command: sudo apt-get install -y ffmpeg imagemagick libpam-dev
|
|
|
|
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 08:16:26 +01:00
|
|
|
|
2020-01-11 01:04:57 +00:00
|
|
|
test-migrations:
|
2021-10-18 11:05:25 +01:00
|
|
|
executor:
|
|
|
|
name: default
|
2021-11-18 20:59:57 +00:00
|
|
|
ruby-version: '3.0'
|
2020-01-11 01:04:57 +00:00
|
|
|
steps:
|
2021-10-18 11:05:25 +01:00
|
|
|
- checkout
|
|
|
|
- install-system-dependencies
|
|
|
|
- install-ruby-dependencies:
|
2021-11-18 20:59:57 +00:00
|
|
|
ruby-version: '3.0'
|
2021-10-18 11:05:25 +01:00
|
|
|
- wait-db
|
2020-01-11 01:04:57 +00:00
|
|
|
- run:
|
2020-05-01 19:19:01 +01:00
|
|
|
command: ./bin/rails db:create
|
2021-10-18 11:05:25 +01:00
|
|
|
name: Create database
|
2022-01-30 22:50:08 +00:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:migrate VERSION=20171010025614
|
|
|
|
name: Run migrations up to v2.0.0
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails tests:migrations:populate_v2
|
|
|
|
name: Populate database with test data
|
2022-03-07 22:40:55 +00:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:migrate VERSION=20180514140000
|
|
|
|
name: Run migrations up to v2.4.0
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails tests:migrations:populate_v2_4
|
|
|
|
name: Populate database with test data
|
2020-01-11 01:04:57 +00:00
|
|
|
- run:
|
2020-05-01 19:19:01 +01:00
|
|
|
command: ./bin/rails db:migrate
|
2022-01-30 22:50:08 +00:00
|
|
|
name: Run all remaining migrations
|
2022-03-07 22:40:55 +00:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails tests:migrations:check_database
|
|
|
|
name: Check migration result
|
2022-01-30 22:50:08 +00:00
|
|
|
|
|
|
|
test-two-step-migrations:
|
|
|
|
executor:
|
|
|
|
name: default
|
|
|
|
ruby-version: '3.0'
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- install-system-dependencies
|
|
|
|
- install-ruby-dependencies:
|
|
|
|
ruby-version: '3.0'
|
|
|
|
- wait-db
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:create
|
|
|
|
name: Create database
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:migrate VERSION=20171010025614
|
|
|
|
name: Run migrations up to v2.0.0
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails tests:migrations:populate_v2
|
|
|
|
name: Populate database with test data
|
2022-03-07 22:40:55 +00:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:migrate VERSION=20180514140000
|
|
|
|
name: Run pre-deployment migrations up to v2.4.0
|
|
|
|
environment:
|
|
|
|
SKIP_POST_DEPLOYMENT_MIGRATIONS: true
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails tests:migrations:populate_v2_4
|
|
|
|
name: Populate database with test data
|
2022-01-30 22:50:08 +00:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:migrate
|
|
|
|
name: Run all pre-deployment migrations
|
2022-03-06 21:51:40 +00:00
|
|
|
environment:
|
2022-01-30 22:50:08 +00:00
|
|
|
SKIP_POST_DEPLOYMENT_MIGRATIONS: true
|
|
|
|
- run:
|
|
|
|
command: ./bin/rails db:migrate
|
|
|
|
name: Run all post-deployment remaining migrations
|
2022-03-07 22:40:55 +00:00
|
|
|
- run:
|
|
|
|
command: ./bin/rails tests:migrations:check_database
|
|
|
|
name: Check migration result
|
2018-04-20 12:46:08 +01:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-test:
|
|
|
|
jobs:
|
2021-10-18 11:05:25 +01:00
|
|
|
- build
|
|
|
|
- test:
|
|
|
|
matrix:
|
|
|
|
parameters:
|
|
|
|
ruby-version:
|
|
|
|
- '2.7'
|
|
|
|
- '3.0'
|
|
|
|
name: test-ruby<< matrix.ruby-version >>
|
2021-05-06 13:22:54 +01:00
|
|
|
requires:
|
2020-01-10 04:34:25 +00:00
|
|
|
- build
|
2021-10-18 11:05:25 +01:00
|
|
|
- test-migrations:
|
2018-12-29 06:23:07 +00:00
|
|
|
requires:
|
|
|
|
- build
|
2022-01-30 22:50:08 +00:00
|
|
|
- test-two-step-migrations:
|
|
|
|
requires:
|
|
|
|
- build
|
2021-10-18 11:05:25 +01:00
|
|
|
- node/run:
|
|
|
|
cache-version: v1
|
|
|
|
name: test-webui
|
|
|
|
pkg-manager: yarn
|
2021-05-06 13:22:54 +01:00
|
|
|
requires:
|
|
|
|
- build
|
2021-10-18 11:05:25 +01:00
|
|
|
version: lts
|
|
|
|
yarn-run: test:jest
|