enable server part CI

This commit is contained in:
Dima Gerasimov 2019-06-29 14:44:54 +01:00 committed by Dmitrii Gerasimov
parent c3ccb212e8
commit cc39a626a9
7 changed files with 86 additions and 48 deletions

View file

@ -1,27 +1,12 @@
# TODO should I use yarn as in circleci node example?? # TODO should I use yarn as in circleci node example??
version: 2 version: 2
jobs: jobs:
build: client_build_and_check:
docker: docker:
- image: circleci/node:latest - image: circleci/node:latest
working_directory: ~/repo
steps: steps:
- checkout - checkout
# ugh. circleci only got python3.6 on this node package??? and it's unclear how to combine multiple circleci docker configurations...
# - run: |
# sudo apt install python3-pip
# sudo python3 -m pip install pylint mypy
# - run:
# name: pylint
# command: python3 -m pylint -E server/grasp_server.py
# - run:
# name: mypy
# command: python3 -m mypy server/grasp_server.py
- run: sudo npm install -g npm - run: sudo npm install -g npm
- restore_cache: - restore_cache:
@ -29,26 +14,66 @@ jobs:
- dependency-cache-{{ checksum "package.json" }} - dependency-cache-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found # fallback to using the latest cache if no exact match is found
- dependency-cache- - dependency-cache-
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dependency-cache-{{ checksum "package.json" }} key: dependency-cache-{{ checksum "package.json" }}
paths: paths:
- ./node_modules - ./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
- run: - run:
name: build name: js flow
command: npm run build
- run:
name: flow
command: npm run flow command: npm run flow
when: always
- run: - run:
name: eslint name: eslint
command: npm run eslint command: npm run eslint
# - store_artifacts: when: always
# path: test-results.xml
# prefix: tests
# - store_artifacts: server_build_and_check:
# path: coverage docker:
# prefix: coverage - image: circleci/python:latest
# - store_test_results: steps:
# path: test-results.xml - checkout
# TODO preserve apt cache..
- run: sudo apt install python3-pip
- run: python3 -m pip install --user mypy pylint pytest
- 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

View file

@ -46,12 +46,19 @@ The only downside so far is that it's not as well integrated with emacs as its b
However, if that's a stopper for you, please let me know, I could come up with something! However, if that's a stopper for you, please let me know, I could come up with something!
# Requirements # Requirements
No third party dependencies! Just `python 3.6`. No third party dependencies! Just `python3`.
# Potentional improvements # Potentional improvements
* see [todos](./TODO.org) * see [todos](./TODO.org)
# Permissions used
* `storage` for settings
* `notifications` for showing error notification
* `activeTab` for requesting url, title and selected text
* `http://localhost/capture` for talking with backend
* `content_security_policy` needed for webpack
# Building extension # Building extension
The most up-to-date instructions should be in [CI config](./.circleci/config.yml). The most up-to-date instructions should be in [CI config](./.circleci/config.yml).
@ -68,14 +75,6 @@ If you do need unresticted url permissions, build the extensions like that: `ANY
## building for Firefox ## building for Firefox
Default target is Chrome. use `TARGET=firefox npm run build` to build for firefox. The code is actually same, the only differences are minor appearance adjustments in manifest. Default target is Chrome. use `TARGET=firefox npm run build` to build for firefox. The code is actually same, the only differences are minor appearance adjustments in manifest.
# Permissions used
* `storage` for settings
* `notifications` for showing error notification
* `activeTab` for requesting url, title and selected text
* `http://localhost/capture` for talking with backend
* `content_security_policy` needed for webpack.
# Credits # Credits
* Icon made by <a href="https://www.freepik.com/" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>, licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a> * Icon made by <a href="https://www.freepik.com/" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>, licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a>
* [Original Org Capture extension](https://github.com/sprig/org-capture-extension) * [Original Org Capture extension](https://github.com/sprig/org-capture-extension)

8
ci/mypy Executable file
View file

@ -0,0 +1,8 @@
#!/bin/bash
set -eux
# TODO ugh. doesn't work from circleci...
# cd "$(git rev-parse --show-toplevel)"
# TODO use strict?
python3 -m mypy --check-untyped-defs "$@" server/*.py server/setup

7
ci/pylint Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -eux
# TODO ugh. doesn't work from circleci...
# cd "$(git rev-parse --show-toplevel)"
python3 -m pylint -E "$@" server/*.py server/setup

7
ci/pytest Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -eux
# cd "$(git rev-parse --show-toplevel)"
python3 -m pytest "$@" server/*.py
# TODO force it to collect server/setup

View file

@ -1,8 +0,0 @@
#!/bin/bash
set -eux
# TODO add to proper ci pipeline
pylint -E *.py setup
mypy --check-untyped-defs *.py setup
pytest -s org_tools.py

View file

@ -58,7 +58,7 @@ def capture(
tags: List[str] = [] tags: List[str] = []
if not empty(tag_str): if not empty(tag_str):
tags = re.split('[\s,]', tag_str) tags = re.split(r'[\s,]', tag_str)
tags = [t for t in tags if not empty(t)] # just in case tags = [t for t in tags if not empty(t)] # just in case
org = as_org( org = as_org(