Skip to content

Commit

Permalink
ci(showcase): add showcase IT coverage (#1100)
Browse files Browse the repository at this point in the history
* ci(showcase): add showcase IT coverage

* ci(showcase): rework showcase coverage for combined report

* chore(deps): update dependency gradle to v7.6 (#1101)

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [gradle](https://gradle.org) ([source](https://github.com/gradle/gradle)) | minor | `7.5.1` -> `7.6` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/gapic-generator-java).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4zNC4xIiwidXBkYXRlZEluVmVyIjoiMzQuMzQuMSJ9-->

* ci(showcase): debug showcase integration coverage report in sonar

* ci(showcase): remove duplicate bazel coverage stage

* ci(showcase): invoke sonar after integration tests

* ci(showcase): debug with maven and sonar

* ci(showcase): attempt sonar workaround for lcov coverage parsing

* chore(showcase): create maven showcase module

* chore: relocate gapic-generator-java pom.xml to subfolder

* fix: ensure all tests work with new project structure

* fix: set surefire working directory, and revert source adjustments

* fix: formatter

* chore: relocate gapic-generator-java pom.xml to subfolder (#1105)

* chore: relocate gapic-generator-java pom.xml to subfolder

* fix: ensure all tests work with new project structure

* fix: set surefire working directory, and revert source adjustments

* fix: formatter

* chore: update showcase maven module to generate and verify golden source

* chore: update showcase maven module to generate and verify golden source

* chore: add showcase golden source to maven submodule

* chore: upload two coverage reports to sonar

* chore: show proto folder contents during verify_proto

* fix: only diff proto src/main/java, ignoring src/main/proto

* chore(main): release 2.11.0 (#1081)

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>

* chore: change showcase version to 0.0.1-SNAPSHOT

* chore: add mvn -version to sonar workflow

* fix: set showcase client to 0.0.1-SNAPSHOT

* fix: explicitly set shade plugin output directory

* chore: remove aggregator from build

* fix: coverage report locations

* fix: skip linting on generated showcase files

* fix: sonar coverage for non-standard directory structure (#1108)

* fix: exclude generated showcase from license header check

* fix: single-line 'find' syntax

* fix: use provided ignore flag

* ci(showcase): rework github actions for showcase golden and integration tests

* ci(showcase): simplify sonar github actions workflow

* ci(showcase): remove showcase from /test/integration golden suite

* ci(showcase): simplify showcase invocation

* fix(showcase): ensure generated showcase protos are not deleted

* ci(showcase): update workflow and documentation for showcase

* ci(showcase): disable snippet-bot for generated showcase client

* ci(showcase): disable snippet-bot for showcase (#1113)

Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 8, 2022
1 parent 618346a commit 1b72f11
Show file tree
Hide file tree
Showing 457 changed files with 86,144 additions and 517 deletions.
1 change: 1 addition & 0 deletions .github/snippet-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ alwaysCreateStatusCheck: false
ignoreFiles:
- src/test/**
- test/**
- showcase/**
56 changes: 56 additions & 0 deletions .github/workflows/ci-maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ on:
branches:
- main
pull_request:

name: ci-maven

env:
SHOWCASE_VERSION: 0.25.0

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -32,3 +37,54 @@ jobs:
- name: Java Linter
run: mvn fmt:check

showcase:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 8, 11 ]
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 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 &
cd -
- name: Showcase integration tests
run: mvn verify -P showcase
64 changes: 2 additions & 62 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
go-version: '^1.13.1'
- 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')
go install github.com/google/addlicense@latest
addlicense -c "Google LLC" -l apache -ignore showcase/** -check $(find $PWD -type f -name '*.java' ! -iname '*PlaceholderFile.java')
build:
needs: license-header
runs-on: ubuntu-latest
Expand Down Expand Up @@ -107,62 +106,3 @@ jobs:
- name: Generate Code Coverage Report
# Run only test targets, and not golden_update targets.
run: bazel coverage //:units --combined_report=lcov

showcase:
# needs: build
runs-on: ubuntu-latest
# services:
# showcase-server:
# image: gcr.io/gapic-images/gapic-showcase:0.25.0
# ports:
# - "7469:7469"
strategy:
matrix:
java: [ 8, 11 ]
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 system dependencies.
run: |
sudo apt-get update
sudo apt-get install -y curl unzip
- name: Install showcase
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 Testing
run: bazel --batch test //test/showcase/...
16 changes: 15 additions & 1 deletion .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: SonarCloud Build

on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
build:
name: Build
Expand All @@ -13,25 +15,37 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
- run: java -version
- run: mvn -version

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=googleapis_gapic-generator-java -Dsonar.organization=googleapis -Dsonar.host.url=https://sonarcloud.io
run: |
mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-B \
-Dsonar.verbose=true \
-Dsonar.projectKey=googleapis_gapic-generator-java \
-Dsonar.organization=googleapis \
-Dsonar.host.url=https://sonarcloud.io
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
bazel-*
.gradle/
target/
.flattened-pom.xml

# IDE
.idea
.ijwb
*.iml

# Vim.
*.sw*
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [2.11.0](https://github.com/googleapis/gapic-generator-java/compare/v2.10.3...v2.11.0) (2022-11-30)


### Features

* **ast:** Array expressions ([#1080](https://github.com/googleapis/gapic-generator-java/issues/1080)) ([bd9532c](https://github.com/googleapis/gapic-generator-java/commit/bd9532c6663f2e8f9d9978cd0a3cffde821960ec))


### Bug Fixes

* **ast:** Add import generation for annotations on VariableExpr ([#1076](https://github.com/googleapis/gapic-generator-java/issues/1076)) ([f5d5524](https://github.com/googleapis/gapic-generator-java/commit/f5d5524e626f26ef53d4ae6c02118ef70ace205a))
* **deps:** Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.6 ([#1088](https://github.com/googleapis/gapic-generator-java/issues/1088)) ([0e75338](https://github.com/googleapis/gapic-generator-java/commit/0e75338dcb083c4cccd35d8682ba9cbe4e314ef8))
* Support testing nested argument method signatures and 'double' field assertions ([#1094](https://github.com/googleapis/gapic-generator-java/issues/1094)) ([4bf419f](https://github.com/googleapis/gapic-generator-java/commit/4bf419f764e2ecfdac9caf03968f40a8cd564655))

## [2.10.3](https://github.com/googleapis/gapic-generator-java/compare/v2.10.2...v2.10.3) (2022-11-01)


Expand Down
21 changes: 19 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@
bazel run //test/integration:update_redis
```

### Golden Showcase Testing

- Regenerate the showcase client into the `./showcase` projects.

```shell
mvn compile -P update-showcase
# or, for backward compatibility with previous workflows:
mvn compile -D updateUnitGoldens
```

- Run a test to verify a newly generated showcase client is identical to the golden files
in `./showcase`.

```shell
mvn verify -P showcase-golden
```

## Showcase Integration Testing

[GAPIC Showcase](https://github.com/googleapis/gapic-showcase) is an API that demonstrates Generated
Expand Down Expand Up @@ -159,10 +176,10 @@ $ gapic-showcase run

### Running the Integration Tests

Open a new terminal window and run all tests in the `/test/showcase` directory.
Open a new terminal window in the root project directory.

```shell
$ bazel test //test/showcase/...
$ mvn verify -P showcase
```

## Running the Plugin
Expand Down
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ http_archive(
# Showcase
_showcase_commit = "90d73532a0cab753a85f45c158394f24fc21d91a"

_showcase_sha256 = "0f582541a379be0746e6b8bc5af3df511581d4b1f18f7dfb9ce203be1a64cef1"

http_archive(
name = "com_google_gapic_showcase",
sha256 = _showcase_sha256,
strip_prefix = "gapic-showcase-%s" % _showcase_commit,
urls = [
# "https://github.com/googleapis/gapic-showcase/archive/refs/tags/v%s.zip" % _showcase_version,
Expand Down
43 changes: 43 additions & 0 deletions coverage/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java-coverage-aggregate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Aggregate Coverage Report</name>

<dependencies>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gapic-generator-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>gapic-showcase</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 1b72f11

Please sign in to comment.