> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# codegram/serverless-ruby

An orb to test, build and deploy Ruby serverless applications using the serverless framework and AWS. You need to add the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables to CIrcleCI.


## Commands

### ruby_development_dependencies

Installs Ruby dependencies and keeps a cache

| Parameter | Type | Default | Description |
|---|---|---|---|
| `bundler_version` | string | 2.0.2 |  |
| `cache_key` | string | bundler |  |

### ruby_deployment_dependencies

Installs Ruby dependencies for deployment using LambCI and keeps a cache

| Parameter | Type | Default | Description |
|---|---|---|---|
| `bundler_version` | string | 2.0.2 |  |
| `cache_key` | string | bundler-deployment |  |
| `lambci_image` | string | build-ruby2.5 |  |

### node_dependencies

Installs Node dependencies and keeps a cache

| Parameter | Type | Default | Description |
|---|---|---|---|
| `cache_key` | string | npm |  |

### dynamodb_local

Installs DynamoDB local and keeps a cache

| Parameter | Type | Default | Description |
|---|---|---|---|
| `cache_key` | string | dynamodb-local |  |

### tests

Runs RSpec test suite and uploads tests results

### serverless_deploy

Deploys your service using the Serverless framework

| Parameter | Type | Default | Description |
|---|---|---|---|
| `stage` | string | prod |  |

## Jobs

### test

Installs all the dependencies (including DynamoDB local) and runs the test suite with RSpec

### deploy

Install the minimal dependencies for deployment and deploys your service with the Serverless framework. It uses the same environment as AWS to install Ruby gems so gems with native extensions are correctly compiled.

## Executors

### ruby

## Examples

### main

Uses RSpec to run your tests (you need to add `rspec_junit_formatter` to your test group at the Gemfile) and deploys your service when a commit is merged at master.

```yaml
orbs:
  serverless-ruby: codegram/serverless-ruby@0.0.2
version: 2.1
workflows:
  main:
    jobs:
      - serverless-ruby/test
      - serverless-ruby/deploy:
          requires:
            - serverless-ruby/test
          filters:
            branches:
              only: master
```