| on: |
| push: |
| branches: |
| - main |
| pull_request: |
| name: ci |
| env: |
| SHOWCASE_VERSION: 0.26.0 |
| jobs: |
| build: |
| runs-on: ubuntu-22.04 |
| strategy: |
| matrix: |
| java: [ 11, 17 ] |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: temurin |
| cache: maven |
| - run: java -version |
| - name: Unit Tests |
| run: | |
| mvn test --batch-mode --no-transfer-progress -Dcheckstyle.skip \ |
| -Dfmt.skip -DenableTestCoverage |
| - run: bazelisk version |
| - name: Install maven modules |
| run: | |
| mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip |
| - name: Integration Tests |
| run: | |
| bazelisk --batch test //test/integration/... |
| - 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 |
| |
| build-java8-except-gapic-generator-java: |
| name: "build(8) except for gapic-generator-java" |
| runs-on: ubuntu-22.04 |
| steps: |
| - uses: actions/checkout@v3 |
| # Java 8 tests uses JDK 11 to compile and JDK 8 to run tests. |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: 8 |
| distribution: temurin |
| cache: maven |
| - run: echo "JAVA8_HOME=${JAVA_HOME}" >> $GITHUB_ENV |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: 11 |
| distribution: temurin |
| - run: echo "JAVA11_HOME=${JAVA_HOME}" >> $GITHUB_ENV |
| - name: Compile with Java 11 |
| shell: bash |
| run: | |
| set -x |
| export JAVA_HOME=$JAVA11_HOME |
| export PATH=${JAVA_HOME}/bin:$PATH |
| # Why not compile? It's because the process needs to package jar so |
| # that gapic-generator-java module can use testlib modules of gax. |
| mvn verify --batch-mode --no-transfer-progress -Dcheckstyle.skip \ |
| -DskipTests -Dfmt.skip |
| - name: Run test with Java 8 for all modules except gapic-generator-java |
| shell: bash |
| run: | |
| set -x |
| export JAVA_HOME=$JAVA8_HOME |
| export PATH=${JAVA_HOME}/bin:$PATH |
| # useIncrementalCompilation=false to avoid recompiling classes |
| # generated by Java 11 compiler above. |
| mvn -B -ntp test --projects '!gapic-generator-java' \ |
| -Dcheckstyle.skip -Dmaven.compiler.useIncrementalCompilation=false \ |
| -Dfmt.skip |
| |
| build-java8-gapic-generator-java: |
| name: "build(8) for gapic-generator-java" |
| runs-on: ubuntu-22.04 |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: 11 |
| distribution: temurin |
| cache: maven |
| - name: Install all modules using Java 11 |
| shell: bash |
| run: | |
| mvn -V -B -ntp clean install -DskipTests |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: 8 |
| distribution: temurin |
| - run: java -version |
| - name: Run tests in Java 8 with the source compiled in Java 11 for gapic-generator-java |
| shell: bash |
| run: | |
| mvn -V -B -ntp surefire:test --projects 'gapic-generator-java' |
| - run: bazelisk version |
| - name: Integration Tests |
| run: | |
| bazelisk --batch test //test/integration/... |
| - 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 |
| |
| lint: |
| runs-on: ubuntu-22.04 |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: 11 |
| distribution: temurin |
| cache: maven |
| - run: java -version |
| - name: Java Linter |
| # Exclude the root project |
| run: mvn -B -ntp fmt:check |
| |
| compatibility: |
| runs-on: ubuntu-22.04 |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: 11 |
| distribution: temurin |
| cache: maven |
| - run: java -version |
| - name: Compatibility check |
| # package jar so that gapic-generator-java module can use |
| # testlib modules of gax |
| run: mvn package clirr:check -DskipTests |
| |
| showcase: |
| runs-on: ubuntu-22.04 |
| strategy: |
| matrix: |
| java: [ 11, 17 ] |
| steps: |
| - uses: actions/checkout@v3 |
| - uses: actions/setup-java@v3 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: temurin |
| - run: mvn -version |
| - name: Install maven modules |
| run: | |
| mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip |
| - name: Java Linter |
| working-directory: showcase |
| run: | |
| mvn -B -ntp fmt:check |
| - name: Showcase golden tests |
| working-directory: showcase |
| run: | |
| mvn test \ |
| -P enable-golden-tests \ |
| --batch-mode \ |
| --no-transfer-progress |
| |
| - 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-integration-tests \ |
| --batch-mode \ |
| --no-transfer-progress |