Skip to content

Commit

Permalink
ci: Add a job to populate the matrix with default values
Browse files Browse the repository at this point in the history
  • Loading branch information
lqiu96 committed Dec 5, 2024
1 parent 6a28d36 commit ec2dcf9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@ on:
workflow_dispatch:
inputs:
protobuf_versions:
description: 'Comma separated list of Protobuf-Java versions (i.e. "3.25.5","4.28.3")'
# Default value for workflow_dispatch flow. If updating default value, update below as well.
default: '"3.25.5","4.28.3"'
description: 'Comma separated list of Protobuf-Java versions (i.e. "3.25.x","4.x.y")'
required: true
schedule:
- cron: '0 1 * * *' # Nightly at 1am

name: Downstream Source Compatibility Nightly
name: Downstream Compatibility Nightly
jobs:
downstream-protobuf-source-test:
#
define-matrix:
runs-on: ubuntu-22.04
outputs:
protobuf-version: ${{ steps.protobuf-versions.outputs.protobuf-versions }}
steps:
- name: Default Protobuf Versions
id: protobuf-versions
run: |
echo 'protobuf-versions=["3.25.4","4.28.3"]' >> "${GITHUB_OUTPUT}"
downstream-protobuf-test:
runs-on: ubuntu-22.04
needs: define-matrix
strategy:
fail-fast: false
matrix:
Expand All @@ -31,16 +40,15 @@ jobs:
- java-spanner
- java-storage
- java-storage-nio
# Specify the Protobuf versions here as well because the default values above are only supplied from
# the workflow_dispatch flow. Without this, the nightly workflow doesn't have a default input otherwise
# and would resolve to ''. When updating, update both places to keep default values consistent.
protobuf-version: ${{ fromJSON(format('[{0}]', inputs.protobuf_versions || '"3.25.5","4.28.3"')) }}
# Default values are specified from the `protobuf-versions` step in the `define-matrix` job. Without this,
# the nightly workflow doesn't have a default input and would resolve to ''.
protobuf-version: ${{ fromJSON(format('[{0}]', inputs.protobuf_versions || needs.define-matrix.outputs.protobuf-versions)) }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- run: mvn -version
- name: Perform downstream compatibility testing
- run: echo "Testing with Protobuf-Java v${{ matrix.protobuf-version }}"
- name: Perform downstream source compatibility testing
run: REPOS_UNDER_TEST="${{ matrix.repo }}" PROTOBUF_RUNTIME_VERSION="${{ matrix.protobuf-version}}" ./.kokoro/presubmit/downstream-protobuf-source-compatibility.sh
2 changes: 0 additions & 2 deletions .kokoro/presubmit/downstream-protobuf-source-compatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ source "$scriptDir/common.sh"

setup_maven_mirror

echo "Testing with Protobuf-Java v${PROTOBUF_RUNTIME_VERSION}"

for repo in ${REPOS_UNDER_TEST//,/ }; do # Split on comma
# Perform source-compatibility testing on main (latest changes)
git clone "https://github.com/googleapis/$repo.git" --depth=1
Expand Down

0 comments on commit ec2dcf9

Please sign in to comment.