scratch-analysis/.circleci/config.yml
2022-09-21 14:41:10 -04:00

75 lines
1.6 KiB
YAML

version: "2.1"
orbs:
slack: circleci/slack@4.1
eb: circleci/aws-elastic-beanstalk@2.0.1
executors:
sapi-executor:
docker:
- image: "cimg/node:16.16.0"
resource_class: medium
aliases:
- &setup
steps:
- checkout
- run: sudo apt-get update
- run:
name: Install deps
command: npm install
- run:
name: Run ci
command: npm ci
- run:
name: Run tests
command: npm test
- &deploy
steps:
- checkout
- run:
name: Publish package
command: npx semantic-release --branches test
- slack/notify:
channel: test-circleci
event: fail
template: basic_fail_1
- slack/notify:
channel: test-circleci
event: pass
template: success_tagged_deploy_1
jobs:
build-and-test:
executor: sapi-executor
<<: *setup
publish-package:
executor: sapi-executor
<<: *deploy
workflows:
build-and-test-api:
jobs:
- build-and-test:
context:
- scratch-analysis
- slack-notifications
when:
not:
or:
- equal: [ master, <<pipeline.git.branch>> ]
- equal: [ develop, <<pipeline.git.branch>> ]
build-and-publish-package:
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ test, << pipeline.git.branch >> ]
jobs:
- build-and-test:
context:
- scratch-analysis
- slack-notifications
- publish-package:
context:
- scratch-analysis
- slack-notifications