Skip to content

Commit a373634

Browse files
committed
Add CircleCI
1 parent f6ce2e5 commit a373634

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.circleci/check_android_support.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
PASS=1
4+
REPO_ROOT=$(git rev-parse --show-toplevel)
5+
if [[ -z $REPO_ROOT ]]; then
6+
echo "Could not detect git repo root"
7+
exit 2
8+
fi
9+
10+
repeatable=$(grep -r --include \*.java java.lang.annotation.Repeatable "$REPO_ROOT")
11+
getannotationsbytype=$(grep -r --include \*.java AnnotatedElement.getAnnotationsByType "$REPO_ROOT")
12+
stream=$(grep -r --include \*.java java.util.stream "$REPO_ROOT")
13+
stream2=$(grep -r --include \*.java Arrays.stream "$REPO_ROOT")
14+
functionalinterface=$(grep -r --include \*.java java.lang.FunctionalInterface "$REPO_ROOT")
15+
reflectisdefault=$(grep -r --include \*.java java.lang.reflect.isDefault "$REPO_ROOT")
16+
function=$(grep -r --include \*.java java.util.function "$REPO_ROOT")
17+
18+
if [[ ! -z $repeatable ]]; then
19+
echo -e "Error: Usage of java.lang.annotation.Repeatable found:\n$repeatable"
20+
PASS=0
21+
fi
22+
if [[ ! -z $getannotationsbytype ]]; then
23+
echo -e "Error: Usage of AnnotatedElement.getAnnotationsByType found:\n$getannotationsbytype"
24+
PASS=0
25+
fi
26+
if [[ ! -z $stream ]]; then
27+
echo -e "Error: Usage of java.util.stream found:\n$stream"
28+
PASS=0
29+
fi
30+
if [[ ! -z $stream2 ]]; then
31+
echo -e "Error: Usage of Arrays.stream found:\n$stream2"
32+
PASS=0
33+
fi
34+
if [[ ! -z $functionalinterface ]]; then
35+
echo -e "Error: Usage of java.lang.FunctionalInterface found:\n$functionalinterface"
36+
PASS=0
37+
fi
38+
if [[ ! -z $reflectisdefault ]]; then
39+
echo -e "Error: Usage of java.lang.reflect.isDefault found:\n$reflectisdefault"
40+
PASS=0
41+
fi
42+
if [[ ! -z $function ]]; then
43+
echo -e "Error: Usage of java.util.function found:\n$function"
44+
PASS=0
45+
fi
46+
47+
if (( $PASS == 0 )); then
48+
echo ""
49+
echo "Unfortunately the APIs listed above are not supported by Android"
50+
echo "below API version 24, so they should not be used in SaltyRTC."
51+
exit 1
52+
else
53+
echo "No forbidden APIs found"
54+
exit 0
55+
fi

.circleci/config.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2
2+
3+
references:
4+
test-steps: &test-steps
5+
6+
# Checkout code
7+
- checkout
8+
9+
# Start SaltyRTC server
10+
- run: saltyrtc-server-launcher > /saltyrtc/server.pid && sleep 2
11+
12+
# Handle dependencies
13+
- restore_cache:
14+
keys:
15+
- v1-dependencies-{{ checksum "build.gradle" }}
16+
- v1-dependencies-
17+
- run: ./gradlew dependencies
18+
- save_cache:
19+
paths:
20+
- ~/.m2
21+
- ~/.gradle
22+
key: v1-dependencies-{{ checksum "build.gradle" }}
23+
24+
# Create JKS keystore
25+
- run: keytool -import -trustcacerts -alias root -file /saltyrtc/certs/saltyrtc.crt -keystore saltyrtc.jks -storetype JKS -storepass saltyrtc -noprompt
26+
27+
# Run tests
28+
- run: ./gradlew test
29+
30+
# Stop SaltyRTC server
31+
- run: kill -INT $(cat /saltyrtc/server.pid)
32+
33+
jobs:
34+
test-openjdk8:
35+
docker:
36+
- image: saltyrtc/circleci-image-java:openjdk8
37+
steps: *test-steps
38+
test-android-compat:
39+
docker:
40+
- image: circleci/openjdk:8
41+
steps:
42+
- checkout
43+
- run: bash .circleci/check_android_support.sh
44+
45+
workflows:
46+
version: 2
47+
build:
48+
jobs:
49+
- test-openjdk8:
50+
filters:
51+
branches:
52+
ignore:
53+
- gh-pages
54+
- test-android-compat:
55+
filters:
56+
branches:
57+
ignore:
58+
- gh-pages

0 commit comments

Comments
 (0)