Run tests #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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-repository: | |
required: true | |
default: apache/subversion | |
subversion-ref: | |
required: true | |
default: 'trunk' | |
subversion-archive: | |
required: false | |
default: '' | |
sqlite-archive: | |
required: true | |
default: 'https://www.sqlite.org/2022/sqlite-amalgamation-3390400.zip' | |
dependencies: | |
required: true | |
default: 'py3c=v1.4 apr=1.7.4 apr-util=1.6.3 httpd=2.4.58 serf=1.3.10' | |
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 }} | |
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" | |
} | |
words_json() { | |
local name="$1" | |
local value="$( | |
cat "$tmpfile" | | |
jq -Mc '."'"$name"'" | split(" ") | map(select(.!=""))' | |
)" | |
echo "$name=$value" | |
} | |
pairs_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' | |
words_json 'targets' | |
pairs_json 'dependencies' | |
} >>"$GITHUB_OUTPUT" | |
{ | |
echo '### Outputs:' | |
echo '```' | |
cat "$GITHUB_OUTPUT" | |
echo '```' | |
} >>"$GITHUB_STEP_SUMMARY" | |
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-repository: ${{ inputs.subversion-repository }} | |
subversion-ref: ${{ inputs.subversion-ref }} | |
subversion-archive: ${{ inputs.subversion-archive }} | |
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-repository: ${{ inputs.subversion-repository }} | |
subversion-ref: ${{ inputs.subversion-ref }} | |
subversion-archive: ${{ inputs.subversion-archive }} | |
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-repository: ${{ inputs.subversion-repository }} | |
subversion-ref: ${{ inputs.subversion-ref }} | |
subversion-archive: ${{ inputs.subversion-archive }} | |
sqlite-archive: ${{ inputs.sqlite-archive }} | |
dependencies: ${{ needs.setup.outputs.dependencies }} |