-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.travis.yml
74 lines (68 loc) · 2.89 KB
/
.travis.yml
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
language: java
dist: trusty
cache:
directories:
- $HOME/.m2
jdk:
- oraclejdk8
stages:
- test
- name: deploy-snapshots
if: branch = master AND type = push
- name: release-check
if: (branch =~ /^release.*/)
- name: release
if: (branch =~ /^release.*/)
before_install:
# Ensure the settings we want to use are in place before running the default mvn install
- cp ./travis/maven-settings.xml $HOME/.m2/settings.xml
- sed -i "s/-SNAPSHOT/-build-$TRAVIS_BUILD_NUMBER/" pom.xml
# Disable SourceClear except on scheduled builds
- |
if [ "$TRAVIS_EVENT_TYPE" != "cron" ]
then
export NOSCAN=1
fi
jobs:
include:
- stage: test
addons:
postgresql: "9.6"
before_script:
- psql -U postgres -c "create user test with password 'test';"
- psql -c 'create database test owner test;' -U postgres
# Skip the default mvn command because we want to set the profile explicitly
install: true
script:
- echo "test"
- mvn -e test
- mvn -e -Ppostgresql -Dpostgres.database.url=jdbc:postgresql:test -Dpostgres.database.user=test -Dpostgres.database.password=test verify
after_failure:
- echo "\n=== SUREFIRE REPORTS ===\n"
- for F in target/surefire-reports/*.txt; do echo $F; cat $F; echo; done
- stage: deploy-snapshots
script:
- echo "deploy-snapshots"
# When push to master occurs, all the versions should be -SNAPSHOTs and we will auto-deploy
- mvn --batch-mode -e -DskipTests=true deploy
- stage: release-check
script:
- echo "release-check"
# Ensure we don't have any external SNAPSHOT dependencies
- mvn --batch-mode release:prepare -DskipTests=true -DdryRun=true
- stage: release
script:
- echo "release"
# Git fix based on: https://github.com/sbt/sbt-release/issues/210
- echo "Fixing git setup for $TRAVIS_BRANCH in preparation for release"
- git checkout ${TRAVIS_BRANCH}
- git branch -u origin/${TRAVIS_BRANCH}
- git config branch.${TRAVIS_BRANCH}.remote origin
- git config branch.${TRAVIS_BRANCH}.merge refs/heads/${TRAVIS_BRANCH}
# Prepare for signing artifacts as part of release process
# NOTE: based on http://www.debonair.io/post/maven-cd/ "Encrypt cert and variables for travis"
- openssl aes-256-cbc -K $encrypted_1d39e233a764_key -iv $encrypted_1d39e233a764_iv -in travis/codesigning.asc.enc -out travis/codesigning.asc -d
- gpg --fast-import travis/codesigning.asc
# Perform mvn release steps
- mvn --batch-mode release:prepare -DskipTests -Darguments=-DskipTests -DtagNameFormat="v@{project.version}" -DscmCommentPrefix="[maven-release-plugin][skip travis]" # NOTE: this stop's travis from building based on the tag's commit/push.
- mvn --batch-mode release:perform -DskipTests -Darguments=-DskipTests