mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 15:27:49 +01:00
123 lines
2.7 KiB
YAML
123 lines
2.7 KiB
YAML
version: 2
|
|
jobs:
|
|
test-backend:
|
|
docker:
|
|
- image: circleci/node:14
|
|
- image: circleci/mariadb:latest
|
|
environment:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
|
|
MYSQL_DATABASE: photos_test
|
|
MYSQL_USER: photos
|
|
MYSQL_PASSWORD: photos
|
|
MYSQL_HOST: "localhost"
|
|
|
|
working_directory: ~/photos
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- backend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: install backend deps
|
|
command: npm i
|
|
|
|
- save_cache:
|
|
paths:
|
|
- node_modules
|
|
key: backend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: test backend
|
|
command: npm test
|
|
|
|
test-frontend:
|
|
docker:
|
|
- image: circleci/node:14
|
|
|
|
working_directory: ~/photos/frontend
|
|
|
|
steps:
|
|
- checkout:
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- backend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: install backend deps
|
|
command: npm i
|
|
|
|
- save_cache:
|
|
paths:
|
|
- node_modules
|
|
key: backend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- frontend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: install frontend deps
|
|
command: cd frontend && npm i
|
|
|
|
- save_cache:
|
|
paths:
|
|
- frontend/node_modules
|
|
key: frontend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: test frontend
|
|
command: cd frontend && npm test
|
|
|
|
test-frontend-build:
|
|
docker:
|
|
- image: circleci/node:14
|
|
|
|
working_directory: ~/photos/frontend
|
|
|
|
steps:
|
|
- checkout:
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- backend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: install backend deps
|
|
command: npm i
|
|
|
|
- save_cache:
|
|
paths:
|
|
- node_modules
|
|
key: backend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- restore_cache:
|
|
keys:
|
|
- frontend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: install frontend deps
|
|
command: cd frontend && npm i
|
|
|
|
- save_cache:
|
|
paths:
|
|
- frontend/node_modules
|
|
key: frontend-dependencies-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
name: test frontend
|
|
command: cd frontend && npm run build
|
|
|
|
workflows:
|
|
version: 2
|
|
test:
|
|
jobs:
|
|
- test-backend
|
|
- test-frontend
|
|
- test-frontend-build:
|
|
requires:
|
|
- test-frontend
|