grasp/.circleci/config.yml
2019-06-29 19:11:32 +01:00

97 lines
2.6 KiB
YAML

# TODO should I use yarn as in circleci node example??
version: 2
jobs:
client_build_and_check:
docker:
- image: circleci/node:latest
steps:
- checkout
- run: sudo npm install -g npm
- restore_cache:
keys:
- dependency-cache-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- dependency-cache-
- run: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run: npm run build
# TODO ugh. is there a way for a job to inherit a cloned repo after npm run build has ran?? I'd like to separate build and check steps
# TODO ok, apparently it's a custom executor? https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
- run:
name: js flow
command: npm run flow
when: always
- run:
name: eslint
command: npm run eslint
when: always
- run:
# TODO need to do some kind of build matrix over [firefox, chrome] x [anyhost, no_anyhost]
# it should be somehow achievable via workspaces, but I've spent 10 minutes and couldn't figure it out...
name: pack
command: |
for browser in 'chrome'; do
zip -r -j "/tmp/grasp.zip" build/*
done
# TODO ugh, also can't use env variables in artifacts...
- store_artifacts:
path: "/tmp/grasp.zip"
destination: "grasp.zip"
server_build_and_check:
docker:
- image: circleci/python:latest
steps:
- checkout
# TODO preserve apt cache..
- run: sudo apt install python3-pip
- run: python3 -m pip install --user mypy pylint pytest
- run: sudo apt install httpie # only used for tests
- run:
name: pylint
command: ci/pylint
when: always
- run:
name: mypy
command: ci/mypy
when: always
- run:
name: pytest
command: ci/pytest
when: always
workflows:
version: 2
build_and_test:
jobs:
- client_build_and_check
- server_build_and_check
# # ugh. circleci only got python3.6 on this node package??? and it's unclear how to combine multiple circleci docker configurations...
# # - store_artifacts:
# # path: test-results.xml
# # prefix: tests
# # - store_artifacts:
# # path: coverage
# # prefix: coverage
# # - store_test_results:
# # path: test-results.xml