ci: Test upper bound dependenices file in Github CI #24
Workflow file for this run
This file contains hidden or 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: Dependency Compatibility Test | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
inputs: | |
dependencies-list: | |
description: 'Comma-separated list of dependencies to test (Example format: protobuf=4.31.0,guava=33.4.8-jre). | |
Do not include the `-D` prefix or `.version` suffix. Those values will be appended when generating | |
the command. No input (default) will run the the upper-bound dependencies file.' | |
required: false | |
default: '' | |
schedule: | |
- cron: '0 1 * * *' # Nightly at 1am | |
jobs: | |
dependency-compatibility-test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout sdk-platform-java | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
# The workflow_dispatch event is for team members who want to manually test certain dependencies + version combos | |
# The normal workflow is not from `workflow_dispatch` and will use the default upper-bounds dependencies file | |
- name: Determine Inputted Dependencies List | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dependencies-list != '' }} | |
run: echo "DEPENDENCIES_LIST=${{ github.event.inputs.dependencies-list }}" >> $GITHUB_ENV | |
# Install the modules for the rest of the CI | |
- name: Install sdk-platform-java's modules | |
# gapic-generator-java requires Java 8 and is irrelevant for this CI | |
run: mvn -q -B -ntp install --projects '!gapic-generator-java' -Dcheckstyle.skip -Dfmt.skip -DskipTests -Dclirr.skip -T 1C | |
# Run in the root module which should test for everything except for showcase | |
- name: Perform Dependency Compatibility Testing | |
shell: bash | |
run: | | |
if [[ -n "${{ env.DEPENDENCIES_LIST }}" ]]; then | |
./.github/scripts/test_dependency_compatibility.sh -l ${{ env.DEPENDENCIES_LIST }} | |
else | |
./.github/scripts/test_dependency_compatibility.sh | |
fi | |
# Set up local showcase server to run the showcase ITs | |
- name: Parse showcase version | |
working-directory: java-showcase/gapic-showcase | |
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV" | |
- name: Install showcase server | |
run: | | |
sudo mkdir -p /usr/src/showcase | |
sudo chown -R ${USER} /usr/src/ | |
curl --location https://github.com/googleapis/gapic-showcase/releases/download/v${{env.SHOWCASE_VERSION}}/gapic-showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${{env.SHOWCASE_VERSION}}-linux-amd64.tar.gz | |
cd /usr/src/showcase/ | |
tar -xf showcase-* | |
./gapic-showcase run & | |
cd - | |
# Run specifically for showcase | |
- name: Perform Dependency Compatibility Testing (Showcase only) | |
shell: bash | |
# Need to cd out of the directory to get the scripts as this step is run inside the java-showcase directory | |
run: | | |
if [[ -n "${{ env.DEPENDENCIES_LIST }}" ]]; then | |
../.github/scripts/test_dependency_compatibility.sh -l ${{ env.DEPENDENCIES_LIST }} | |
else | |
../.github/scripts/test_dependency_compatibility.sh -f ../dependencies.txt | |
fi | |
working-directory: java-showcase |