From f2242cbc80bd61458afea107763839564d70f578 Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Tue, 4 May 2021 17:01:36 -0700 Subject: [PATCH 01/11] Begin Github Actions --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..25547ed --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,35 @@ +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: [macos-latest, windows-latest, 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 }}" + + - name: Setup Docker + uses: docker-practice/actions-setup-docker@master + if: !startsWith(matrix.os, 'windows') + + - name: Tests + run: mvn clean test From 0e8e7fd3ac14ae0b1d0270310edeea80646ffe84 Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Wed, 5 May 2021 13:08:42 -0700 Subject: [PATCH 02/11] Fix YAML --- .github/workflows/tests.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25547ed..a13c6a8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,12 +24,11 @@ jobs: - uses: actions/setup-java@v2 with: - distribution: "${{ matrix.java-distribution }}"" + distribution: "${{ matrix.java-distribution }}" java-version: "${{ matrix.java-version }}" - - name: Setup Docker - uses: docker-practice/actions-setup-docker@master - if: !startsWith(matrix.os, 'windows') + - uses: docker-practice/actions-setup-docker@master + if: "!startsWith(matrix.os, 'windows')" - name: Tests run: mvn clean test From a855a3c3f52df97df7d13c944f520574f9c31978 Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Wed, 5 May 2021 13:33:36 -0700 Subject: [PATCH 03/11] Add dependency cache --- .github/workflows/tests.yml | 43 ++++++++++++++++++++++++++++++++++++- .travis.yml | 10 --------- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a13c6a8..8a3f6d2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,5 +30,46 @@ jobs: - uses: docker-practice/actions-setup-docker@master if: "!startsWith(matrix.os, 'windows')" + - 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 clean test -B -V + + tests-no-docker: + name: Java (no Docker) ${{ matrix.java-version }} ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + java-distribution: [adopt] + java-version: [11] + + 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 clean test + run: | + mvn install -DskipTests=true -B -V -Dh3.use.docker=false + mvn test -B -Dh3.use.docker=false diff --git a/.travis.yml b/.travis.yml index 383dc2b..4dbba38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,13 +34,3 @@ matrix: 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 From 5def29df3adccea1b307d451d51dcc5b4375fa9d Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Wed, 5 May 2021 13:46:32 -0700 Subject: [PATCH 04/11] Print disk usage debugging --- src/main/c/h3-java/build-h3.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/h3-java/build-h3.sh b/src/main/c/h3-java/build-h3.sh index a740f90..6b68fba 100755 --- a/src/main/c/h3-java/build-h3.sh +++ b/src/main/c/h3-java/build-h3.sh @@ -122,8 +122,12 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux # Setup for using dockcross BUILD_ROOT=target/h3-java-build-$image mkdir -p $BUILD_ROOT + echo BEFORE PULL USAGE: + df -h docker pull dockcross/$image docker run --rm dockcross/$image > $BUILD_ROOT/dockcross + echo AFTER RUN USAGE: + df -h chmod +x $BUILD_ROOT/dockcross # Perform the actual build inside Docker From ded17fa792594dcc12647aa644506f2ae51fe5ee Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Wed, 5 May 2021 14:03:52 -0700 Subject: [PATCH 05/11] Remove in progress images --- .github/workflows/tests.yml | 2 +- pom.xml | 2 ++ src/main/c/h3-java/build-h3.sh | 26 ++++++++++++++++---------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8a3f6d2..c77c062 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: ${{ runner.os }}-maven- - name: Tests - run: mvn clean test -B -V + run: mvn clean test -B -V -Dh3.remove.images=true tests-no-docker: name: Java (no Docker) ${{ matrix.java-version }} ${{ matrix.os }} diff --git a/pom.xml b/pom.xml index 6a31c22..c6ae865 100644 --- a/pom.xml +++ b/pom.xml @@ -70,6 +70,7 @@ https://github.com/uber/h3.git true + false @@ -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 6b68fba..241f792 100755 --- a/src/main/c/h3-java/build-h3.sh +++ b/src/main/c/h3-java/build-h3.sh @@ -15,12 +15,14 @@ # 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 # # This script downloads H3, builds H3 and the H3-Java native library, and # cross compiles via Docker. @@ -33,6 +35,7 @@ set -ex GIT_REMOTE=$1 GIT_REVISION=$2 USE_DOCKER=$3 +REMOVE_IMAGES=$4 echo Downloading H3 from "$GIT_REMOTE" @@ -122,12 +125,8 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux # Setup for using dockcross BUILD_ROOT=target/h3-java-build-$image mkdir -p $BUILD_ROOT - echo BEFORE PULL USAGE: - df -h docker pull dockcross/$image docker run --rm dockcross/$image > $BUILD_ROOT/dockcross - echo AFTER RUN USAGE: - df -h chmod +x $BUILD_ROOT/dockcross # Perform the actual build inside Docker @@ -140,4 +139,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 From d67ecddc0ef1ff9da51e9f505f2cfc016a32b29e Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Thu, 6 May 2021 11:01:01 -0700 Subject: [PATCH 06/11] Try to work around Windows shell --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c77c062..e59db37 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: ${{ runner.os }}-maven- - name: Tests - run: mvn clean test -B -V -Dh3.remove.images=true + run: mvn "-Dh3.remove.images=true" -B -V clean test tests-no-docker: name: Java (no Docker) ${{ matrix.java-version }} ${{ matrix.os }} From c5d4b077919ef6f112829c60c336076090356595 Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Thu, 6 May 2021 12:16:23 -0700 Subject: [PATCH 07/11] Upgrade jacoco for Java 15 --- pom.xml | 2 +- src/main/c/h3-java/build-h3.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c6ae865..ff2bb98 100644 --- a/pom.xml +++ b/pom.xml @@ -207,7 +207,7 @@ org.jacoco jacoco-maven-plugin - 0.8.4 + 0.8.7 jacoco-instrument diff --git a/src/main/c/h3-java/build-h3.sh b/src/main/c/h3-java/build-h3.sh index 241f792..6ee40bc 100755 --- a/src/main/c/h3-java/build-h3.sh +++ b/src/main/c/h3-java/build-h3.sh @@ -23,6 +23,7 @@ # 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. From f0fca1736e5ac2a540fa4b81e3c6264ffbe71dba Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Thu, 6 May 2021 12:18:05 -0700 Subject: [PATCH 08/11] Upgrade Guava --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff2bb98..353b280 100644 --- a/pom.xml +++ b/pom.xml @@ -161,7 +161,7 @@ com.google.guava guava - 29.0-jre + 30.0-jre test From 73df89cfd00316fb05243e046588cd39ae1555be Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Thu, 6 May 2021 12:57:46 -0700 Subject: [PATCH 09/11] Convert coverage to Github Actions --- .github/workflows/tests.yml | 38 ++++++++++++++++++++++++++++++++++++- .travis.yml | 36 ----------------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e59db37..52fd8c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,8 @@ jobs: strategy: matrix: - os: [macos-latest, windows-latest, ubuntu-latest] + # TODO: macos-latest is disabled due to Docker setup issues + os: [windows-latest, ubuntu-latest] java-distribution: [adopt] java-version: [8, 11, 15] @@ -73,3 +74,38 @@ jobs: run: | mvn install -DskipTests=true -B -V -Dh3.use.docker=false mvn test -B -Dh3.use.docker=false + + 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.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 4dbba38..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +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' From 22bbe6ed9d00a4364ffea4d3c1bb94dff9213cd9 Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Thu, 6 May 2021 13:20:05 -0700 Subject: [PATCH 10/11] Coverage runs without Docker --- .github/workflows/tests.yml | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 52fd8c0..9f1c159 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,39 +42,6 @@ jobs: - 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: - os: [ubuntu-latest] - java-distribution: [adopt] - java-version: [11] - - 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 install -DskipTests=true -B -V -Dh3.use.docker=false - mvn test -B -Dh3.use.docker=false - tests-coverage: name: Java (Coverage) ${{ matrix.java-version }} ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -105,7 +72,7 @@ jobs: - name: Coverage report run: | - mvn clean test jacoco:report coveralls:report -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 }} + 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 }} From e015c6882e6502f8c19761811ff34a7a3d01141d Mon Sep 17 00:00:00 2001 From: Isaac Brodsky Date: Thu, 6 May 2021 13:27:49 -0700 Subject: [PATCH 11/11] Readd Mac OS without Docker --- .appveyor.yml | 1 + .github/workflows/tests.yml | 38 ++++++++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) 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 index 9f1c159..38618b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,8 +13,7 @@ jobs: strategy: matrix: - # TODO: macos-latest is disabled due to Docker setup issues - os: [windows-latest, ubuntu-latest] + os: [ubuntu-latest] java-distribution: [adopt] java-version: [8, 11, 15] @@ -28,9 +27,6 @@ jobs: distribution: "${{ matrix.java-distribution }}" java-version: "${{ matrix.java-version }}" - - uses: docker-practice/actions-setup-docker@master - if: "!startsWith(matrix.os, 'windows')" - - uses: actions/cache@v2 id: maven-cache with: @@ -42,6 +38,38 @@ jobs: - 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 }}