.circleci/config.yml
version: 2.1
orbs:
pulumi: pulumi/pulumi@2.0.0
jobs:
build_26: &build
docker:
- image: circleci/ruby:2.6-node
steps:
- checkout
# Ensure Pulumi CLI is available for use
- pulumi/login
# Install dependencies
- restore_cache:
keys:
- kitchen-pulumi-dependencies-{{ checksum "Gemfile.lock" }}
- kitchen-pulumi-dependencies
- run: gem install bundler:2.2.7 && bundle check || bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- vendor/bundle
key: kitchen-pulumi-dependencies-{{ checksum "Gemfile.lock" }}
# Lint
- run: bundle exec rake lint
- run:
name: Install Code Climate Test Reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
# Run unit tests
- run:
name: Install Code Climate Test Reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run:
name: Run Tests
command: |
mkdir /tmp/test-results
./cc-test-reporter before-build
bundle exec rake npm_install && bundle exec rake spec
- run:
name: Code Climate Test Coverage
command: |
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
# collect reports
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results
- deploy:
command: |
./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
# Run integration tests
- run: bundle exec rake integration_test
build_27:
<<: *build
docker:
- image: circleci/ruby:2.7-node
release_gem:
docker:
- image: circleci/ruby:2.7-node
steps:
- checkout
# Install dependencies
- restore_cache:
keys:
- kitchen-pulumi-dependencies-{{ checksum "Gemfile.lock" }}
- kitchen-pulumi-dependencies
- run: bundle check || bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- vendor/bundle
key: kitchen-pulumi-dependencies-{{ checksum "Gemfile.lock" }}
- run:
name: Build Gem
command: bundle exec gem build kitchen-pulumi.gemspec
- run:
name: Deploy Gem
command: |
mkdir ~/.gem
cat .circleci/gem_credentials | sed -e "s/__RUBYGEMS_API_KEY__/${GEM_API_KEY}/" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials
bundle exec gem push kitchen-pulumi-*.gem
shred -u ~/.gem/credentials
workflows:
build:
jobs:
- build_26:
filters:
tags:
only: /.*/
- build_27:
filters:
tags:
only: /.*/
- release_gem:
requires:
- build_26
- build_27
filters:
tags:
only: /v.*/
branches:
ignore: /.*/