Skip to content

Commit

Permalink
ci(showcase): add showcase testing (#1188)
Browse files Browse the repository at this point in the history
* ci(showcase): add showcase testing

* ci(showcase): relocate showcase golden files from ./test to ./showcase/<project>

* ci(showcase): update DEVELOPMENT.md with showcase testing instructions

* ci(showcase): ignore license header check for generated showcase client

* ci(showcase): single-line addlicense call

* ci(showcase): change addlicense argument order

* ci(showcase): change addlicense argument order

* ci(showcase): replace -ignore parameter with filtered 'find'

* ci(showcase): fix working-directory in ./github/workflows/ci-maven.yaml

* ci(showcase): set SHOWCASE_VERSION env in github actions

* ci(showcase): correct path to showcase server download directory

* ci(showcase): remove unused test dependencies and javadoc configurations

* ci(showcase): use gapic-generator-java-pom-parent in showcase/pom.xml

* ci(showcase): use gapic-generator-java-bom as parent in showcase/pom.xml

* ci(showcase): install maven modules before showcase testing

* ci(showcase): remove Java 8 build as it's not supported for gax

* ci(showcase): use bazelisk instead of bazel for showcase client generation
  • Loading branch information
burkedavison authored Dec 21, 2022
1 parent 83766f1 commit 820f457
Show file tree
Hide file tree
Showing 431 changed files with 85,614 additions and 163 deletions.
108 changes: 85 additions & 23 deletions .github/workflows/ci-maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
- main
pull_request:
name: ci-maven
env:
SHOWCASE_VERSION: 0.25.0
jobs:
units:
runs-on: ubuntu-latest
strategy:
matrix:
java: [11, 17]
java: [ 11, 17 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
Expand Down Expand Up @@ -67,28 +69,28 @@ jobs:
name: "units (8) for gapic-generator-java"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: maven
- name: Install modules outside gapic-generator-java
shell: bash
run: |
mvn -B -ntp install --projects '!gapic-generator-java' \
-Dcheckstyle.skip -Dfmt.skip -DskipTests
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
cache: maven
- run: java -version
- name: Run test only for gapic-generator-java using Java 8
shell: bash
run: |
mvn -B -ntp verify --projects 'gapic-generator-java' \
-Dcheckstyle.skip -Dfmt.skip
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: maven
- name: Install modules outside gapic-generator-java
shell: bash
run: |
mvn -B -ntp install --projects '!gapic-generator-java' \
-Dcheckstyle.skip -Dfmt.skip -DskipTests
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
cache: maven
- run: java -version
- name: Run test only for gapic-generator-java using Java 8
shell: bash
run: |
mvn -B -ntp verify --projects 'gapic-generator-java' \
-Dcheckstyle.skip -Dfmt.skip
lint:
runs-on: ubuntu-latest
Expand All @@ -103,3 +105,63 @@ jobs:
- name: Java Linter
# Exclude the root project
run: mvn -B -ntp --projects '!.' fmt:check

showcase:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 17 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version

- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}
- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the CACHE_VERSION secret in"
echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions"
echo "(use any random string, any GUID will work)"
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."
- name: Install maven modules
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl unzip
- 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${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz --output /usr/src/showcase/showcase-${SHOWCASE_VERSION}-linux-amd64.tar.gz
cd /usr/src/showcase/
tar -xf showcase-*
./gapic-showcase run &
cd -
- name: Showcase integration tests
working-directory: showcase
run: |
mvn verify \
-P enable-golden-tests \
-P enable-integration-tests \
--batch-mode \
--no-transfer-progress
92 changes: 46 additions & 46 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,54 +58,54 @@ jobs:
matrix:
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version
- run: bazelisk version
- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: temurin
- run: java -version
- run: bazelisk version
- name: Bazel File Cache Setup
id: cache-bazel
uses: actions/cache@v3
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}

- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the CACHE_VERSION secret in"
echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions"
echo "(use any random string, any GUID will work)"
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."
- name: Bazel Cache Not Found
if: steps.cache-bazel.outputs.cache-hit != 'true'
run: |
echo "No cache found."
- name: Bazel Cache Found
if: steps.cache-bazel.outputs.cache-hit == 'true'
run: |
echo -n "Cache found. Cache size: "
du -sh ~/.cache/bazel
echo "If the cache seems broken, update the CACHE_VERSION secret in"
echo "https://github.com/googleapis/googleapis-discovery/settings/secrets/actions"
echo "(use any random string, any GUID will work)"
echo "and it will start over with a clean cache."
echo "The old one will disappear after 7 days."
- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Storage Client Library
run: |
echo "Building Storage lib from generated source..."
mkdir /tmp/java-storage
bazelisk --batch build @com_google_googleapis//google/storage/v2:google-cloud-storage-v2-java
tar zxvf bazel-bin/external/com_google_googleapis/google/storage/v2/google-cloud-storage-v2-java.tar.gz -C /tmp/java-storage
pushd /tmp/java-storage/google-cloud-storage-v2-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
- name: Gradle Build Generated Compute Client Library
run: |
echo "Building Compute lib from generated source..."
mkdir /tmp/java-compute
bazelisk --batch build @com_google_googleapis//google/cloud/compute/v1small:google-cloud-compute-small-v1-java
tar zxvf bazel-bin/external/com_google_googleapis/google/cloud/compute/v1small/google-cloud-compute-small-v1-java.tar.gz -C /tmp/java-compute
pushd /tmp/java-compute/google-cloud-compute-small-v1-java
./gradlew clean build publishToMavenLocal sourcesJar allJars
popd
license-header:
runs-on: ubuntu-latest
Expand All @@ -117,5 +117,5 @@ jobs:
- name: License Header Check
run: |
go install github.com/google/addlicense@latest
addlicense -c "Google LLC" -l apache -check $(find $PWD -type f -name '*.java' ! -iname '*PlaceholderFile.java')
addlicense -c "Google LLC" -l apache -check $(find $PWD -type f -name '*.java' ! -path '**/showcase/**' ! -iname '*PlaceholderFile.java')
Loading

0 comments on commit 820f457

Please sign in to comment.