Skip to content

Commit bbf8750

Browse files
authored
Merge pull request #76 from uber/github-actions
Migrate to Github Actions
2 parents 76dea88 + e015c68 commit bbf8750

File tree

5 files changed

+128
-54
lines changed

5 files changed

+128
-54
lines changed

.appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# TODO: Remove this and replace with Github Actions only
1516
build_script:
1617
- mvn clean package --batch-mode -V

.github/workflows/tests.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
tests:
11+
name: Java ${{ matrix.java-version }} ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest]
17+
java-distribution: [adopt]
18+
java-version: [8, 11, 15]
19+
20+
steps:
21+
- uses: actions/[email protected]
22+
with:
23+
submodules: recursive
24+
25+
- uses: actions/setup-java@v2
26+
with:
27+
distribution: "${{ matrix.java-distribution }}"
28+
java-version: "${{ matrix.java-version }}"
29+
30+
- uses: actions/cache@v2
31+
id: maven-cache
32+
with:
33+
path: ~/.m2/
34+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
35+
restore-keys: |
36+
${{ runner.os }}-maven-
37+
38+
- name: Tests
39+
run: mvn "-Dh3.remove.images=true" -B -V clean test
40+
41+
tests-no-docker:
42+
name: Java (No Docker) ${{ matrix.java-version }} ${{ matrix.os }}
43+
runs-on: ${{ matrix.os }}
44+
45+
strategy:
46+
matrix:
47+
# TODO: Docker on macos-latest running is not working
48+
os: [macos-latest, windows-latest]
49+
java-distribution: [adopt]
50+
java-version: [8, 11, 15]
51+
52+
steps:
53+
- uses: actions/[email protected]
54+
with:
55+
submodules: recursive
56+
57+
- uses: actions/setup-java@v2
58+
with:
59+
distribution: "${{ matrix.java-distribution }}"
60+
java-version: "${{ matrix.java-version }}"
61+
62+
- uses: actions/cache@v2
63+
id: maven-cache
64+
with:
65+
path: ~/.m2/
66+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
67+
restore-keys: |
68+
${{ runner.os }}-maven-
69+
70+
- name: Tests
71+
run: mvn -B -V clean test
72+
73+
tests-coverage:
74+
name: Java (Coverage) ${{ matrix.java-version }} ${{ matrix.os }}
75+
runs-on: ${{ matrix.os }}
76+
77+
strategy:
78+
matrix:
79+
os: [ubuntu-latest]
80+
java-distribution: [adopt]
81+
java-version: [8]
82+
83+
steps:
84+
- uses: actions/[email protected]
85+
with:
86+
submodules: recursive
87+
88+
- uses: actions/setup-java@v2
89+
with:
90+
distribution: "${{ matrix.java-distribution }}"
91+
java-version: "${{ matrix.java-version }}"
92+
93+
- uses: actions/cache@v2
94+
id: maven-cache
95+
with:
96+
path: ~/.m2/
97+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
98+
restore-keys: |
99+
${{ runner.os }}-maven-
100+
101+
- name: Coverage report
102+
run: |
103+
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 }}
104+
env:
105+
CI_NAME: github
106+
COVERALLS_SECRET: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
<h3.git.remote>https://github.com/uber/h3.git</h3.git.remote>
7272
<h3.use.docker>true</h3.use.docker>
73+
<h3.remove.images>false</h3.remove.images>
7374
<!-- Used for passing additional arguments to surefire when using JaCoCo -->
7475
<h3.additional.argLine />
7576

@@ -160,7 +161,7 @@
160161
<dependency>
161162
<groupId>com.google.guava</groupId>
162163
<artifactId>guava</artifactId>
163-
<version>29.0-jre</version>
164+
<version>30.0-jre</version>
164165
<scope>test</scope>
165166
</dependency>
166167
</dependencies>
@@ -206,7 +207,7 @@
206207
<plugin>
207208
<groupId>org.jacoco</groupId>
208209
<artifactId>jacoco-maven-plugin</artifactId>
209-
<version>0.8.4</version>
210+
<version>0.8.7</version>
210211
<executions>
211212
<execution>
212213
<id>jacoco-instrument</id>
@@ -242,6 +243,7 @@
242243
<argument>${h3.git.remote}</argument>
243244
<argument>${h3.git.reference}</argument>
244245
<argument>${h3.use.docker}</argument>
246+
<argument>${h3.remove.images}</argument>
245247
</arguments>
246248
</configuration>
247249
</execution>

src/main/c/h3-java/build-h3.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
# limitations under the License.
1616
#
1717

18-
# Arguments: [git-remote] [git-ref] [use-docker]
19-
# git-remote - The git remote to pull from. An existing cloned repository
20-
# will not be deleted if a new remote is specified.
21-
# git-ref - Specific git ref of H3 to build.
22-
# use-docker - "true" to perform cross compilation via Docker, "false" to
23-
# skip that step.
18+
# Arguments: [git-remote] [git-ref] [use-docker] [remove-images]
19+
# git-remote - The git remote to pull from. An existing cloned repository
20+
# will not be deleted if a new remote is specified.
21+
# git-ref - Specific git ref of H3 to build.
22+
# use-docker - "true" to perform cross compilation via Docker, "false" to
23+
# skip that step.
24+
# remove-images - If use-docker is true and this argument is true, Docker
25+
# cross compilation images will be removed after each step
26+
# (i.e. for disk space constrained environments like CI)
2427
#
2528
# This script downloads H3, builds H3 and the H3-Java native library, and
2629
# cross compiles via Docker.
@@ -33,6 +36,7 @@ set -ex
3336
GIT_REMOTE=$1
3437
GIT_REVISION=$2
3538
USE_DOCKER=$3
39+
REMOVE_IMAGES=$4
3640

3741
echo Downloading H3 from "$GIT_REMOTE"
3842

@@ -136,4 +140,11 @@ for image in android-arm android-arm64 linux-arm64 linux-armv5 linux-armv7 linux
136140
if [ -e $BUILD_ROOT/lib/libh3-java.so ]; then cp $BUILD_ROOT/lib/libh3-java.so $OUTPUT_ROOT ; fi
137141
if [ -e $BUILD_ROOT/lib/libh3-java.dylib ]; then cp $BUILD_ROOT/lib/libh3-java.dylib $OUTPUT_ROOT ; fi
138142
if [ -e $BUILD_ROOT/lib/libh3-java.dll ]; then cp $BUILD_ROOT/lib/libh3-java.dll $OUTPUT_ROOT ; fi
143+
144+
if $REMOVE_IMAGES; then
145+
docker rmi dockcross/$image
146+
rm $BUILD_ROOT/dockcross
147+
fi
148+
echo Current disk usage:
149+
df -h
139150
done

0 commit comments

Comments
 (0)