-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtravis-ci.sh
More file actions
executable file
·75 lines (63 loc) · 2.17 KB
/
travis-ci.sh
File metadata and controls
executable file
·75 lines (63 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /usr/bin/env nix-shell
#! nix-shell --show-trace --pure --keep encrypted_de4911fc7d4a_key --keep encrypted_de4911fc7d4a_iv --keep TRAVIS_PULL_REQUEST --keep TRAVIS_TAG --keep TRAVIS_BRANCH --keep SIGNING_PASSWORD --keep SONAR_TOKEN --keep NEXUS_PASSWORD --keep GITHUB_KEY -i bash -p git cacert graphviz adoptopenjdk-bin openssl
set -euo pipefail
scan() {
# update sonar (including failing tests)
echo "building skipping tests"
./gradlew -x test build
echo " running tests"
./gradlew test || true
./gradlew jacocoTestReport
git fetch --unshallow #get all commit history for exact blame info
echo "running sonar skipping tests"
./gradlew -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=moaxcp -Dsonar.login=$SONAR_TOKEN sonarqube
}
build() {
# run build
./gradlew build
./gradlew javadoc
./gradlew asciidoctor
}
release() {
# publish
./gradlew publishAllPublicationsToOSSRepository closeAndReleaseRepository \
-Pnexus.username=moaxcp \
-Pnexus.password="$NEXUS_PASSWORD" \
-Psigning.keyId=A9A4043B \
-Psigning.secretKeyRingFile="$PWD"/signingkey.gpg \
-Psigning.password="$SIGNING_PASSWORD" \
-Pgithub.user="moaxcp" \
-Pgithub.key="$GITHUB_KEY"
publishSite
}
publishSite() {
./gradlew asciidoctor
./gradlew gitPublishPush \
-Dorg.ajoberstar.grgit.auth.username="$GITHUB_KEY"
}
./gradlew -version
dot -V
neato -V
openssl version
JAVA_HOME=$(readlink -e $(type -p javac) | sed -e 's/\/bin\/javac//g')
GIT_SSL_CAINFO=~/.nix-profile/etc/ssl/certs/ca-bundle.crt
echo "JAVA_HOME is ${JAVA_HOME}"
openssl aes-256-cbc -K "$encrypted_de4911fc7d4a_key" -iv "$encrypted_de4911fc7d4a_iv" -in signingkey.gpg.enc -out signingkey.gpg -d
if [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
echo "build for pull request not yet supported"
exit 1
fi
if [ -n "$TRAVIS_TAG" ]; then
echo "release for $TRAVIS_TAG"
scan
build
release
elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo "build for master branch"
scan
build
publishSite
else
echo "build for different branch not yet supported"
exit 1
fi