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??
version: 2
jobs:
build:
client_build_and_check:
docker:
- image: circleci/node:latest
working_directory: ~/repo
steps:
- 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
- restore_cache:
@ -29,26 +14,66 @@ jobs:
- 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
- run:
name: build
command: npm run build
- run:
name: flow
name: js flow
command: npm run flow
when: always
- run:
name: eslint
command: npm run eslint
# - store_artifacts:
# path: test-results.xml
# prefix: tests
# - store_artifacts:
# path: coverage
# prefix: coverage
# - store_test_results:
# path: test-results.xml
when: always
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:
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!
# Requirements
No third party dependencies! Just `python 3.6`.
No third party dependencies! Just `python3`.
# Potentional improvements
* 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
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
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
* 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)

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] = []
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
org = as_org(