Skip to content

Commit

Permalink
Improve CircleCI config (mastodon#16861)
Browse files Browse the repository at this point in the history
* Improve CircleCI config

* Enable PAM only when needed

* Remove Ruby 2.6
  • Loading branch information
ykzts authored and jesseplusplus committed May 17, 2022
1 parent e48fb60 commit f332acd
Showing 1 changed file with 56 additions and 24 deletions.
80 changes: 56 additions & 24 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
version: 2.1

orbs:
<<<<<<< HEAD
ruby: circleci/ruby@1.4.1
node: circleci/node@5.0.1
=======
ruby: circleci/ruby@1.2.0
node: circleci/node@4.7.0
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))

executors:
default:
Expand All @@ -19,11 +24,19 @@ executors:
DB_USER: root
DISABLE_SIMPLECOV: true
RAILS_ENV: test
<<<<<<< HEAD
- image: cimg/postgres:14.0
environment:
POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust
- image: cimg/redis:6.2
=======
- image: cimg/postgres:12.7
environment:
POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))

commands:
install-system-dependencies:
Expand All @@ -32,7 +45,11 @@ commands:
name: Install system dependencies
command: |
sudo apt-get update
<<<<<<< HEAD
sudo apt-get install -y libicu-dev libidn11-dev
=======
sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))
install-ruby-dependencies:
parameters:
ruby-version:
Expand All @@ -45,7 +62,11 @@ commands:
bundle config without 'development production'
name: Set bundler settings
- ruby/install-deps:
<<<<<<< HEAD
bundler-version: '2.3.8'
=======
bundler-version: '2.2.29'
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))
key: ruby<< parameters.ruby-version >>-gems-v1
wait-db:
steps:
Expand All @@ -56,14 +77,22 @@ commands:
jobs:
build:
docker:
<<<<<<< HEAD
- image: cimg/ruby:3.0-node
=======
- image: cimg/ruby:2.7-node
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))
environment:
RAILS_ENV: test
steps:
- checkout
- install-system-dependencies
- install-ruby-dependencies:
<<<<<<< HEAD
ruby-version: '3.0'
=======
ruby-version: '2.7'
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))
- node/install-packages:
cache-version: v1
pkg-manager: yarn
Expand All @@ -89,6 +118,7 @@ jobs:
PAM_DEFAULT_SERVICE: pam_test
PAM_CONTROLLED_SERVICE: pam_test_controlled
parallelism: 4
<<<<<<< HEAD
steps:
- checkout
- install-system-dependencies
Expand Down Expand Up @@ -133,38 +163,40 @@ jobs:
- run:
command: ./bin/rails tests:migrations:populate_v2_4
name: Populate database with test data
=======
steps:
- checkout
- install-system-dependencies
>>>>>>> 4c44dee01 (Improve CircleCI config (#16861))
- run:
command: ./bin/rails db:migrate VERSION=20171010025614
name: Run migrations up to v2.0.0
command: sudo apt-get install -y ffmpeg imagemagick libpam-dev
name: Install additional system dependencies
- run:
command: ./bin/rails tests:migrations:populate_v2
name: Populate database with test data
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:migrate
name: Run all remaining migrations
command: ./bin/rails db:create db:schema:load db:seed
name: Load database schema
- ruby/rspec-test

test-two-step-migrations:
<<: *defaults
docker:
- image: circleci/ruby:2.7-buster-node
environment: *ruby_environment
- image: circleci/postgres:12.2
environment:
POSTGRES_USER: root
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
test-migrations:
executor:
name: default
ruby-version: '2.7'
steps:
- *attach_workspace
- *install_system_dependencies
- checkout
- install-system-dependencies
- install-ruby-dependencies:
ruby-version: '2.7'
- 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
- run:
command: ./bin/rails db:migrate
name: Run all pre-deployment migrations
Expand Down

0 comments on commit f332acd

Please sign in to comment.