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

test: add test for maven-javadoc-plugin version #662

Merged
merged 6 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ branchProtectionRules:
- "build (8, java-bigquery, test)"
- "build (8, java-bigquery, lint)"
- "build (8, java-bigquery, clirr)"
- "build (8, java-bigtable, javadoc)"
- "build (11, java-bigquery, test)"
- "build (11, java-bigquery, lint)"
- "build (11, java-bigquery, clirr)"
- "build (11, java-bigtable, javadoc)"
- "cla/google"
- pattern: java7
# Can admins overwrite branch protection.
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/downstream-maven-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ jobs:
java: [8, 11]
repo:
- java-bigquery
- java-bigtable
job-type:
- test # maven-surefire-plugin
- lint # fmt-maven-plugin and google-java-format
- clirr # clirr-maven-plugin
- javadoc # maven-javadoc-plugin
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-java@v3
Expand All @@ -31,3 +33,20 @@ jobs:
- run: sudo apt-get update -y
- run: sudo apt-get install libxml2-utils
- run: .kokoro/client-library-check.sh ${{matrix.repo}} ${{matrix.job-type}}
javadoc-with-doclet:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
repo:
- java-bigtable
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- run: java -version
- run: sudo apt-get update -y
- run: sudo apt-get install libxml2-utils
- run: .kokoro/javadoc-generation-with-doclet.sh ${{matrix.repo}}
Copy link
Member

Choose a reason for hiding this comment

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

Can you rename the script to client-library-check-javadoc-with-doclet.sh? I want the name to tell it's similar to client-library-check.sh.

62 changes: 62 additions & 0 deletions .kokoro/javadoc-generation-with-doclet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

set -eo pipefail
REPO=$1
set -x

# Make artifacts available for 'mvn validate' at the bottom
mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V -q

# Read the current version of this BOM in the POM. Example version: '0.116.1-alpha-SNAPSHOT'
VERSION_POM=pom.xml
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath
VERSION=`sed -e 's/xmlns=".*"//' ${VERSION_POM} | xmllint --xpath '/project/version/text()' -`

if [ -z "${VERSION}" ]; then
echo "Version is not found in ${VERSION_POM}"
exit 1
fi
echo "Version: ${VERSION}"

# Get version of doclet used to generate Cloud RAD
git clone https://github.com/googleapis/java-docfx-doclet.git
cd java-docfx-doclet/third_party/docfx-doclet-143274
git checkout 1.9.0
mvn package -Dmaven.test.skip=true

# work from the root directory
cd ../../../
docletPath=$(realpath "java-docfx-doclet/third_party/docfx-doclet-143274/target/docfx-doclet-1.0-SNAPSHOT-jar-with-dependencies.jar")
echo "This is the doclet path: ${docletPath}"

# Test with java-bigtable
git clone "https://github.com/googleapis/${REPO}.git" --depth=1
pushd ${REPO}

# replace version
xmllint --shell <(cat pom.xml) << EOF
setns x=http://maven.apache.org/POM/4.0.0
cd .//x:artifactId[text()="google-cloud-shared-config"]
cd ../x:version
set ${VERSION}
save pom.xml
EOF

mvn clean -B -ntp \
-P docFX \
-DdocletPath="${docletPath}" \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
javadoc:aggregate

# go back to the root directory
cd ..
# clean up clones
echo "Removing java-docfx-doclet clone"
rm -rf java-docfx-doclet
echo "Removing java-bigtable clone"
rm -rf ${REPO}
Loading