Skip to content

Commit

Permalink
feat: Enable continuous integration (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach authored Mar 2, 2020
1 parent 1e80d99 commit a2da5fd
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.classpath
.settings/
bin/
*.apk
.DS_Store
target/*
target/*
*.iml
.idea/
target/
.vscode/
47 changes: 47 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
language: java
sudo: false
jdk: openjdk8

jobs:
include:
- stage:
name: JDK 8
before_script:
- |
if [[ "$TRAVIS_BRANCH" == "master" && -n "$TRAVIS_TAG" ]]; then
./build.sh "$TRAVIS_TAG"
else
./build.sh
fi
script: ./test.sh
- stage:
name: JDK 9
jdk: openjdk9
before_script: ./build.sh
script: ./test.sh
- stage:
name: JDK 10
jdk: openjdk10
before_script: ./build.sh
script: ./test.sh
- stage:
name: JDK 11
jdk: openjdk11
before_script: ./build.sh
script: ./test.sh
- stage:
name: JDK 12
jdk: openjdk12
before_script: ./build.sh
script: ./test.sh

deploy:
provider: releases
api_key:
secure: "TBD"
file_glob: true
file: ./target/verify*.jar
skip_cleanup: true
on:
jdk: openjdk8
tags: true
17 changes: 11 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/bin/bash
mvn package
mkdir -p ./dist
cp ./target/verify-0.0.1-SNAPSHOT.jar ./dist/verify.jar
zip -d ./dist/verify.jar META-INF*

cd ./verify_jar/
zip ./../dist/verify.jar ./META-INF/MANIFEST.MF
set -ex

version=0.0.1-SNAPSHOT
if [[ -n "$1" ]]; then
version=$1
fi

awk "NR==1,/<version>.+<\/version>/{sub(/<version>.+<\/version>/, \"<version>$version<\/version>\")} 1" pom.xml > pom_new.xml
mv -f pom_new.xml pom.xml
mvn clean
mvn package
Binary file removed dist/verify.jar
Binary file not shown.
11 changes: 7 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<artifactId>verify</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- run with: mvn package -->
<build>
<resources>
Expand All @@ -21,16 +24,16 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
Expand All @@ -48,4 +51,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
10 changes: 10 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -x

tmpfile=$(mktemp /tmp/out.XXXXXX)
java -jar ./target/verify*.jar "./tests/assets/tiny.apk" > "$tmpfile" 2>&1 || true
if ! grep -q 'java.lang.Exception' "$tmpfile"; then
exit 1
fi
java -jar ./target/verify*.jar "./tests/assets/tiny.s.apk" || exit 1
Binary file added tests/assets/tiny.apk
Binary file not shown.
Binary file added tests/assets/tiny.s.apk
Binary file not shown.
2 changes: 0 additions & 2 deletions verify_jar/META-INF/MANIFEST.MF

This file was deleted.

0 comments on commit a2da5fd

Please sign in to comment.