You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.1 KiB
YAML
83 lines
2.1 KiB
YAML
version: 2.1
|
|
|
|
executors:
|
|
ruby:
|
|
working_directory: ~/repo
|
|
docker:
|
|
- image: cimg/ruby:2.7.2-browsers
|
|
environment:
|
|
PGHOST: 127.0.0.1
|
|
PGUSER: postgres
|
|
PGPASS: postgres
|
|
- image: circleci/postgres:12-alpine
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
jobs:
|
|
generate:
|
|
executor: ruby
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
name: Restore yarn cache
|
|
keys:
|
|
- yarn-v2-{{ arch }}
|
|
- run:
|
|
name: Install bundler
|
|
command: |
|
|
gem install bundler --no-document
|
|
bundle config path $HOME/vendor/bundle
|
|
- restore_cache:
|
|
name: Restore bundler cache
|
|
keys:
|
|
- bundle-v2-{{ arch }}
|
|
- run:
|
|
name: Install railties
|
|
command: |
|
|
gem install railties --version "~> 6.0.0" --no-document
|
|
- run:
|
|
name: Configure git
|
|
command: |
|
|
git config --local user.name "Circle CI"
|
|
git config --local user.email ci@example.com
|
|
- run:
|
|
name: Generate app from template
|
|
command: |
|
|
mkdir -p $HOME/scratch
|
|
cd $HOME/scratch
|
|
rails new ci_example -d postgresql -m $HOME/repo/template.rb \<< INPUT
|
|
ci.example.com
|
|
|
|
INPUT
|
|
- run:
|
|
name: Clean bundler
|
|
command: |
|
|
cd $HOME/scratch/ci_example && bundle clean
|
|
- save_cache:
|
|
name: Save bundler cache
|
|
paths:
|
|
- ../vendor/bundle
|
|
key: bundle-v2-{{ arch }}-{{ checksum "../scratch/ci_example/Gemfile.lock" }}
|
|
- save_cache:
|
|
name: Save yarn cache
|
|
paths:
|
|
- ../.cache/yarn
|
|
key: yarn-v2-{{ arch }}-{{ checksum "../scratch/ci_example/yarn.lock" }}
|
|
|
|
workflows:
|
|
version: 2
|
|
commit-workflow:
|
|
jobs:
|
|
- generate
|
|
cron-workflow:
|
|
triggers:
|
|
- schedule:
|
|
cron: "0 13 * * 6"
|
|
filters:
|
|
branches:
|
|
only:
|
|
- main
|
|
jobs:
|
|
- generate
|