Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRY-er config for multiple workflows? #15

Open
bitjson opened this issue Mar 15, 2018 · 1 comment
Open

DRY-er config for multiple workflows? #15

bitjson opened this issue Mar 15, 2018 · 1 comment

Comments

@bitjson
Copy link

bitjson commented Mar 15, 2018

Hi there,

I'm trying to run my tests on multiple versions of Node.js, and I'm noticing how repetitive the config is in this example: https://github.com/CircleCI-Public/circleci-demo-workflows/blob/parallel-jobs/.circleci/config.yml#L8-L34 (Selected: all the lines that are repeated.)

Is there any less repetitive way to define this configuration? Especially for configs with multiple steps, the configuration grows much faster than seems necessary.

Is there some way I could at least define sets of steps and use them? Maybe something like:

version: 2.0

procedures:
  install-and-test:
      - checkout
      - run: bundle install --path vendor/bundle
      - run: bundle exec rake db:create db:schema:load
      - run:
          name: Run tests
          command: rake
jobs:
  "ruby-2.2":
    docker:
      - image: circleci/ruby:2.2-node
      - image: circleci/postgres:9.4.12-alpine
    working_directory: ~/circleci-demo-workflows
    steps:
      - procedure: install-and-test

  "ruby-2.3":
    docker:
      - image: circleci/ruby:2.3-node
      - image: circleci/postgres:9.4.12-alpine
    working_directory: ~/circleci-demo-workflows
    steps:
      - procedure: install-and-test

  "ruby-2.4":
    docker:
      - image: circleci/ruby:2.4-node
      - image: circleci/postgres:9.4.12-alpine
    working_directory: ~/circleci-demo-workflows
    steps:
      - procedure: install-and-test

workflows:
  version: 2
  build:
    jobs:
      - "ruby-2.2"
      - "ruby-2.3"
      - "ruby-2.4"

Thanks!

@cclauss
Copy link

cclauss commented Apr 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants