Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(showcase): add showcase testing #1188

Merged
merged 20 commits into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
a2f481a
ci(showcase): add showcase testing
burkedavison Dec 21, 2022
662c2bf
ci(showcase): relocate showcase golden files from ./test to ./showcas…
burkedavison Dec 21, 2022
75d2580
ci(showcase): update DEVELOPMENT.md with showcase testing instructions
burkedavison Dec 21, 2022
a7152df
ci(showcase): ignore license header check for generated showcase client
burkedavison Dec 21, 2022
696978e
ci(showcase): single-line addlicense call
burkedavison Dec 21, 2022
fed245d
ci(showcase): change addlicense argument order
burkedavison Dec 21, 2022
ebe955e
ci(showcase): change addlicense argument order
burkedavison Dec 21, 2022
e83a5d4
ci(showcase): replace -ignore parameter with filtered 'find'
burkedavison Dec 21, 2022
416ef63
ci(showcase): fix working-directory in ./github/workflows/ci-maven.yaml
burkedavison Dec 21, 2022
ac3f335
ci(showcase): set SHOWCASE_VERSION env in github actions
burkedavison Dec 21, 2022
120bbc2
ci(showcase): correct path to showcase server download directory
burkedavison Dec 21, 2022
10d2e0d
Merge branch 'main' into showcase
burkedavison Dec 21, 2022
757cd2b
Merge branch 'main' into showcase
burkedavison Dec 21, 2022
6e3a921
ci(showcase): remove unused test dependencies and javadoc configurations
burkedavison Dec 21, 2022
65d388c
Merge remote-tracking branch 'origin/showcase' into showcase
burkedavison Dec 21, 2022
245ccf2
ci(showcase): use gapic-generator-java-pom-parent in showcase/pom.xml
burkedavison Dec 21, 2022
992062f
ci(showcase): use gapic-generator-java-bom as parent in showcase/pom.xml
burkedavison Dec 21, 2022
f71a477
ci(showcase): install maven modules before showcase testing
burkedavison Dec 21, 2022
cb7b939
ci(showcase): remove Java 8 build as it's not supported for gax
burkedavison Dec 21, 2022
82bd06a
ci(showcase): use bazelisk instead of bazel for showcase client gener…
burkedavison Dec 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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 &
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this run Bazel somewhere? If not, then Bazel cache above are not needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use bazelisk. You can save your time troubleshooting unexpected Bazel version upgrade in future.

#1163

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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