Skip to content

Commit a1455c8

Browse files
committed
provide github ref override
1 parent 4a0fa19 commit a1455c8

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ jobs:
195195
196196
- name: Download and test
197197
run: |
198-
mvn clean test -Dh3.github.artifacts=true
198+
mvn clean test -Dh3.github.artifacts.use=true -Dh3.github.artifacts.ref=${{ github.ref }}
199199
env:
200200
GH_TOKEN: ${{ github.token }}

docs/releasing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Release builds should only be run on Mac OSX with Docker. This is needed so that
88

99
1. Ensure you are on branch `master` and that the library is building correctly.
1010
2. Update [CHANGELOG.md](../CHANGELOG.md) to have the correct date and new version number, update [README.md](../README.md) to have the correct version numbers, and commit.
11-
3. `mvn release:prepare -Dh3.github.artifacts=true` Use the new version number when prompted.
12-
4. `mvn release:perform -Dh3.github.artifacts=true`
11+
3. `mvn release:prepare -Dh3.github.artifacts.use=true` Use the new version number when prompted.
12+
4. `mvn release:perform -Dh3.github.artifacts.use=true`
1313
5. If this looks good, close and release the build in [Sonatype Nexus Manager](https://oss.sonatype.org/).
1414
6. Update `CHANGELOG.md` to have an Unreleased section, and commit. The release is now done and development can resume from this point.
1515

pom.xml

+3-9
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
<h3.use.docker>true</h3.use.docker>
7373
<h3.system.prune>false</h3.system.prune>
7474
<h3.dockcross.tag>20210624-de7b1b0</h3.dockcross.tag>
75-
<h3.github.artifacts>false</h3.github.artifacts>
75+
<h3.github.artifacts.use>false</h3.github.artifacts.use>
76+
<h3.github.artifacts.ref />
7677
<!-- Used for passing additional arguments to surefire when using JaCoCo -->
7778
<h3.additional.argLine />
7879

@@ -263,14 +264,7 @@
263264
</goals>
264265
<configuration>
265266
<executable>${basedir}/src/main/c/h3-java/build-h3.sh</executable>
266-
<arguments>
267-
<argument>${h3.git.remote}</argument>
268-
<argument>${h3.git.reference}</argument>
269-
<argument>${h3.use.docker}</argument>
270-
<argument>${h3.system.prune}</argument>
271-
<argument>${h3.dockcross.tag}</argument>
272-
<argument>${h3.github.artifacts}</argument>
273-
</arguments>
267+
<commandlineArgs>${h3.git.remote} ${h3.git.reference} ${h3.use.docker} ${h3.system.prune} ${h3.dockcross.tag} ${h3.github.artifacts.use} ${h3.github.artifacts.ref}</commandlineArgs>
274268
</configuration>
275269
</execution>
276270
</executions>

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

+13-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
# Arguments: [git-remote] [git-ref] [use-docker] [remove-images] [github-artifacts]
18+
# Arguments: [git-remote] [git-ref] [use-docker] [remove-images] [github-artifacts] [github-artifacts-ref]
1919
# git-remote - The git remote to pull from. An existing cloned repository
2020
# will not be deleted if a new remote is specified.
2121
# git-ref - Specific git ref of H3 to build.
@@ -28,6 +28,8 @@
2828
# github-artifacts - When set, all build artifacts are retrieved from Github
2929
# Actions artifacts rather than built locally (overrides
3030
# all other settings.)
31+
# github-artifacts-ref - When set, override the default revision to pull artifacts from
32+
# for `github-artifacts`.
3133
#
3234
# This script downloads H3, builds H3 and the H3-Java native library, and
3335
# cross compiles via Docker.
@@ -42,11 +44,12 @@ GIT_REVISION=$2
4244
USE_DOCKER=$3
4345
SYSTEM_PRUNE=$4
4446
DOCKCROSS_TAG=$5
45-
PULL_FROM_GITHUB=$6
47+
GITHUB_ARTIFACTS=$6
48+
GITHUB_ARTIFACTS_REF=$7
4649

47-
if $PULL_FROM_GITHUB; then
48-
src/main/c/h3-java//pull-from-github.sh
49-
exit 0
50+
if $GITHUB_ARTIFACTS; then
51+
src/main/c/h3-java/pull-from-github.sh "$GITHUB_ARTIFACTS_REF"
52+
# The build of the library below is still needed for the binding-functions file
5053
fi
5154

5255
echo Downloading H3 from "$GIT_REMOTE"
@@ -99,6 +102,11 @@ cp h3-java-build/build/binding-functions .
99102

100103
popd # target
101104

105+
if $GITHUB_ARTIFACTS; then
106+
# Nothing more is needed than the binding-functions to stop now.
107+
exit 0
108+
fi
109+
102110
# Copy the built artifact for this platform.
103111
case "$(uname -sm)" in
104112
"Linux x86_64") LIBRARY_DIR=linux-x64 ;;

src/main/c/h3-java/pull-from-github.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424

2525
set -eox pipefail
2626

27-
GIT_REVISION=$(git rev-parse HEAD)
27+
GITHUB_ARTIFACTS_REF=$1
28+
29+
if [ -z "$GITHUB_ARTIFACTS_REF" ]; then
30+
GIT_REVISION=$(git rev-parse HEAD)
31+
else
32+
GIT_REVISION="$GITHUB_ARTIFACTS_REF"
33+
fi
2834
EXTRACT_TO=src/main/resources
2935

3036
echo downloading artifacts for $GIT_REVISION

0 commit comments

Comments
 (0)