Skip to content

Run tests

Run tests #90

Workflow file for this run

---
name: Run tests
on:
workflow_dispatch:
inputs:
os:
description: 'Runs on'
required: true
type: string
default: 'ubuntu-22.04 macos-12 windows-2022'
targets:
description: 'Test targets'
required: false
type: string
default: 'core swig-py swig-pl swig-rb javahl'
subversion:
description: 'Subversion (owner/repo@ref or URL-to-tarball)'
required: true
default: 'apache/subversion@trunk'
dependencies:
required: true
default: 'py3c=v1.4 apr=1.7.4 apr-util=1.6.3 httpd=2.4.58 serf=1.3.10 junit=4.13.2'
jobs:
setup:
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
ubuntu: ${{ steps.convert.outputs.ubuntu }}
macos: ${{ steps.convert.outputs.macos }}
windows: ${{ steps.convert.outputs.windows }}
targets: ${{ steps.convert.outputs.targets }}
subversion: ${{ steps.convert.outputs.subversion }}
dependencies: ${{ steps.convert.outputs.dependencies }}
steps:
- name: Show inputs
env:
INPUTS: ${{ toJSON(inputs) }}
run: |
set -ex
{
echo '### Inputs:'
echo '```json'
echo "$INPUTS"
echo '```'
} >>"$GITHUB_STEP_SUMMARY"
- name: Convert inputs to json outputs
id: convert
env:
INPUTS: ${{ toJSON(inputs) }}
run: |
set -ex
os_json() {
local name="$1"
local value="$(
cat "$tmpfile" |
jq -Mc '.os | split(" ") | map(select(startswith("'"$name"'-")))'
)"
echo "$name=$value"
}
targets_json() {
local name="$1"
local value="$(
cat "$tmpfile" |
jq -Mc '."'"$name"'" | split(" ") | map(select(.!=""))'
)"
echo "$name=$value"
}
svn_json() {
local name="$1"
local value="$(jq -r ".\"$name\"" <"$tmpfile")"
case "$value" in
apache/subversion@*|$GITHUB_REPOSITORY_OWNER/*@*)
value="$(
echo "$value" |
jq -RMc 'split("@") | {repository: .[0], ref: .[1]}'
)"
;;
https://dist.apache.org/*/subversion-*.tar.bz2)
value="$(echo "$value" | jq -RMc '{archive: .}')"
;;
*)
echo "Unrecognized inputs.subversion: '$value'" 1>&2
exit 1
;;
esac
echo "$name=$value"
}
deps_json() {
local name="$1"
local value="$(
cat "$tmpfile" |
jq -Mc '."'"$name"'" | split(" ") | map(select(.!="") | split("=") | {(.[0]): .[1]}) | add'
)"
echo "$name=$value"
}
tmpfile="$(mktemp)"
echo "$INPUTS" >"$tmpfile"
{
os_json 'ubuntu'
os_json 'macos'
os_json 'windows'
targets_json 'targets'
svn_json 'subversion'
deps_json 'dependencies'
} >>"$GITHUB_OUTPUT"
{
echo '### Outputs:'
echo '```'
cat "$GITHUB_OUTPUT"
echo '```'
} >>"$GITHUB_STEP_SUMMARY"
- name: Cache Subversion archives
if: ${{ fromJson(steps.convert.outputs.subversion).archive }}
uses: actions/cache@v3
with:
path: arc
enableCrossOsArchive: true
key: arc--${{ fromJson(steps.convert.outputs.subversion).archive }}
restore-keys: |
arc--${{ fromJson(steps.convert.outputs.subversion).archive }}
arc--
- name: Cache junit jar file
if: ${{ contains(fromJson(steps.convert.outputs.targets), 'javahl') }}
uses: actions/cache@v3
with:
path: arc
enableCrossOsArchive: true
key: arc--junit-${{ fromJson(steps.convert.outputs.dependencies).junit }}
restore-keys: |
arc--junit-${{ fromJson(steps.convert.outputs.dependencies).junit }}
arc--
- name: Download Subversion archives
if: ${{ fromJson(steps.convert.outputs.subversion).archive }}
env:
SVNARC: ${{ fromJson(steps.convert.outputs.subversion).archive }}
run: |
set -ex
test -d arc || mkdir arc
wget -nv -N -P arc "$SVNARC" "${SVNARC%.tar.bz2}.zip"
- name: Download junit jar file
if: ${{ contains(fromJson(steps.convert.outputs.targets), 'javahl') }}
env:
JUNIT_VER: ${{ fromJson(steps.convert.outputs.dependencies).junit }}
run: |
set -ex
junit_url="https://repo1.maven.org/maven2/junit/junit/$JUNIT_VER/junit-$JUNIT_VER.jar"
test -d arc || mkdir arc
wget -nv -N -P arc "$junit_url"
test-ubuntu:
if: ${{ needs.setup.outputs.ubuntu != '[]' }}
needs: setup
uses: ./.github/workflows/test-ubuntu.yml
with:
targets: ${{ needs.setup.outputs.targets }}
os: ${{ needs.setup.outputs.ubuntu }}
subversion: ${{ needs.setup.outputs.subversion }}
dependencies: ${{ needs.setup.outputs.dependencies }}
test-macos:
if: ${{ needs.setup.outputs.macos != '[]' }}
needs: setup
uses: ./.github/workflows/test-macos.yml
with:
targets: ${{ needs.setup.outputs.targets }}
os: ${{ needs.setup.outputs.macos }}
subversion: ${{ needs.setup.outputs.subversion }}
dependencies: ${{ needs.setup.outputs.dependencies }}
test-windows:
if: ${{ needs.setup.outputs.windows != '[]' }}
needs: setup
uses: ./.github/workflows/test-windows.yml
with:
targets: ${{ needs.setup.outputs.targets }}
os: ${{ needs.setup.outputs.windows }}
subversion: ${{ needs.setup.outputs.subversion }}
dependencies: ${{ needs.setup.outputs.dependencies }}