Skip to content

Commit

Permalink
Add the input to allow to specify test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
jun66j5 committed Dec 28, 2023
1 parent 6acf6c1 commit 3d66beb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 48 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Run tests on macOS
on:
workflow_call:
inputs:
targets: {required: true, type: string}
os: {required: true, type: string}
subversion-repository: {required: true, type: string}
subversion-ref: {required: true, type: string}
Expand All @@ -16,8 +17,9 @@ env:
jobs:

swig-py:
if: ${{ contains(fromJson(inputs.targets), 'swig-py') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -26,8 +28,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
python-version: ['3.12', '3.11', '3.10']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_PYVER: ${{ matrix.python-version }}
Expand Down Expand Up @@ -66,8 +66,9 @@ jobs:


swig-rb:
if: ${{ contains(fromJson(inputs.targets), 'swig-rb') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -76,8 +77,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
ruby-version: ['3.3', '3.2', '2.7']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}

Expand Down Expand Up @@ -108,8 +107,9 @@ jobs:


swig-pl:
if: ${{ contains(fromJson(inputs.targets), 'swig-pl') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -118,8 +118,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
# perl-version: ['5.34', '5.22']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}

Expand Down Expand Up @@ -152,8 +150,9 @@ jobs:


javahl:
if: ${{ contains(fromJson(inputs.targets), 'javahl') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -162,8 +161,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
java-version: ['21', '8']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}

Expand Down Expand Up @@ -195,8 +192,8 @@ jobs:


core:
if: ${{ contains(fromJson(inputs.targets), 'core') }}
runs-on: ${{ matrix.os }}

timeout-minutes: 90

strategy:
Expand Down Expand Up @@ -237,7 +234,6 @@ jobs:

prepare:
runs-on: ${{ matrix.os }}

timeout-minutes: 60

strategy:
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Run tests on Ubuntu
on:
workflow_call:
inputs:
targets: {required: true, type: string}
os: {required: true, type: string}
subversion-repository: {required: true, type: string}
subversion-ref: {required: true, type: string}
Expand All @@ -16,8 +17,9 @@ env:
jobs:

swig-py:
if: ${{ contains(fromJson(inputs.targets), 'swig-py') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -29,8 +31,6 @@ jobs:
- {os: ubuntu-22.04, python-version: '3.6'}
- {os: ubuntu-22.04, python-version: '3.5'}

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}
MATRIX_PYVER: ${{ matrix.python-version }}
Expand Down Expand Up @@ -69,8 +69,9 @@ jobs:


swig-rb:
if: ${{ contains(fromJson(inputs.targets), 'swig-rb') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -79,8 +80,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
ruby-version: ['3.3', '3.2', '3.1', '3.0', '2.7', '2.6', '2.5', '2.4']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}

Expand Down Expand Up @@ -111,8 +110,9 @@ jobs:


swig-pl:
if: ${{ contains(fromJson(inputs.targets), 'swig-pl') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -121,8 +121,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
perl-version: ['5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}

Expand Down Expand Up @@ -153,8 +151,9 @@ jobs:


javahl:
if: ${{ contains(fromJson(inputs.targets), 'javahl') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 15

strategy:
Expand All @@ -163,8 +162,6 @@ jobs:
os: ${{ fromJson(inputs.os) }}
java-version: ['21', '17', '16', '11', '8']

needs: prepare

env:
MATRIX_OS: ${{ matrix.os }}

Expand Down Expand Up @@ -196,8 +193,8 @@ jobs:


core:
if: ${{ contains(fromJson(inputs.targets), 'core') }}
runs-on: ${{ matrix.os }}

timeout-minutes: 60

strategy:
Expand Down Expand Up @@ -238,7 +235,6 @@ jobs:

prepare:
runs-on: ${{ matrix.os }}

timeout-minutes: 60

strategy:
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Run tests on Windows
on:
workflow_call:
inputs:
targets: {required: true, type: string}
os: {required: true, type: string}
subversion-repository: {required: true, type: string}
subversion-ref: {required: true, type: string}
Expand All @@ -18,17 +19,16 @@ env:
jobs:

core:
if: ${{ contains(fromJson(inputs.targets), 'core') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 60

strategy:
fail-fast: false
matrix:
os: ${{ fromJson(inputs.os) }}

needs: prepare

defaults:
run:
shell: pwsh
Expand Down Expand Up @@ -80,8 +80,9 @@ jobs:
bindings:
if: ${{ contains(fromJson(inputs.targets), 'bindings') }}
runs-on: ${{ matrix.os }}

needs: prepare
timeout-minutes: 30

strategy:
Expand All @@ -92,8 +93,6 @@ jobs:
perl-version: ['5']
java-version: ['21']

needs: prepare

defaults:
run:
shell: pwsh
Expand Down Expand Up @@ -168,7 +167,6 @@ jobs:
prepare:
runs-on: ${{ matrix.os }}

timeout-minutes: 60

strategy:
Expand Down
37 changes: 24 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
type: choice
default: ''
options: ['', 'windows-2022', 'windows-2019']
targets:
description: 'Test targets'
required: false
type: string
default: 'core swig-py swig-pl swig-rb javahl bindings'
subversion-repository:
required: true
default: apache/subversion
Expand All @@ -46,6 +51,7 @@ jobs:
ubuntu-version: ${{ steps.convert.outputs.ubuntu-version }}
macos-version: ${{ steps.convert.outputs.macos-version }}
windows-version: ${{ steps.convert.outputs.windows-version }}
targets: ${{ steps.convert.outputs.targets }}
dependencies: ${{ steps.convert.outputs.dependencies }}
steps:
- name: Show inputs
Expand All @@ -62,36 +68,39 @@ jobs:
- name: Convert inputs to json outputs
id: convert
env:
INPUT_UBUNTU_VERSION: ${{ inputs.ubuntu-version }}
INPUT_MACOS_VERSION: ${{ inputs.macos-version }}
INPUT_WINDOWS_VERSION: ${{ inputs.windows-version }}
INPUT_DEPENDENCIES: ${{ inputs.dependencies }}
INPUTS: ${{ toJSON(inputs) }}
run: |
set -ex
words_json() {
local name="$1"
local value="$2"
value="$(echo "$value" | jq -RMcn 'inputs | split(" ")')"
local value="$(
echo "$INPUTS" |
jq -Mc '."'"$name"'" | split(" ")'
)"
echo "$name=$value"
}
deps_json() {
pairs_json() {
local name="$1"
local value="$2"
value="$(echo "$value" | jq -RMcn 'inputs | split(" ") | map(split("=") | {(.[0]): .[1]}) | add')"
local value="$(
echo "$INPUTS" |
jq -Mc '."'"$name"'" | split(" ") | map(split("=") | {(.[0]): .[1]}) | add'
)"
echo "$name=$value"
}
{
words_json 'ubuntu-version' "$INPUT_UBUNTU_VERSION"
words_json 'macos-version' "$INPUT_MACOS_VERSION"
words_json 'windows-version' "$INPUT_WINDOWS_VERSION"
deps_json 'dependencies' "$INPUT_DEPENDENCIES"
words_json 'ubuntu-version'
words_json 'macos-version'
words_json 'windows-version'
words_json 'targets'
pairs_json 'dependencies'
} >>"$GITHUB_OUTPUT"
test-ubuntu:
if: ${{ inputs.ubuntu-version }}
needs: setup
uses: ./.github/workflows/test-ubuntu.yml
with:
targets: ${{ needs.setup.outputs.targets }}
os: ${{ needs.setup.outputs.ubuntu-version }}
subversion-repository: ${{ inputs.subversion-repository }}
subversion-ref: ${{ inputs.subversion-ref }}
Expand All @@ -103,6 +112,7 @@ jobs:
needs: setup
uses: ./.github/workflows/test-macos.yml
with:
targets: ${{ needs.setup.outputs.targets }}
os: ${{ needs.setup.outputs.macos-version }}
subversion-repository: ${{ inputs.subversion-repository }}
subversion-ref: ${{ inputs.subversion-ref }}
Expand All @@ -114,6 +124,7 @@ jobs:
needs: setup
uses: ./.github/workflows/test-windows.yml
with:
targets: ${{ needs.setup.outputs.targets }}
os: ${{ needs.setup.outputs.windows-version }}
subversion-repository: ${{ inputs.subversion-repository }}
subversion-ref: ${{ inputs.subversion-ref }}
Expand Down

0 comments on commit 3d66beb

Please sign in to comment.