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

Add GitHub Actions for CI #4

Merged
merged 1 commit into from
Mar 4, 2024
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/prs_and_commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Workflow to check pull requests and new commits to main branches
# This checks the source in the state as if after the merge.
name: Pull request checks
on:
pull_request:
branches: [ master, storage-write-api, storage-write-api-cleanup ]
push:
branches: [ master, storage-write-api, storage-write-api-cleanup ]

# Disallow concurrent runs for the same PR by cancelling in-progress runs
# when new commits are pushed
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 8
cache: maven
- name: Build (Maven)
run: mvn --batch-mode clean package -DskipTests
- name: Unit tests (Maven)
run: mvn --batch-mode test
- name: Integration tests (Maven)
env:
# Necessary for client builder integration tests that run with
# default application credentials
CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS }}
GOOGLE_APPLICATION_CREDENTIALS: /tmp/creds.json
KCBQ_TEST_KEYFILE: /tmp/creds.json
KCBQ_TEST_KEY_SOURCE: FILE
KCBQ_TEST_PROJECT: ${{ secrets.KCBQ_TEST_PROJECT }}
KCBQ_TEST_DATASET: ${{ secrets.KCBQ_TEST_DATASET }}
KCBQ_TEST_BUCKET: ${{ secrets.KCBQ_TEST_BUCKET }}
run: |
echo "$CREDENTIALS_JSON" > /tmp/creds.json
mvn -Dskip.unit.tests=true verify
98 changes: 0 additions & 98 deletions kcbq-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,100 +126,6 @@

<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>prepare-agent-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
<execution>
<id>merge-coverage-reports</id>
<phase>verify</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<includes>
<include>/target/jacoco.exec</include>
<include>/target/jacoco-it.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${project.basedir}/target/jacoco-aggregate.exec</destFile>
</configuration>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.45</minimum>
</limit>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
<limit>
<counter>CLASS</counter>
<value>COVEREDRATIO</value>
<minimum>0.80</minimum>
</limit>
</limits>
</rule>
</rules>
<dataFile>${project.basedir}/target/jacoco-aggregate.exec</dataFile>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.basedir}/target/jacoco-aggregate.exec</dataFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -232,10 +138,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,12 @@ private String readEnvVar(String var, String defaultVal) {

protected String keyFile() {
if (GcpClientBuilder.KeySource.APPLICATION_DEFAULT.name().equalsIgnoreCase(keySource())) {
// No key file necessary
return "";
// Key file is optional for most tests when using application default credentials
return readEnvVar(KEYFILE_ENV_VAR, "");
} else {
// Key file is required
return readEnvVar(KEYFILE_ENV_VAR);
}
return readEnvVar(KEYFILE_ENV_VAR);
}

protected String project() {
Expand Down
21 changes: 0 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<checkstyle.plugin.version>3.3.1</checkstyle.plugin.version>
<compiler.plugin.version>3.8.1</compiler.plugin.version>
<google.cloud.bom.version>26.14.0</google.cloud.bom.version>
<jacoco.plugin.version>0.8.5</jacoco.plugin.version>
<kafka.connect.plugin.version>0.11.1</kafka.connect.plugin.version>
<release.plugin.version>2.5.3</release.plugin.version>
<site.plugin.version>3.7.1</site.plugin.version>
Expand Down Expand Up @@ -378,26 +377,6 @@ under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand Down
Loading