Skip to content

Commit

Permalink
Merge e5b6169 into 9b0fb8f
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacbrodsky committed Jun 9, 2022
2 parents 9b0fb8f + e5b6169 commit f74f79d
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 18 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
matrix:
os: [ubuntu-latest]
java-distribution: [adopt]
java-version: [8, 11, 15]
java-version: [8, 11, 15, 17]

steps:
- uses: actions/checkout@v2.1.1
Expand All @@ -42,6 +42,38 @@ jobs:
- name: Tests
run: mvn "-Dh3.remove.images=true" -B -V clean test site

tests-new-dockcross:
name: Dockcross ${{ matrix.dockcross-tag }} Java ${{ matrix.java-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
java-distribution: [adopt]
java-version: [15]
dockcross-tag: ["20220528-e4627de"]

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" "-Dh3.dockcross.tag=${{ matrix.dockcross-tag }}" -B -V clean test

tests-no-docker:
name: Java (No Docker) ${{ matrix.java-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -51,7 +83,7 @@ jobs:
# TODO: Docker on macos-latest running is not working
os: [macos-latest, windows-latest]
java-distribution: [adopt]
java-version: [8, 11, 15]
java-version: [8, 11, 15, 17]

steps:
- uses: actions/checkout@v2.1.1
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The public API of this library consists of the public functions declared in
file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support
for the Linux x64 and Darwin x64 platforms.

## [4.0.0-rc2] - Unreleased
### Changed
- Required version of glibc on Linux is 2.26. (#98)

### Removed
- Removed support for Linux MIPS (#98)

## [4.0.0-rc1] - 2022-03-29
### Breaking Changes
- Changed the API of `H3Core` to align it with the core library. (#91)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ H3-Java provides bindings to the H3 library, which is written in C. The built ar

| Operating System | Architectures
| ---------------- | -------------
| Linux | x64, x86, ARM64, ARMv5, ARMv7, MIPS, PPC64LE, s390x
| Linux | x64, x86, ARM64, ARMv5, ARMv7, PPC64LE, s390x
| Windows | x64, x86
| Darwin (Mac OSX) | x64, ARM64
| FreeBSD | x64
Expand Down
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@

<h3.git.remote>https://github.com/uber/h3.git</h3.git.remote>
<h3.use.docker>true</h3.use.docker>
<h3.remove.images>false</h3.remove.images>
<h3.system.prune>false</h3.system.prune>
<h3.dockcross.tag>20210624-de7b1b0</h3.dockcross.tag>
<!-- Used for passing additional arguments to surefire when using JaCoCo -->
<h3.additional.argLine />

Expand Down Expand Up @@ -265,7 +266,8 @@
<argument>${h3.git.remote}</argument>
<argument>${h3.git.reference}</argument>
<argument>${h3.use.docker}</argument>
<argument>${h3.remove.images}</argument>
<argument>${h3.system.prune}</argument>
<argument>${h3.dockcross.tag}</argument>
</arguments>
</configuration>
</execution>
Expand Down
26 changes: 23 additions & 3 deletions src/main/c/h3-java/build-h3-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,37 @@
# limitations under the License.
#

# Arguments: [build-root]
# build-root - Location to build the library.
# Arguments: [build-root] [upgrade-cmake]
# build-root - Location to build the library.
# upgrade-cmake - Whether to download and install a new version of CMake
# cmake-root - Where to download and install the new version of CMake
#
# Builds H3 and H3-Java in the given directory. This is intended to be
# called from build-h3.sh as part of the cross compilation process.

set -ex

BUILD_ROOT=$1
UPGRADE_CMAKE=$2
CMAKE_ROOT=$3

cd $BUILD_ROOT
if $UPGRADE_CMAKE; then
pushd "$CMAKE_ROOT"
if ! [ -e cmake-3.23.2-linux-x86_64.sh ]; then
wget -nv https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2-linux-x86_64.sh
fi
echo "5cca63af386e5bd0bde67c87ffac915865abd7dcc48073528f58645abda8f695 cmake-3.23.2-linux-x86_64.sh" > cmake-3.23.2-SHA-256.txt
sha256sum -c cmake-3.23.2-SHA-256.txt
if ! [ -e ./bin/cmake ]; then
chmod a+x cmake-3.23.2-linux-x86_64.sh
./cmake-3.23.2-linux-x86_64.sh --skip-license
fi
export PATH=$(pwd)/bin:$PATH
cmake --version
popd
fi

cd "$BUILD_ROOT"

mkdir -p build
pushd build
Expand Down
27 changes: 17 additions & 10 deletions src/main/c/h3-java/build-h3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
# 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
# system-prune - If use-docker is true and this argument is true, Docker
# system prune will be run after each step
# (i.e. for disk space constrained environments like CI)
# dockcross-tag - Tag name for dockcross
#
# This script downloads H3, builds H3 and the H3-Java native library, and
# cross compiles via Docker.
Expand All @@ -36,7 +37,8 @@ set -ex
GIT_REMOTE=$1
GIT_REVISION=$2
USE_DOCKER=$3
REMOVE_IMAGES=$4
SYSTEM_PRUNE=$4
DOCKCROSS_TAG=$5

echo Downloading H3 from "$GIT_REMOTE"

Expand Down Expand Up @@ -156,21 +158,25 @@ if ! command -v docker; then
exit 0
fi

dockcross_tag="20211126-f096312"
# Needed for older versions of dockcross
UPGRADE_CMAKE=true
CMAKE_ROOT=target/cmake-3.23.2-linux-x86_64
mkdir -p $CMAKE_ROOT

# linux-armv6 excluded because of build failure
for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux-mips linux-s390x \
# linux-mips excluded due to manifest error
for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux-s390x \
linux-ppc64le linux-x64 linux-x86 windows-static-x64 windows-static-x86; do

# Setup for using dockcross
BUILD_ROOT=target/h3-java-build-$image
mkdir -p $BUILD_ROOT
docker pull dockcross/$image:$dockcross_tag
docker run --rm dockcross/$image:$dockcross_tag > $BUILD_ROOT/dockcross
docker pull dockcross/$image:$DOCKCROSS_TAG
docker run --rm dockcross/$image:$DOCKCROSS_TAG > $BUILD_ROOT/dockcross
chmod +x $BUILD_ROOT/dockcross

# Perform the actual build inside Docker
$BUILD_ROOT/dockcross --args "-v $JAVA_HOME:/java" src/main/c/h3-java/build-h3-docker.sh "$BUILD_ROOT"
$BUILD_ROOT/dockcross --args "-v $JAVA_HOME:/java" src/main/c/h3-java/build-h3-docker.sh "$BUILD_ROOT" "$UPGRADE_CMAKE" "$CMAKE_ROOT"

# Copy the built artifact into the source tree so it can be included in the
# built JAR.
Expand All @@ -186,8 +192,9 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux
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
if $SYSTEM_PRUNE; then
docker system prune --force --all
docker system df
rm $BUILD_ROOT/dockcross
fi
echo Current disk usage:
Expand Down

0 comments on commit f74f79d

Please sign in to comment.