-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathtest-asciidoctor-upstream.sh
executable file
·34 lines (28 loc) · 1.54 KB
/
test-asciidoctor-upstream.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# This script runs the AsciidoctorJ tests against the specified ref of the Asciidoctor Ruby gem.
set -euo pipefail
# to build against a tag, set REF to a git tag name (e.g., refs/tags/v1.5.2)
REF=${1:-refs/heads/main}
if [[ $REF != refs/* ]]; then
REF=refs/heads/$REF
fi
readonly BASE_REF="${REF##*/}"
readonly SRC_DIR="asciidoctor-${BASE_REF#v}"
readonly WORKING_DIR="build/maven"
rm -rf $WORKING_DIR && mkdir -p $WORKING_DIR
pushd $WORKING_DIR
## Install gem
wget --quiet -O $SRC_DIR.zip https://github.com/asciidoctor/asciidoctor/archive/$REF.zip
unzip -q $SRC_DIR.zip
cp ../../ci/asciidoctor-gem-installer.pom $SRC_DIR/pom.xml
cd $SRC_DIR
readonly ASCIIDOCTOR_VERSION=`grep 'VERSION' ./lib/asciidoctor/version.rb | sed "s/.*'\(.*\)'.*/\1/" | sed "s/[.]dev$/.dev-SNAPSHOT/"`
# we don't use sed -i here for compatibility with OSX
sed "s;<version></version>;<version>$ASCIIDOCTOR_VERSION</version>;" pom.xml > pom.xml.sedtmp && \
mv -f pom.xml.sedtmp pom.xml
# we override the jruby version here with one supported by java9, additionally java9 needs some add-opens arguments that need to be ignored on older jvms
mvn install -B --no-transfer-progress -Dgemspec=asciidoctor.gemspec -Djruby.version=9.2.17.0 -Djruby.jvmargs="-XX:+IgnoreUnrecognizedVMOptions --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED"
popd
## Test against installed gem
./gradlew -S -Pskip.signing -PasciidoctorGemVersion=$ASCIIDOCTOR_VERSION -PuseMavenLocal=true check
exit $?