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

Commit

Permalink
chore: Release with maven (#1894)
Browse files Browse the repository at this point in the history
* chore: Release with maven

* chore: Update configs

* chore: Remove maven_build.sh file

* chore: Prepare maven release

* chore: Clean up build file
  • Loading branch information
lqiu96 committed Nov 30, 2022
1 parent 735468e commit 7cd7e13
Show file tree
Hide file tree
Showing 22 changed files with 113 additions and 525 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,9 @@ jobs:
distribution: temurin
java-version: 11
- run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV
- run: .kokoro/maven-build.sh
- run: .kokoro/build.sh
env:
JOB_TYPE: clirr
maven-units:
name: "maven unit tests"
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
- 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
units-java11:
name: "units (11)"
runs-on: ubuntu-latest
Expand Down
40 changes: 19 additions & 21 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2018 Google Inc.
# Copyright 2018 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 Down Expand Up @@ -34,29 +34,27 @@ if [ ! -z "${JAVA11_HOME}" ]; then
setJava "${JAVA11_HOME}"
fi

echo "Compiling using Java:"
java -version
echo
./gradlew compileJava compileTestJava javadoc
mvn -V -B -ntp clean install -DskipTests

# We ensure the generated class files are compatible with Java 8
if [ ! -z "${JAVA8_HOME}" ]; then
setJava "${JAVA8_HOME}"
fi

echo "Running tests using Java:"
java -version

if [ "${GITHUB_JOB}" == "units-java8" ]; then
java -version 2>&1 | grep -q 'openjdk version "1.8.'
MATCH=$? # 0 if the output has the match
if [ "$MATCH" != "0" ]; then
echo "Please specify JDK 8 for Java 8 tests"
exit 1
fi
fi

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

case "${JOB_TYPE}" in
test)
# run tests in Java 8 with the source compiled in Java 11
mvn -V -B -ntp surefire:test
RETURN_CODE=$?
;;
clirr)
mvn -B -ntp clirr:check
RETURN_CODE=$?
;;
*) ;;
esac

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

This file was deleted.

13 changes: 1 addition & 12 deletions .kokoro/release/common.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2019 Google Inc.
# Copyright 2019 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 Down Expand Up @@ -28,17 +28,6 @@ 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>
Expand Down
5 changes: 0 additions & 5 deletions .kokoro/release/drop.cfg

This file was deleted.

19 changes: 0 additions & 19 deletions .kokoro/release/drop.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .kokoro/release/promote.cfg

This file was deleted.

31 changes: 0 additions & 31 deletions .kokoro/release/promote.sh

This file was deleted.

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.

1 change: 0 additions & 1 deletion .kokoro/release/publish_javadoc11.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Format: //devtools/kokoro/config/proto/build.proto

# cloud-rad production
env_vars: {
key: "STAGING_BUCKET_V2"
value: "docs-staging-v2"
Expand Down
31 changes: 24 additions & 7 deletions .kokoro/release/publish_javadoc11.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
# Copyright 2019 Google Inc.
#
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down Expand Up @@ -33,16 +32,34 @@ python3 -m pip install --require-hashes -r .kokoro/requirements.txt
NAME=gax
VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3)

mvn -B -ntp \
-DtrimStackTrace=false \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-DskipTests=true \
-Djacoco.skip=true \
install

# build the docs
./gradlew javadocCombinedV3
mvn -B -ntp \
-P docFX \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
javadoc:aggregate

# copy README to docfx-yml dir and rename index.md
cp README.md tmp_docs/docfx-yml/index.md
cp README.md target/docfx-yml/index.md

# copy CHANGELOG to docfx-yml dir and rename history.md
cp CHANGELOG.md tmp_docs/docfx-yml/history.md
cp CHANGELOG.md target/docfx-yml/history.md

pushd tmp_docs/docfx-yml/
pushd target/docfx-yml/

# create metadata
python3 -m docuploader create-metadata \
Expand All @@ -56,4 +73,4 @@ python3 -m docuploader upload . \
--staging-bucket ${STAGING_BUCKET_V2} \
--destination-prefix docfx

popd
popd
Loading

0 comments on commit 7cd7e13

Please sign in to comment.