Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 59 additions & 188 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,294 +1,171 @@
version: 2

jobs:
bot_test:
go_build:
docker:
- image: python:3.7
- image: circleci/redis:5.0
- image: cimg/go:1.26
- image: cimg/redis:7.0
steps:
- checkout
# https://circleci.com/docs/2.0/caching/
- restore_cache:
keys:
- bot-v1-{{ checksum "bot/poetry.lock" }}
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: install dependencies
working_directory: bot
command: |
# Use our new PATH so we can call poetry from bash
echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV
source $BASH_ENV
command -v poetry || python -m pip install --user poetry==0.12.12
poetry install
name: build
command: go build ./...
- run:
name: vet
command: go vet ./...
- run:
name: test
command: go test ./...
- save_cache:
paths:
- ./bot/.mypy_cache
- /root/.cache/
key: bot-v1-{{ checksum "bot/poetry.lock" }}
- run:
name: run tests
working_directory: bot
command: ./s/test
- /home/circleci/go/pkg/mod
key: go-mod-v1-{{ checksum "go.sum" }}

bot_lint:
go_docker_bot:
docker:
- image: python:3.7
- image: docker:24-cli
steps:
- checkout
# https://circleci.com/docs/2.0/caching/
- restore_cache:
keys:
- bot-v1-{{ checksum "bot/poetry.lock" }}
- run:
name: install dependencies
working_directory: bot
command: |
# Use our new PATH so we can call poetry from bash
echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV
source $BASH_ENV
command -v poetry || python -m pip install --user poetry==0.12.12
poetry install
- save_cache:
paths:
- ./bot/.mypy_cache
- /root/.cache/
key: bot-v1-{{ checksum "bot/poetry.lock" }}
- setup_remote_docker
- run:
name: run lints
working_directory: bot
command: ./s/lint
name: build bot image
command: docker build -f Dockerfile.bot -t kodiak-bot:$CIRCLE_SHA1 .

# https://circleci.com/docs/2.0/building-docker-images/
bot_build_container:
go_docker_webapi:
docker:
- image: docker:18.05.0-ce
- image: docker:24-cli
steps:
- checkout
- setup_remote_docker
- run:
name: build container
working_directory: bot
command: ./s/build
name: build webapi image
command: docker build -f Dockerfile.webapi -t kodiak-webapi:$CIRCLE_SHA1 .

docs_typecheck:
docker:
- image: circleci/node:12.4.0
- image: cimg/node:18.18
steps:
- checkout
- restore_cache:
keys:
- docs-site-v1-{{ checksum "docs/yarn.lock" }}
- docs-site-v2-{{ checksum "docs/yarn.lock" }}
- run:
name: install dependencies
working_directory: docs
command: |
yarn install --frozen-lockfile --non-interactive
command: yarn install --frozen-lockfile --non-interactive
- save_cache:
paths:
- ./docs/node_modules
key: docs-site-v1-{{ checksum "docs/yarn.lock" }}
key: docs-site-v2-{{ checksum "docs/yarn.lock" }}
- run:
name: run typechecker
name: typecheck
working_directory: docs
command: |
yarn typecheck
command: yarn typecheck

docs_fmt:
docker:
- image: circleci/node:12.4.0
- image: cimg/node:18.18
steps:
- checkout
- restore_cache:
keys:
- docs-site-v1-{{ checksum "docs/yarn.lock" }}
- docs-site-v2-{{ checksum "docs/yarn.lock" }}
- run:
name: install dependencies
working_directory: docs
command: yarn install --frozen-lockfile --non-interactive
- save_cache:
paths:
- ./docs/node_modules
key: docs-site-v1-{{ checksum "docs/yarn.lock" }}
- run:
name: run fmt
working_directory: docs
command: yarn fmt-ci

docs_build:
docker:
- image: circleci/node:12.4.0
- image: cimg/node:18.18
steps:
- checkout
- restore_cache:
keys:
- docs-site-v1-{{ checksum "docs/yarn.lock" }}
- docs-site-v2-{{ checksum "docs/yarn.lock" }}
- run:
name: install dependencies
working_directory: docs
command: yarn install --frozen-lockfile --non-interactive
- save_cache:
paths:
- ./docs/node_modules
key: docs-site-v1-{{ checksum "docs/yarn.lock" }}
- run:
name: build
working_directory: docs
command: yarn build

web_api_test:
docker:
- image: python:3.7
- image: circleci/postgres:12-ram
environment:
POSTGRES_DB: web_api_test
POSTGRES_PASSWORD: my_test_postgres_password
- image: circleci/redis:5.0
environment:
DATABASE_URL: postgres://postgres:my_test_postgres_password@127.0.0.1:5432/web_api_test
steps:
- checkout
# https://circleci.com/docs/2.0/caching/
- restore_cache:
keys:
- web_api-v1-{{ checksum "web_api/poetry.lock" }}
- run:
name: install dependencies
working_directory: web_api
command: |
# Use our new PATH so we can call poetry from bash
echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV
source $BASH_ENV
command -v poetry || python -m pip install --user poetry==0.12.12
poetry install
- save_cache:
paths:
- ./web_api/.mypy_cache
- /root/.cache/
key: web_api-v1-{{ checksum "web_api/poetry.lock" }}
- run:
name: run tests
working_directory: web_api
command: ./s/test

web_api_lint:
docker:
- image: python:3.7
steps:
- checkout
# https://circleci.com/docs/2.0/caching/
- restore_cache:
keys:
- web_api-v1-{{ checksum "web_api/poetry.lock" }}
- run:
name: install dependencies
working_directory: web_api
command: |
# Use our new PATH so we can call poetry from bash
echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV
source $BASH_ENV
command -v poetry || python -m pip install --user poetry==0.12.12
poetry install
- save_cache:
paths:
- ./web_api/.mypy_cache
- /root/.cache/
key: web_api-v1-{{ checksum "web_api/poetry.lock" }}
- run:
name: run lints
working_directory: web_api
command: ./s/lint

# https://circleci.com/docs/2.0/building-docker-images/
web_api_build_container:
docker:
- image: docker:18.05.0-ce
steps:
- checkout
- setup_remote_docker
- run:
name: build container
working_directory: web_api
command: ./s/build

web_ui_lint:
docker:
- image: circleci/node:12.4.0
- image: cimg/node:18.18
steps:
- checkout
- restore_cache:
keys:
- web-ui-v1-{{ checksum "web_ui/yarn.lock" }}
- web-ui-v2-{{ checksum "web_ui/yarn.lock" }}
- run:
name: install dependencies
working_directory: web_ui
command: yarn install --frozen-lockfile --non-interactive
- save_cache:
paths:
- ./web_ui/node_modules
key: docs-site-v1-{{ checksum "web_ui/yarn.lock" }}
key: web-ui-v2-{{ checksum "web_ui/yarn.lock" }}
- run:
name: lint
working_directory: web_ui
command: ./s/lint

web_ui_test:
docker:
- image: circleci/node:12.4.0
- image: cimg/node:18.18
steps:
- checkout
- restore_cache:
keys:
- web-ui-v1-{{ checksum "web_ui/yarn.lock" }}
- web-ui-v2-{{ checksum "web_ui/yarn.lock" }}
- run:
name: install dependencies
working_directory: web_ui
command: yarn install --frozen-lockfile --non-interactive
- save_cache:
paths:
- ./web_ui/node_modules
key: docs-site-v1-{{ checksum "web_ui/yarn.lock" }}
- run:
name: test
working_directory: web_ui
command: ./s/test

shellcheck:
web_ui_build_container:
docker:
- image: ubuntu:18.04
- image: docker:24-cli
steps:
- checkout
- setup_remote_docker
- run:
name: install dependencies
command: |
apt-get update
apt-get install -y git shellcheck
- run:
name: run shellcheck
command: |
./s/shellcheck
working_directory: web_ui
command: ./s/build

# https://circleci.com/docs/2.0/building-docker-images/
web_ui_build_container:
shellcheck:
docker:
- image: docker:18.05.0-ce
- image: ubuntu:22.04
steps:
- checkout
- setup_remote_docker
- run:
name: build container
working_directory: web_ui
command: ./s/build
name: install shellcheck
command: apt-get update && apt-get install -y git shellcheck
- run:
command: ./s/shellcheck

workflows:
version: 2
all:
jobs:
- shellcheck
bot:

go:
jobs:
- bot_test
- bot_lint
- bot_build_container
- go_build
- go_docker_bot:
requires:
- go_build
- go_docker_webapi:
requires:
- go_build

docs:
jobs:
- docs_typecheck
Expand All @@ -300,9 +177,3 @@ workflows:
- web_ui_lint
- web_ui_test
- web_ui_build_container

web_api:
jobs:
- web_api_test
- web_api_lint
- web_api_build_container
Loading
Loading