Skip to content

Commit 04958a3

Browse files
author
Anders Breid
authored
Add codacy configuration (#266)
* Add codacy configuration * Add coverage in .travis, add cobertura plugin * Add badgers Closes #247
1 parent 67b006e commit 04958a3

File tree

5 files changed

+79
-56
lines changed

5 files changed

+79
-56
lines changed

.codacy.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
exclude_paths:
2+
- '.bundle/**'
3+
- 'spec/**/*'
4+
- 'benchmarks/**/*'
5+
- '*.min.js'
6+
- '**/assets/**/*'
7+
- '**/tests/**'
8+
- '**/integrationtest/**/*'
9+
- 'wiki/**'
10+
- '.github/**'
11+
- 'CODE_OF_CONDUCT.md'
12+
- 'CONTRIBUTING.md'

.travis.yml

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,29 @@ git:
1515
env:
1616
- EI_BACKEND_PORT=8099 JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
1717

18-
19-
# Using default 'test' stage for our tests, and only running deploy stage
20-
# (after merge) on master branch
21-
stages:
22-
- test
23-
- name: deploy
24-
if: branch = master
25-
26-
2718
before_install:
2819
- sudo apt-get update
2920
- sudo apt-get install -y openjdk-8-jdk
3021
- export PATH=$(echo "$PATH" | sed -e 's/:\/usr\/local\/lib\/jvm\/openjdk11\/bin//')
3122
- export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
3223
- export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
3324
- java -version
34-
- |
35-
if [[ $TRAVIS_JOB_NAME = integrationTests ]]; then
36-
source src/main/docker/env.bash
37-
docker-compose -f src/main/docker/docker-compose.yml up -d eiffel-er mongodb rabbitmq jenkins mail-server ldap ldap-seed ldap2 ldap2-seed
38-
fi
3925

26+
# Using default 'test' stage for our tests, and only running deploy stage
27+
# (after merge) on master branch
28+
stages:
29+
- test
30+
- name: report_coverage
31+
if: branch = master AND type != pull_request
32+
- name: deploy
33+
if: branch = master AND type != pull_request
4034

4135
# Only used before integrationTests
42-
install:
43-
- git clone --depth=50 --branch=master https://github.com/eiffel-community/eiffel-intelligence.git
44-
- cd eiffel-intelligence
45-
- chmod +x pom.xml
46-
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
47-
- export EIFFEL_WAR=$(ls target/*.war)
48-
- java -Dspring.config.additional-location=file:../src/integrationtest/resources/integration-test.properties -Dserver.port=${EI_BACKEND_PORT} -jar ${EIFFEL_WAR} &
49-
- cd ..
50-
51-
after_script:
52-
- |
53-
if [[ $TRAVIS_JOB_NAME = integrationTests ]]; then
54-
docker-compose -f src/main/docker/docker-compose.yml down
55-
fuser -k ${EI_BACKEND_PORT}/tcp
56-
fi
57-
58-
5936
# Generate site documentation using mvn site plugin
6037
before_deploy:
6138
- rm -rf docs
6239
- mvn site -B
6340

64-
6541
# List of jobs to run, tied to specific stages
6642
jobs:
6743
include:
@@ -78,19 +54,43 @@ jobs:
7854
- export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
7955
- java -version
8056
- mvn test -B
81-
after_script: skip
8257
- stage: test
8358
name: integrationTests
59+
before_script:
60+
- source src/main/docker/env.bash
61+
- docker-compose -f src/main/docker/docker-compose.yml up -d eiffel-er mongodb rabbitmq jenkins mail-server ldap ldap-seed ldap2 ldap2-seed
62+
- echo 'Sleeping till Jenkins is up.'
63+
- timeout 90 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $HOST:$JENKINS_PORT/login)" != "200" ]]; do sleep 5; done' || false
64+
- git clone --depth=50 --branch=master https://github.com/eiffel-community/eiffel-intelligence.git
65+
- cd eiffel-intelligence
66+
- chmod +x pom.xml
67+
- mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
68+
- export EIFFEL_WAR=$(ls target/*.war)
69+
- java -Dspring.config.additional-location=file:../src/integrationtest/resources/integration-test.properties -Dserver.port=${EI_BACKEND_PORT} -jar ${EIFFEL_WAR} &
70+
- cd ..
71+
- echo 'Sleeping till EI is up.'
72+
- timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' $HOST:$EI_BACKEND_PORT/status)" != "200" ]]; do sleep 5; done' || false
8473
script:
8574
- "mvn verify -P integrationTest -DskipUTs -Dei.backend.instances.list.json.content=\"[{ 'contextPath': '', 'port': '${EI_BACKEND_PORT}', 'name': 'EI-Backend-1', 'host': 'localhost', 'https': false, 'defaultBackend': true}]\" -B"
75+
after_script:
76+
- docker-compose -f src/main/docker/docker-compose.yml down
77+
- fuser -k ${EI_BACKEND_PORT}/tcp
8678
- stage: deploy
8779
name: deployGitHubPages
8880
before_install: skip # do not run again
8981
install: skip # do not run again
9082
script: skip # do not run default test scripts
91-
after_script: skip # do not run again
9283
deploy:
9384
provider: pages
9485
skip_cleanup: true
9586
github-token: $GITHUB_TOKEN
9687
local_dir: docs/
88+
- stage: report_coverage
89+
name: report_coverage
90+
before_install: skip
91+
install: skip
92+
# Generating test coverage report and publishing to Codacy
93+
script:
94+
- mvn cobertura:cobertura -B
95+
- curl -Ls -o codacy-coverage-reporter-assembly.jar https://github.com/codacy/codacy-coverage-reporter/releases/download/6.0.2/codacy-coverage-reporter-6.0.2-assembly.jar
96+
- java -jar codacy-coverage-reporter-assembly.jar report -l Java -r target/site/cobertura/coverage.xml

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,46 +18,46 @@
1818
<img src="./images/eiffel-intelligence-logo.png" alt="Eiffel Intelligence" width="350"/>
1919

2020
[![Build Status](https://travis-ci.org/eiffel-community/eiffel-intelligence-frontend.svg?branch=master)](https://travis-ci.org/eiffel-community/eiffel-intelligence-frontend)
21-
[![Coverage Status](https://coveralls.io/repos/github/eiffel-community/eiffel-intelligence-frontend/badge.svg?branch=master)](https://coveralls.io/github/eiffel-community/eiffel-intelligence-frontend?branch=master)
21+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bbbaaa716e4542188ea66b9104e0e9b6)](https://www.codacy.com/manual/eiffel-intelligence-maintainers/eiffel-intelligence-frontend?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=eiffel-community/eiffel-intelligence-frontend&amp;utm_campaign=Badge_Grade)
22+
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/bbbaaa716e4542188ea66b9104e0e9b6)](https://www.codacy.com/app/eiffel-intelligence-maintainers/eiffel-intelligence-frontend?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=eiffel-community/eiffel-intelligence-frontend&amp;utm_campaign=Badge_Coverage)
2223
[![](https://jitpack.io/v/eiffel-community/eiffel-intelligence-frontend.svg)](https://jitpack.io/#eiffel-community/eiffel-intelligence-frontend)
2324

24-
2525
# Eiffel Intelligence Frontend
2626
Eiffel Intelligence Frontend is part of the [Eiffel Intelligence](https://github.com/eiffel-community/eiffel-intelligence) implementation of the [Eiffel Protocol](https://github.com/eiffel-community/eiffel). Eiffel Intelligence Frontend allows the configuration of subscription and aggregation rules in Eiffel Intelligence.
2727

2828
Potential future features for Eiffel Intelligence Frontend include:
29-
* Real time testing of aggregation models for new bounded contexts
30-
* Web hooks
31-
* Much more
29+
* Real time testing of aggregation models for new bounded contexts
30+
* Web hooks
31+
* Much more
3232

3333
## Supported Browsers
34-
* Edge 17.17619 or later
35-
* Chrome 63.0.3239.132 or later
36-
* Firefox 60.2.0 or later
34+
* Edge 17.17619 or later
35+
* Chrome 63.0.3239.132 or later
36+
* Firefox 60.2.0 or later
3737

3838
## Compatibility
3939
To see which versions of back-end and front-end that work together you can check the [Compatibility](https://github.com/eiffel-community/eiffel-intelligence/blob/master/wiki/markdown/compatibility.md) page.
4040

41-
# About this repository
41+
## About this repository
4242
The contents of this repository are licensed under the [Apache License 2.0](./LICENSE).
4343

4444
To get involved, please see [Code of Conduct](./CODE_OF_CONDUCT.md) and [contribution guidelines](./CONTRIBUTING.md).
4545

46-
# About Eiffel
46+
## About Eiffel
4747
This repository forms part of the Eiffel Community. Eiffel is a protocol for technology agnostic machine-to-machine communication in continuous integration and delivery pipelines, aimed at securing scalability, flexibility and traceability. Eiffel is based on the concept of decentralized real time messaging, both to drive the continuous integration and delivery system and to document it.
4848

4949
Visit [Eiffel Community](https://eiffel-community.github.io) to get started and get involved.
5050

51-
# Documentation
51+
## Documentation
5252

53-
1. [**Introduction**](./wiki/markdown/index.md)
54-
1. [**Running Eiffel-Intelligence front-end**](./wiki/markdown/running-eiffel-intelligence-frontend.md)
53+
1. [**Introduction**](./wiki/markdown/index.md)
54+
1. [**Running Eiffel-Intelligence front-end**](./wiki/markdown/running-eiffel-intelligence-frontend.md)
5555
- [**Run in Docker**](./wiki/markdown/docker.md)
5656
- [**Configuration**](./wiki/markdown/configuration.md)
57-
1. [**GUI Overview**](./wiki/markdown/GUI-overview.md)
58-
1. [**Subscription Handling**](./wiki/markdown/subscription-handling.md)
57+
1. [**GUI Overview**](./wiki/markdown/GUI-overview.md)
58+
1. [**Subscription Handling**](./wiki/markdown/subscription-handling.md)
5959
- [**Add Subscription**](./wiki/markdown/add-subscription.md)
60-
1. [**Test Rules User Guide**](./wiki/markdown/test-rules.md)
61-
1. [**CURL examples**](./wiki/markdown/curl-examples.md)
60+
1. [**Test Rules User Guide**](./wiki/markdown/test-rules.md)
61+
1. [**CURL examples**](./wiki/markdown/curl-examples.md)
6262

63-
**Eiffel Intelligence frontend documentation** [**can be found here**](https://eiffel-community.github.io/eiffel-intelligence-frontend/)
63+
[**Eiffel Intelligence frontend documentation can be found here**](https://eiffel-community.github.io/eiffel-intelligence-frontend/)

pom.xml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@
251251
<source>src/integrationtest/resources</source>
252252
<source>src/systemtest/java</source>
253253
<source>src/systemtest/resources</source>
254+
<source>src/main/docker</source>
254255
</sources>
255256
</configuration>
256257
</execution>
@@ -278,7 +279,7 @@
278279
</includes>
279280
</configuration>
280281
</plugin>
281-
282+
282283
<plugin>
283284
<groupId>org.apache.maven.plugins</groupId>
284285
<artifactId>maven-site-plugin</artifactId>
@@ -326,6 +327,17 @@
326327
</execution>
327328
</executions>
328329
</plugin>
330+
<plugin>
331+
<groupId>org.codehaus.mojo</groupId>
332+
<artifactId>cobertura-maven-plugin</artifactId>
333+
<version>2.7</version>
334+
<configuration>
335+
<formats>
336+
<format>html</format>
337+
<format>xml</format>
338+
</formats>
339+
</configuration>
340+
</plugin>
329341
</plugins>
330342
</build>
331343
<profiles>

src/functionaltest/java/com/ericsson/ei/frontend/TestSubscriptionCRUD.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import com.google.gson.JsonParser;
2323

24-
public class TestSubscriptionCRUD extends SeleniumBaseClass {
24+
public class TestSubscriptionCRUD extends TestBaseClass {
2525
private static final String SUBSCRIPTION_ENDPOINT = "/subscriptions";
2626
private static final String SUBSCRIPTION_DELETE_ENDPOINT = "/subscriptions/Subscription_1";
2727
private static final String SUBSCRIPTION_FILE_PATH = "src/functionaltest/resources/responses/subscription.json";
@@ -39,9 +39,8 @@ public class TestSubscriptionCRUD extends SeleniumBaseClass {
3939

4040
private MockServerClient mockServerClient;
4141

42-
@Override
4342
@Before
44-
public void init() throws Exception {
43+
public void before() throws Exception {
4544
int serverPort = mockServerRule.getPort();
4645
setBackendInstance("test", "localhost", serverPort, "", false);
4746

0 commit comments

Comments
 (0)