Skip to content

Commit 97be285

Browse files
authored
Merge pull request #4 from Aiven-Open/github-actions
Add GitHub Actions for CI
2 parents 77da73f + 000f844 commit 97be285

File tree

4 files changed

+51
-122
lines changed

4 files changed

+51
-122
lines changed

.github/workflows/prs_and_commits.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow to check pull requests and new commits to main branches
2+
# This checks the source in the state as if after the merge.
3+
name: Pull request checks
4+
on:
5+
pull_request:
6+
branches: [ master, storage-write-api, storage-write-api-cleanup ]
7+
push:
8+
branches: [ master, storage-write-api, storage-write-api-cleanup ]
9+
10+
# Disallow concurrent runs for the same PR by cancelling in-progress runs
11+
# when new commits are pushed
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
- name: Set up JDK 8
24+
uses: actions/setup-java@v4
25+
with:
26+
distribution: 'adopt'
27+
java-version: 8
28+
cache: maven
29+
- name: Build (Maven)
30+
run: mvn --batch-mode clean package -DskipTests
31+
- name: Unit tests (Maven)
32+
run: mvn --batch-mode test
33+
- name: Integration tests (Maven)
34+
env:
35+
# Necessary for client builder integration tests that run with
36+
# default application credentials
37+
CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS }}
38+
GOOGLE_APPLICATION_CREDENTIALS: /tmp/creds.json
39+
KCBQ_TEST_KEYFILE: /tmp/creds.json
40+
KCBQ_TEST_KEY_SOURCE: FILE
41+
KCBQ_TEST_PROJECT: ${{ secrets.KCBQ_TEST_PROJECT }}
42+
KCBQ_TEST_DATASET: ${{ secrets.KCBQ_TEST_DATASET }}
43+
KCBQ_TEST_BUCKET: ${{ secrets.KCBQ_TEST_BUCKET }}
44+
run: |
45+
echo "$CREDENTIALS_JSON" > /tmp/creds.json
46+
mvn -Dskip.unit.tests=true verify

kcbq-connector/pom.xml

-98
Original file line numberDiff line numberDiff line change
@@ -126,100 +126,6 @@
126126

127127
<build>
128128
<plugins>
129-
<plugin>
130-
<groupId>org.jacoco</groupId>
131-
<artifactId>jacoco-maven-plugin</artifactId>
132-
<executions>
133-
<execution>
134-
<id>prepare-agent</id>
135-
<goals>
136-
<goal>prepare-agent</goal>
137-
</goals>
138-
</execution>
139-
<execution>
140-
<id>prepare-agent-it</id>
141-
<goals>
142-
<goal>prepare-agent-integration</goal>
143-
</goals>
144-
<phase>pre-integration-test</phase>
145-
</execution>
146-
<execution>
147-
<id>merge-coverage-reports</id>
148-
<phase>verify</phase>
149-
<goals>
150-
<goal>merge</goal>
151-
</goals>
152-
<configuration>
153-
<fileSets>
154-
<fileSet>
155-
<directory>${project.basedir}</directory>
156-
<includes>
157-
<include>/target/jacoco.exec</include>
158-
<include>/target/jacoco-it.exec</include>
159-
</includes>
160-
</fileSet>
161-
</fileSets>
162-
<destFile>${project.basedir}/target/jacoco-aggregate.exec</destFile>
163-
</configuration>
164-
</execution>
165-
<execution>
166-
<id>check</id>
167-
<goals>
168-
<goal>check</goal>
169-
</goals>
170-
<configuration>
171-
<rules>
172-
<rule>
173-
<element>BUNDLE</element>
174-
<limits>
175-
<limit>
176-
<counter>INSTRUCTION</counter>
177-
<value>COVEREDRATIO</value>
178-
<minimum>0.60</minimum>
179-
</limit>
180-
<limit>
181-
<counter>BRANCH</counter>
182-
<value>COVEREDRATIO</value>
183-
<minimum>0.45</minimum>
184-
</limit>
185-
<limit>
186-
<counter>COMPLEXITY</counter>
187-
<value>COVEREDRATIO</value>
188-
<minimum>0.60</minimum>
189-
</limit>
190-
<limit>
191-
<counter>LINE</counter>
192-
<value>COVEREDRATIO</value>
193-
<minimum>0.60</minimum>
194-
</limit>
195-
<limit>
196-
<counter>METHOD</counter>
197-
<value>COVEREDRATIO</value>
198-
<minimum>0.60</minimum>
199-
</limit>
200-
<limit>
201-
<counter>CLASS</counter>
202-
<value>COVEREDRATIO</value>
203-
<minimum>0.80</minimum>
204-
</limit>
205-
</limits>
206-
</rule>
207-
</rules>
208-
<dataFile>${project.basedir}/target/jacoco-aggregate.exec</dataFile>
209-
</configuration>
210-
</execution>
211-
<execution>
212-
<id>report</id>
213-
<phase>test</phase>
214-
<goals>
215-
<goal>report</goal>
216-
</goals>
217-
<configuration>
218-
<dataFile>${project.basedir}/target/jacoco-aggregate.exec</dataFile>
219-
</configuration>
220-
</execution>
221-
</executions>
222-
</plugin>
223129
<plugin>
224130
<groupId>org.apache.maven.plugins</groupId>
225131
<artifactId>maven-compiler-plugin</artifactId>
@@ -232,10 +138,6 @@
232138
<groupId>org.apache.maven.plugins</groupId>
233139
<artifactId>maven-failsafe-plugin</artifactId>
234140
</plugin>
235-
<plugin>
236-
<groupId>org.jacoco</groupId>
237-
<artifactId>jacoco-maven-plugin</artifactId>
238-
</plugin>
239141
<plugin>
240142
<groupId>org.apache.maven.plugins</groupId>
241143
<artifactId>maven-checkstyle-plugin</artifactId>

kcbq-connector/src/test/java/com/wepay/kafka/connect/bigquery/integration/BaseConnectorIT.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,12 @@ private String readEnvVar(String var, String defaultVal) {
366366

367367
protected String keyFile() {
368368
if (GcpClientBuilder.KeySource.APPLICATION_DEFAULT.name().equalsIgnoreCase(keySource())) {
369-
// No key file necessary
370-
return "";
369+
// Key file is optional for most tests when using application default credentials
370+
return readEnvVar(KEYFILE_ENV_VAR, "");
371+
} else {
372+
// Key file is required
373+
return readEnvVar(KEYFILE_ENV_VAR);
371374
}
372-
return readEnvVar(KEYFILE_ENV_VAR);
373375
}
374376

375377
protected String project() {

pom.xml

-21
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
<checkstyle.plugin.version>3.3.1</checkstyle.plugin.version>
5353
<compiler.plugin.version>3.8.1</compiler.plugin.version>
5454
<google.cloud.bom.version>26.14.0</google.cloud.bom.version>
55-
<jacoco.plugin.version>0.8.5</jacoco.plugin.version>
5655
<kafka.connect.plugin.version>0.11.1</kafka.connect.plugin.version>
5756
<release.plugin.version>2.5.3</release.plugin.version>
5857
<site.plugin.version>3.7.1</site.plugin.version>
@@ -378,26 +377,6 @@ under the License.
378377
</execution>
379378
</executions>
380379
</plugin>
381-
<plugin>
382-
<groupId>org.jacoco</groupId>
383-
<artifactId>jacoco-maven-plugin</artifactId>
384-
<version>${jacoco.plugin.version}</version>
385-
<executions>
386-
<execution>
387-
<id>pre-unit-test</id>
388-
<goals>
389-
<goal>prepare-agent</goal>
390-
</goals>
391-
</execution>
392-
<execution>
393-
<id>report</id>
394-
<phase>verify</phase>
395-
<goals>
396-
<goal>report</goal>
397-
</goals>
398-
</execution>
399-
</executions>
400-
</plugin>
401380
<plugin>
402381
<groupId>org.apache.maven.plugins</groupId>
403382
<artifactId>maven-checkstyle-plugin</artifactId>

0 commit comments

Comments
 (0)