Skip to content

Commit

Permalink
Test in GHA CI, use make for InspectorXSLT for #72
Browse files Browse the repository at this point in the history
This change integrates the Makefile-based testing harness for each of
the submodules.

For the InspectorXSLT submodule in the schema-gen directory, integrate
the shell script that orchestrates Maven's installation of dependencies
and execution of XML Calabash to run XProc files. The XProc pipeline
files will run the XSpec tests in batch mode.
  • Loading branch information
aj-stein-nist committed Feb 2, 2024
1 parent 93e1cda commit f773efd
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI
on:
push:
branches:
- main
- dev
pull_request: {}
env:
JAVA_VERSION: "17"
JAVA_DISTRIBUTION: "temurin"
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: "${{ env.JAVA_DISTRIBUTION }}"
java-version: "${{ env.JAVA_VERSION }}"
- name: Run unit tests
run: |
make -C src unit-test
id: unit-tests
- name: Run integration tests
run: |
make -C src smoke-test
id: integration-tests
- name: Run specification tests
run: |
make -C src spec-test
id: spec-tests
7 changes: 5 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
include testing/make_common.mk

# Each subdirectory that has a makefile
dirs:=$(dir $(wildcard ./*/Makefile))
# Each subdirectory (recursively) that has a makefile
# Makefile wildcard function does not support that, so we use the shell
# function with the find utility and look ever Makefile in a child dir
# relative to this one, but exclude this one to use with the FOREACH macro.
dirs:=$(shell find '.' ! -wholename ./Makefile -name 'Makefile' -printf "%h\n")

.PHONY: test
test: ## Run all tests
Expand Down
15 changes: 15 additions & 0 deletions src/schema-gen/InspectorXSLT/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include ../../testing/make_common.mk

MODULEPATH:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
XSPEC_SCRIPT=$(realpath $(MODULEPATH)/../../../support/xspec-dev/mvn-saxon-xspec-batch.sh)

.PHONY: test
test: smoke-test ## Run all tests

.PHONY: smoke-test
smoke-test: ## Run all smoke-tests
$(XSPEC_SCRIPT) "baseURI=file:$(XSPEC_SCRIPT)" "folder=$(MODULEPATH)/testing/tests" "recurse=yes"

# .PHONY: clean
# clean: ## Remove test output
# rm -fr $(output_folder)/*
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Modes to test:
</x:scenario>

<x:scenario label="[B] A simple but valid document (element) copies through">
<x:variable name="valid-file" select="document('../../../computer-valid/valid1.xml')"/>
<x:variable name="valid-file" href="../../computer-valid/valid1.xml"/>
<x:scenario label="[B.1] - A 'computer' document">
<!-- selecting '/' passes the root of the tree in as wanted, instead of the element alone. -->
<x:context select="/">
Expand Down
2 changes: 1 addition & 1 deletion src/testing/make_common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ endef
# Run a Makefile target for each directory, skipping directories whose Makefile does not contain a rule
define FOREACH_MAKE_OPTIONAL
@echo Running makefile target \'$1\' on all subdirectory makefiles that contain the rule
@$(call FOREACH,dir,$2,$(MAKE) -C $$dir -n $1 &> /dev/null && $(MAKE) -C $$dir $1 || echo "Makefile target '$1' does not exist in "$$dir". Continuing...")
@$(call FOREACH,dir,$2,$(MAKE) -C $$dir -n $1 &> /dev/null && $(MAKE) -C $$dir $1 || echo "Makefile target '$1' failed or does not exist in "$$dir". Continuing...")
endef
Empty file modified support/xspec-dev/mvn-saxon-xspec-batch.sh
100644 → 100755
Empty file.
Empty file modified support/xspec-dev/mvn-saxon-xspec-html.sh
100644 → 100755
Empty file.
Empty file modified support/xspec-dev/mvn-xproc-xspec-html.sh
100644 → 100755
Empty file.

0 comments on commit f773efd

Please sign in to comment.