Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

chore: Maven Migration #1829

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
22 changes: 12 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ on:
pull_request:
name: ci
jobs:
maven-units:
name: "maven unit tests"
clirr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: zulu
- run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV
java-version: 11
- run: .kokoro/build.sh
env:
JOB_TYPE: clirr
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: zulu
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- run: printenv
- run: .kokoro/maven-build.sh
env:
JOB_TYPE: test
java-version: 11
- run: mvn com.coveo:fmt-maven-plugin:check -B -ntp
- run: mvn checkstyle:check@checkstyle -B -ntp
units-java11:
name: "units (11)"
runs-on: ubuntu-latest
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [opened, synchronize, reopened]
jobs:
build:
name: Java 11 Gradle Build
name: Java 11 Maven Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -23,14 +23,15 @@ jobs:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v3
- uses: actions/cache@v3
id: mvn-cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
path: ~/.m2/repository
key: ${{ runner.os }}-maven
- name: Maven Install
run: mvn clean install -DskipTests
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonarqube --info
run: mvn sonar:sonar -Dsonar.projectKey=googleapis_gax-java
22 changes: 17 additions & 5 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fi
echo "Compiling using Java:"
java -version
echo
./gradlew compileJava compileTestJava javadoc
mvn -V -B -ntp clean install

# We ensure the generated class files are compatible with Java 8
if [ ! -z "${JAVA8_HOME}" ]; then
Expand All @@ -56,7 +56,19 @@ if [ "${GITHUB_JOB}" == "units-java8" ]; then
fi
fi

echo
./gradlew build publishToMavenLocal \
--exclude-task compileJava --exclude-task compileTestJava \
--exclude-task javadoc
RETURN_CODE=0

case "${JOB_TYPE}" in
test)
mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true
RETURN_CODE=$?
;;
clirr)
mvn -B -ntp -Denforcer.skip=true clirr:check
RETURN_CODE=$?
;;
*) ;;
esac

echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}
61 changes: 0 additions & 61 deletions .kokoro/maven-build.sh

This file was deleted.

29 changes: 20 additions & 9 deletions .kokoro/release/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,24 @@ setup_environment_secrets() {
export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|')
}

create_gradle_properties_file() {
echo "
signing.gnupg.executable=gpg
signing.gnupg.homeDir=${GPG_HOMEDIR}
signing.gnupg.keyName=${GPG_KEY_ID}
signing.gnupg.passphrase=${GPG_PASSPHRASE}

ossrhUsername=${SONATYPE_USERNAME}
ossrhPassword=${SONATYPE_PASSWORD}" > $1
create_settings_xml_file() {
echo "<settings>
<servers>
<server>
<id>ossrh</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${SONATYPE_USERNAME}</username>
<password>${SONATYPE_PASSWORD}</password>
</server>
</servers>
</settings>" > $1
}
19 changes: 0 additions & 19 deletions .kokoro/release/publish_javadoc.cfg

This file was deleted.

52 changes: 0 additions & 52 deletions .kokoro/release/publish_javadoc.sh

This file was deleted.

5 changes: 5 additions & 0 deletions .kokoro/release/publish_javadoc11.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ env_vars: {
value: "github/gax-java/.kokoro/release/publish_javadoc11.sh"
}

env_vars: {
key: "DOCLET_VERSION"
value: "1.7.0"
}

before_action {
fetch_keystore {
keystore_resource {
Expand Down
43 changes: 29 additions & 14 deletions .kokoro/release/publish_javadoc11.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2019 Google Inc.
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,7 +20,7 @@ if [[ -z "${CREDENTIALS}" ]]; then
fi

if [[ -z "${STAGING_BUCKET_V2}" ]]; then
echo "Need to set STAGING_BUCKET environment variable"
echo "Need to set STAGING_BUCKET_V2 environment variable"
exit 1
fi

Expand All @@ -30,30 +30,45 @@ pushd $(dirname "$0")/../../
# install docuploader package
python3 -m pip install --require-hashes -r .kokoro/requirements.txt

NAME=gax
VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)
doclet_name="java-docfx-doclet-${DOCLET_VERSION}.jar"

# build the docs
./gradlew javadocCombinedV3
# compile all packages
mvn clean install -B -q -DskipTests=true

# copy README to docfx-yml dir and rename index.md
cp README.md tmp_docs/docfx-yml/index.md
export NAME=gax
export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)

# copy CHANGELOG to docfx-yml dir and rename history.md
cp CHANGELOG.md tmp_docs/docfx-yml/history.md
# cloud RAD generation
mvn clean -B -ntp \
-P docFX \
-DdocletPath=${KOKORO_GFILE_DIR}/${doclet_name} \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
javadoc:aggregate

pushd tmp_docs/docfx-yml/
# include CHANGELOG
cp CHANGELOG.md target/docfx-yml/history.md

pushd target/docfx-yml

# create metadata
python3 -m docuploader create-metadata \
--name ${NAME} \
--version ${VERSION} \
--xrefs devsite://java/gax \
--xrefs devsite://java/google-cloud-core \
--xrefs devsite://java/api-common \
--xrefs devsite://java/proto-google-common-protos \
--xrefs devsite://java/google-api-client \
--xrefs devsite://java/google-http-client \
--xrefs devsite://java/protobuf \
--language java

# upload docs
# upload yml to production bucket
python3 -m docuploader upload . \
--credentials ${CREDENTIALS} \
--staging-bucket ${STAGING_BUCKET_V2} \
--destination-prefix docfx

popd
Loading