Skip to content

Commit 8b31ee4

Browse files
Circleci (#2)
* changed cache location * pipenv is wonderful * build runs tests and formatters for java/python
1 parent 294ed4e commit 8b31ee4

14 files changed

+377
-128
lines changed

.circleci/config.yml

+48-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#
55
version: 2
66
jobs:
7-
build:
7+
build-java:
88
docker:
99
# specify the version you desire here
10-
- image: circleci/openjdk:8-jdk
10+
- image: circleci/openjdk:8u171-jdk
1111

1212
# Specify service dependencies here if necessary
1313
# CircleCI maintains a library of pre-built images
@@ -26,16 +26,57 @@ jobs:
2626
# Download and cache dependencies
2727
- restore_cache:
2828
keys:
29-
- v1-dependencies-{{ checksum "pom.xml" }}
29+
- v1-dependencies-{{ checksum "java/pom.xml" }}
3030
# fallback to using the latest cache if no exact match is found
3131
- v1-dependencies-
32-
- run: cd java
33-
- run: mvn dependency:go-offline
32+
- run: cd java && mvn dependency:go-offline
3433

3534
- save_cache:
3635
paths:
3736
- ~/.m2
38-
key: v1-dependencies-{{ checksum "pom.xml" }}
37+
key: v1-dependencies-{{ checksum "java/pom.xml" }}
3938

4039
# run tests!
41-
- run: mvn clean test
40+
- run: cd java && mvn clean test && mvn clean install
41+
42+
build-python: # runs not using Workflows must have a `build` job as entry point
43+
# directory where steps are run
44+
working_directory: ~/repo
45+
docker: # run the steps with Docker
46+
# CircleCI Python images available at: https://hub.docker.com/r/circleci/python/
47+
- image: circleci/python:3.7.2
48+
environment: # environment variables for primary container
49+
PIPENV_VENV_IN_PROJECT: true
50+
steps: # steps that comprise the `build` job
51+
- checkout # check out source code to working directory
52+
- run: sudo chown -R circleci:circleci /usr/local/bin
53+
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
54+
- restore_cache:
55+
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
56+
key: deps9-{{ .Branch }}-{{ checksum "python/Pipfile.lock" }}
57+
- run:
58+
command: |
59+
sudo pip install pipenv
60+
cd python && pipenv install --dev
61+
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
62+
key: deps9-{{ .Branch }}-{{ checksum "python/Pipfile.lock" }}
63+
paths:
64+
- ".venv"
65+
- "/usr/local/bin"
66+
- "/usr/local/lib/python3.7/site-packages"
67+
- run:
68+
command: |
69+
cd python && pipenv run flake8 ./
70+
- run:
71+
command: |
72+
cd python && pipenv run black --check .
73+
- run:
74+
command: |
75+
cd python && pipenv run python -m unittest tests/*.py
76+
77+
workflows:
78+
version: 2
79+
master:
80+
jobs:
81+
- build-java
82+
- build-python

java/README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77

88
`mvn clean install`
99

10-
This project is formatted with https://google.github.io/styleguide/javaguide.html, which is automatically taken care of by a maven plugin on build.
10+
This project is formatted with https://google.github.io/styleguide/javaguide.html. Builds will fail if you don't use this format.
11+
12+
```
13+
brew install google-java-format
14+
google-java-format --replace **/*.java
15+
```
1116

1217
If you want your IDE to follow this format:
1318

1419
**VS Code setup**
1520

16-
* Change the indent size to 2.
17-
* Add to following to your settings
18-
```
19-
"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml",
20-
```
21-
22-
21+
https://github.com/redhat-developer/vscode-java/issues/419#issuecomment-360820321
2322

2423
**Intellij/Eclipse**
2524

java/pom.xml

+80-80
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project
3-
xmlns="http://maven.apache.org/POM/4.0.0"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
6-
<modelVersion>4.0.0</modelVersion>
7-
<groupId>org.numenta</groupId>
8-
<artifactId>2d-object-recognizer</artifactId>
9-
<version>1.0-SNAPSHOT</version>
10-
<name>2d-object-recognizer</name>
11-
<properties>
12-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<maven.compiler.source>1.7</maven.compiler.source>
14-
<maven.compiler.target>1.7</maven.compiler.target>
15-
</properties>
16-
<dependencies>
17-
<dependency>
18-
<groupId>junit</groupId>
19-
<artifactId>junit</artifactId>
20-
<version>4.11</version>
21-
<scope>test</scope>
22-
</dependency>
23-
</dependencies>
24-
<build>
25-
<plugins>
26-
<plugin>
27-
<groupId>com.coveo</groupId>
28-
<artifactId>fmt-maven-plugin</artifactId>
29-
<version>2.8</version>
30-
<executions>
31-
<execution>
32-
<goals>
33-
<goal>format</goal>
34-
</goals>
35-
</execution>
36-
</executions>
37-
</plugin>
38-
</plugins>
39-
<pluginManagement>
40-
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
41-
<plugins>
42-
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
43-
<plugin>
44-
<artifactId>maven-clean-plugin</artifactId>
45-
<version>3.1.0</version>
46-
</plugin>
47-
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
48-
<plugin>
49-
<artifactId>maven-resources-plugin</artifactId>
50-
<version>3.0.2</version>
51-
</plugin>
52-
<plugin>
53-
<artifactId>maven-compiler-plugin</artifactId>
54-
<version>3.8.0</version>
55-
</plugin>
56-
<plugin>
57-
<artifactId>maven-surefire-plugin</artifactId>
58-
<version>2.22.1</version>
59-
</plugin>
60-
<plugin>
61-
<artifactId>maven-jar-plugin</artifactId>
62-
<version>3.0.2</version>
63-
</plugin>
64-
<plugin>
65-
<artifactId>maven-install-plugin</artifactId>
66-
<version>2.5.2</version>
67-
</plugin>
68-
<plugin>
69-
<artifactId>maven-deploy-plugin</artifactId>
70-
<version>2.8.2</version>
71-
</plugin>
72-
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
73-
<plugin>
74-
<artifactId>maven-site-plugin</artifactId>
75-
<version>3.7.1</version>
76-
</plugin>
77-
<plugin>
78-
<artifactId>maven-project-info-reports-plugin</artifactId>
79-
<version>3.0.0</version>
80-
</plugin>
81-
</plugins>
82-
</pluginManagement>
83-
</build>
6+
<modelVersion>4.0.0</modelVersion>
7+
<groupId>org.numenta</groupId>
8+
<artifactId>2d-object-recognizer</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<name>2d-object-recognizer</name>
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<maven.compiler.source>1.7</maven.compiler.source>
14+
<maven.compiler.target>1.7</maven.compiler.target>
15+
</properties>
16+
<dependencies>
17+
<dependency>
18+
<groupId>junit</groupId>
19+
<artifactId>junit</artifactId>
20+
<version>4.11</version>
21+
<scope>test</scope>
22+
</dependency>
23+
</dependencies>
24+
<build>
25+
<plugins>
26+
<plugin>
27+
<groupId>com.coveo</groupId>
28+
<artifactId>fmt-maven-plugin</artifactId>
29+
<version>2.8</version>
30+
<executions>
31+
<execution>
32+
<goals>
33+
<goal>check</goal>
34+
</goals>
35+
</execution>
36+
</executions>
37+
</plugin>
38+
</plugins>
39+
<pluginManagement>
40+
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
41+
<plugins>
42+
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
43+
<plugin>
44+
<artifactId>maven-clean-plugin</artifactId>
45+
<version>3.1.0</version>
46+
</plugin>
47+
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
48+
<plugin>
49+
<artifactId>maven-resources-plugin</artifactId>
50+
<version>3.0.2</version>
51+
</plugin>
52+
<plugin>
53+
<artifactId>maven-compiler-plugin</artifactId>
54+
<version>3.8.0</version>
55+
</plugin>
56+
<plugin>
57+
<artifactId>maven-surefire-plugin</artifactId>
58+
<version>2.22.1</version>
59+
</plugin>
60+
<plugin>
61+
<artifactId>maven-jar-plugin</artifactId>
62+
<version>3.0.2</version>
63+
</plugin>
64+
<plugin>
65+
<artifactId>maven-install-plugin</artifactId>
66+
<version>2.5.2</version>
67+
</plugin>
68+
<plugin>
69+
<artifactId>maven-deploy-plugin</artifactId>
70+
<version>2.8.2</version>
71+
</plugin>
72+
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
73+
<plugin>
74+
<artifactId>maven-site-plugin</artifactId>
75+
<version>3.7.1</version>
76+
</plugin>
77+
<plugin>
78+
<artifactId>maven-project-info-reports-plugin</artifactId>
79+
<version>3.0.0</version>
80+
</plugin>
81+
</plugins>
82+
</pluginManagement>
83+
</build>
8484
</project>

python/.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
exclude = .git,*migrations*,.venv
3+
max-line-length = 119

python/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ __pycache__/
44
.vscode/
55
.idea/
66
venv/
7-
7+
test-reports

python/Pipfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[[source]]
2+
name = "pypi"
3+
url = "https://pypi.org/simple"
4+
verify_ssl = true
5+
6+
[dev-packages]
7+
pytest = "*"
8+
flake8 = "*"
9+
black = "*"
10+
11+
[packages]
12+
PyYAML = "*"
13+
14+
[requires]
15+
python_version = "3.7"
16+
17+
[pipenv]
18+
allow_prereleases = true

0 commit comments

Comments
 (0)