From 3d66beb102cd792821feed3bf9505a6074ffdb13 Mon Sep 17 00:00:00 2001 From: Jun Omae Date: Thu, 28 Dec 2023 09:44:00 +0900 Subject: [PATCH] Add the input to allow to specify test targets --- .github/workflows/test-macos.yml | 24 ++++++++----------- .github/workflows/test-ubuntu.yml | 24 ++++++++----------- .github/workflows/test-windows.yml | 12 ++++------ .github/workflows/test.yml | 37 +++++++++++++++++++----------- 4 files changed, 49 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 662656b..398db64 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -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} @@ -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: @@ -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 }} @@ -66,8 +66,9 @@ jobs: swig-rb: + if: ${{ contains(fromJson(inputs.targets), 'swig-rb') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 15 strategy: @@ -76,8 +77,6 @@ jobs: os: ${{ fromJson(inputs.os) }} ruby-version: ['3.3', '3.2', '2.7'] - needs: prepare - env: MATRIX_OS: ${{ matrix.os }} @@ -108,8 +107,9 @@ jobs: swig-pl: + if: ${{ contains(fromJson(inputs.targets), 'swig-pl') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 15 strategy: @@ -118,8 +118,6 @@ jobs: os: ${{ fromJson(inputs.os) }} # perl-version: ['5.34', '5.22'] - needs: prepare - env: MATRIX_OS: ${{ matrix.os }} @@ -152,8 +150,9 @@ jobs: javahl: + if: ${{ contains(fromJson(inputs.targets), 'javahl') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 15 strategy: @@ -162,8 +161,6 @@ jobs: os: ${{ fromJson(inputs.os) }} java-version: ['21', '8'] - needs: prepare - env: MATRIX_OS: ${{ matrix.os }} @@ -195,8 +192,8 @@ jobs: core: + if: ${{ contains(fromJson(inputs.targets), 'core') }} runs-on: ${{ matrix.os }} - timeout-minutes: 90 strategy: @@ -237,7 +234,6 @@ jobs: prepare: runs-on: ${{ matrix.os }} - timeout-minutes: 60 strategy: diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index 259d2ea..9349d01 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -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} @@ -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: @@ -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 }} @@ -69,8 +69,9 @@ jobs: swig-rb: + if: ${{ contains(fromJson(inputs.targets), 'swig-rb') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 15 strategy: @@ -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 }} @@ -111,8 +110,9 @@ jobs: swig-pl: + if: ${{ contains(fromJson(inputs.targets), 'swig-pl') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 15 strategy: @@ -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 }} @@ -153,8 +151,9 @@ jobs: javahl: + if: ${{ contains(fromJson(inputs.targets), 'javahl') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 15 strategy: @@ -163,8 +162,6 @@ jobs: os: ${{ fromJson(inputs.os) }} java-version: ['21', '17', '16', '11', '8'] - needs: prepare - env: MATRIX_OS: ${{ matrix.os }} @@ -196,8 +193,8 @@ jobs: core: + if: ${{ contains(fromJson(inputs.targets), 'core') }} runs-on: ${{ matrix.os }} - timeout-minutes: 60 strategy: @@ -238,7 +235,6 @@ jobs: prepare: runs-on: ${{ matrix.os }} - timeout-minutes: 60 strategy: diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index f0cf0ac..224949c 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -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} @@ -18,8 +19,9 @@ env: jobs: core: + if: ${{ contains(fromJson(inputs.targets), 'core') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 60 strategy: @@ -27,8 +29,6 @@ jobs: matrix: os: ${{ fromJson(inputs.os) }} - needs: prepare - defaults: run: shell: pwsh @@ -80,8 +80,9 @@ jobs: bindings: + if: ${{ contains(fromJson(inputs.targets), 'bindings') }} runs-on: ${{ matrix.os }} - + needs: prepare timeout-minutes: 30 strategy: @@ -92,8 +93,6 @@ jobs: perl-version: ['5'] java-version: ['21'] - needs: prepare - defaults: run: shell: pwsh @@ -168,7 +167,6 @@ jobs: prepare: runs-on: ${{ matrix.os }} - timeout-minutes: 60 strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 058576a..8f0571b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 @@ -62,29 +68,31 @@ 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: @@ -92,6 +100,7 @@ jobs: 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 }} @@ -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 }} @@ -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 }}