diff --git a/.appveyor.yml b/.appveyor.yml index 0ebe4be..ea56833 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,5 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. +# TODO: Remove this and replace with Github Actions only build_script: - mvn clean package --batch-mode -V diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..38618b2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,106 @@ +name: tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + tests: + name: Java ${{ matrix.java-version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + java-distribution: [adopt] + java-version: [8, 11, 15] + + steps: + - uses: actions/checkout@v2.1.1 + with: + submodules: recursive + + - uses: actions/setup-java@v2 + with: + distribution: "${{ matrix.java-distribution }}" + java-version: "${{ matrix.java-version }}" + + - uses: actions/cache@v2 + id: maven-cache + with: + path: ~/.m2/ + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Tests + run: mvn "-Dh3.remove.images=true" -B -V clean test + + tests-no-docker: + name: Java (No Docker) ${{ matrix.java-version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + # TODO: Docker on macos-latest running is not working + os: [macos-latest, windows-latest] + java-distribution: [adopt] + java-version: [8, 11, 15] + + steps: + - uses: actions/checkout@v2.1.1 + with: + submodules: recursive + + - uses: actions/setup-java@v2 + with: + distribution: "${{ matrix.java-distribution }}" + java-version: "${{ matrix.java-version }}" + + - uses: actions/cache@v2 + id: maven-cache + with: + path: ~/.m2/ + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Tests + run: mvn -B -V clean test + + tests-coverage: + name: Java (Coverage) ${{ matrix.java-version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + java-distribution: [adopt] + java-version: [8] + + steps: + - uses: actions/checkout@v2.1.1 + with: + submodules: recursive + + - uses: actions/setup-java@v2 + with: + distribution: "${{ matrix.java-distribution }}" + java-version: "${{ matrix.java-version }}" + + - uses: actions/cache@v2 + id: maven-cache + with: + path: ~/.m2/ + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Coverage report + run: | + mvn clean test jacoco:report coveralls:report -Dh3.use.docker=false -Dh3.test.system=true -Dh3.additional.argLine="-Djava.library.path=./src/main/resources/linux-x64/" --no-transfer-progress -DrepoToken=$COVERALLS_SECRET -DpullRequest=${{ github.event.number }} + env: + CI_NAME: github + COVERALLS_SECRET: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 383dc2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2018-2019 Uber Technologies, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -language: java -dist: xenial - -sudo: required - -cache: - directories: - - $HOME/.m2 - -services: - - docker - -matrix: - include: - - name: "Coverage and FOSSA report" - os: linux - jdk: openjdk8 - before_script: - - "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash" - script: - - mvn clean test jacoco:report coveralls:report -Dh3.test.system=true -Dh3.additional.argLine="-Djava.library.path=./src/main/resources/linux-x64/" - - 'if [ -n "$FOSSA_API_KEY" ]; then fossa; fi' - - os: linux - jdk: openjdk11 - - name: "Linux without Docker" - os: linux - jdk: oraclejdk11 - install: - - mvn install -DskipTests=true -B -V -Dh3.use.docker=false - script: - - mvn test -B -Dh3.use.docker=false - - os: osx diff --git a/pom.xml b/pom.xml index 6a31c22..353b280 100644 --- a/pom.xml +++ b/pom.xml @@ -70,6 +70,7 @@ https://github.com/uber/h3.git true + false @@ -160,7 +161,7 @@ com.google.guava guava - 29.0-jre + 30.0-jre test @@ -206,7 +207,7 @@ org.jacoco jacoco-maven-plugin - 0.8.4 + 0.8.7 jacoco-instrument @@ -242,6 +243,7 @@ ${h3.git.remote} ${h3.git.reference} ${h3.use.docker} + ${h3.remove.images} diff --git a/src/main/c/h3-java/build-h3.sh b/src/main/c/h3-java/build-h3.sh index a740f90..6ee40bc 100755 --- a/src/main/c/h3-java/build-h3.sh +++ b/src/main/c/h3-java/build-h3.sh @@ -15,12 +15,15 @@ # limitations under the License. # -# Arguments: [git-remote] [git-ref] [use-docker] -# git-remote - The git remote to pull from. An existing cloned repository -# will not be deleted if a new remote is specified. -# git-ref - Specific git ref of H3 to build. -# use-docker - "true" to perform cross compilation via Docker, "false" to -# skip that step. +# Arguments: [git-remote] [git-ref] [use-docker] [remove-images] +# git-remote - The git remote to pull from. An existing cloned repository +# will not be deleted if a new remote is specified. +# git-ref - Specific git ref of H3 to build. +# use-docker - "true" to perform cross compilation via Docker, "false" to +# skip that step. +# remove-images - If use-docker is true and this argument is true, Docker +# cross compilation images will be removed after each step +# (i.e. for disk space constrained environments like CI) # # This script downloads H3, builds H3 and the H3-Java native library, and # cross compiles via Docker. @@ -33,6 +36,7 @@ set -ex GIT_REMOTE=$1 GIT_REVISION=$2 USE_DOCKER=$3 +REMOVE_IMAGES=$4 echo Downloading H3 from "$GIT_REMOTE" @@ -136,4 +140,11 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux if [ -e $BUILD_ROOT/lib/libh3-java.so ]; then cp $BUILD_ROOT/lib/libh3-java.so $OUTPUT_ROOT ; fi if [ -e $BUILD_ROOT/lib/libh3-java.dylib ]; then cp $BUILD_ROOT/lib/libh3-java.dylib $OUTPUT_ROOT ; fi if [ -e $BUILD_ROOT/lib/libh3-java.dll ]; then cp $BUILD_ROOT/lib/libh3-java.dll $OUTPUT_ROOT ; fi + + if $REMOVE_IMAGES; then + docker rmi dockcross/$image + rm $BUILD_ROOT/dockcross + fi + echo Current disk usage: + df -h done