Skip to content

Commit

Permalink
Run tests with gradle test
Browse files Browse the repository at this point in the history
* Update the docs to explain how to run tests
* Create GitHub Actions CI to replace Travis CI

Closes relaxng#269

Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Sep 29, 2022
1 parent 84ec6ad commit 1dc2abf
Show file tree
Hide file tree
Showing 12 changed files with 402 additions and 67 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests CI

on: [push]

jobs:
build:
strategy:
matrix:
jdk: [8, 11, 17] # lts releases
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ doc/
modbuild.xml
modules.xml
*.iml
.gradle
/bin/
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

15 changes: 6 additions & 9 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
:artifactId: jing
:repository: jing-trang

image:https://travis-ci.org/relaxng/{repository}.svg?branch=master["Build Status", link="https://travis-ci.org/relaxng/{repository}"]
image:https://img.shields.io/github/workflow/status/relaxng/{repository}/tests/master?style=plastic["Build Status", link="https://travis-ci.org/relaxng/{repository}"]
image:https://maven-badges.herokuapp.com/maven-central/{groupId}/{artifactId}/badge.svg["Artifact on Maven Central", link="http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22{groupId}%22%20a%3A%22{artifactId}%22"]
image:http://www.javadoc.io/badge/{groupId}/{artifactId}.svg["Javadocs", link="http://www.javadoc.io/doc/{groupId}/{artifactId}"]

After cloning the repository, here's how to build.
== Building

. Ensure you have git and JDK 8 or above installed.
All other dependencies are included in the repository.
Expand All @@ -26,11 +26,8 @@ After cloning the repository, here's how to build.
. Change your working directory to be the `jing-trang` directory (that is,
the directory containing this file).

. Run the `ant` script included in the repository. On Linux, use the
command `./ant`. On Windows, use `.\ant`.
That runs the version of `ant` included in the repository. When the
`ant` script completes, you should find `jing.jar` and `trang.jar` files
. Run `./gradlew` (Linux, macOS) or `.\gradle.bat` (Windows) at the root of the repository to build the project.
When the build completes, you should find `jing.jar` and `trang.jar` files
in the `build` subdirectory.
You can also tell the `ant` script to build the `test` target, which
will build the jars and then run some tests. On Linux, use the command
`./ant test`. On Windows, use `.\ant test`.
You can also use `./gradlew test` or `.\gradle.bat test` to run the `test` target, which
will build the jars and then run some tests.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ tasks.named("build") {
dependsOn(jingTrang)
}

tasks.named("test") {
dependsOn(jingTrang)
dependsOn(":ant-test")
}

val antJar: TaskProvider<Task> = tasks.named("ant-jar")

// https://stackoverflow.com/questions/27993814/only-run-task-if-another-isnt-up-to-date-in-gradle
Expand Down
36 changes: 18 additions & 18 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</target>

<target name="ant-test" depends="modbuild">
<ant antfile="modbuild.xml" target="ant-test"/>
<ant antfile="modbuild.xml" target="test"/>
</target>

<target name="srczip" depends="modbuild">
Expand Down Expand Up @@ -275,12 +275,12 @@
</copy>
<replace file="${build.dir}/jing-bin/readme.html" token="@VERSION@" value="${version}"/>
<zip zipfile="${build.dir}/dist/jing-${version}.zip">
<zipfileset dir="${build.dir}" includes="jing.jar" prefix="jing-${version}/bin"/>
<zipfileset dir="${build.dir}" includes="jing.jar" prefix="jing-${version}/bin"/>
<zipfileset dir="lib" includes="saxon9.jar,isorelax.jar,xercesImpl.jar,xml-apis.jar"
prefix="jing-${version}/bin"/>
prefix="jing-${version}/bin"/>
<zipfileset dir="${build.dir}/mod/jing"
includes="src.zip"
prefix="jing-${version}"/>
prefix="jing-${version}"/>
<zipfileset dir="${build.dir}" includes="api/**" prefix="jing-${version}/doc"/>
<zipfileset dir="eg" includes="relaxng.rng,xslt.rng,relaxCore.rng,relaxCoreDatatypes.rng"
prefix="jing-${version}/lib"/>
Expand Down Expand Up @@ -337,7 +337,7 @@
includes="trang.jar"
prefix="trang-${version}"/>
<zipfileset dir="${build.dir}/mod/trang"
includes="src.zip"
includes="src.zip"
prefix="trang-${version}"/>
</zip>
<checksum file="${build.dir}/dist/trang-${version}.zip" algorithm="sha1"/>
Expand Down Expand Up @@ -380,7 +380,7 @@
includes="dtdinst.jar"
prefix="dtdinst-${version}"/>
<zipfileset dir="${build.dir}/mod/dtdinst"
includes="src.zip"
includes="src.zip"
prefix="dtdinst-${version}"/>
</zip>
<checksum file="${build.dir}/dist/dtdinst-${version}.zip" algorithm="sha1"/>
Expand Down Expand Up @@ -430,24 +430,24 @@
description="Upload files to Google Code. Run dist before this.">
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask"
classpath="${lib.dir}/ant-googlecode.jar" name="gcupload"/>
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="jing-${version}.zip"
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="jing-${version}.zip"
filename="${build.dir}/dist/jing-${version}.zip"
summary="Jing version ${version} packaged for use with JRE (includes binary, source and documentation)"
labels="Featured, Type-Archive, OpSys-All, Version-${version}"/>
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="trang-${version}.zip"
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="trang-${version}.zip"
filename="${build.dir}/dist/trang-${version}.zip"
summary="Trang version ${version} packaged for use with JRE (includes binary, source and documentation)"
labels="Featured, Type-Archive, OpSys-All, Version-${version}"/>
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="dtdinst-${version}.zip"
<gcupload username="${googlecode.username}"
password="${googlecode.password}"
projectname="jing-trang"
targetfilename="dtdinst-${version}.zip"
filename="${build.dir}/dist/dtdinst-${version}.zip"
summary="DTDinst version ${version} packaged for use with JRE (includes binary, source and documentation)"
labels="Type-Archive, OpSys-All, Version-${version}"/>
Expand Down
15 changes: 7 additions & 8 deletions build.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<xsl:output indent="yes"
encoding="utf-8"/>

<xsl:variable name="build" select="'${build.dir}'"/>
<xsl:variable name="doc" select="'${doc.dir}'"/>
<xsl:template match="/">
Expand Down Expand Up @@ -336,13 +336,12 @@
<xslt style="{$srctestdir}/{@transform}"
in="{$srctest}"
out="{$runtestdir}/{@name}test.xml">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
</factory>
<factory name="net.sf.saxon.TransformerFactoryImpl" />
<classpath>
<fileset dir="lib">
<filename name="saxon9.jar"/>
</fileset>
</classpath>
</xslt>
<!-- XXX Could validate intermediate result against a schema -->
</xsl:if>
Expand Down
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 1dc2abf

Please sign in to comment.