Skip to content

Commit

Permalink
chore: set up fully working Maven pom.xml (#937)
Browse files Browse the repository at this point in the history
* chore: set up fully working pom.xml
* chore: update DEVELOPMENT.md
  • Loading branch information
chanseokoh authored Feb 18, 2022
1 parent 55cc23e commit 3e53671
Show file tree
Hide file tree
Showing 4 changed files with 393 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci-maven.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
branches:
- main
pull_request:
name: ci-maven
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- run: java -version

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Unit Tests
run: |
mvn verify --batch-mode --no-transfer-progress
- name: Java Linter
run: mvn fmt:check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Bazel.
bazel-*
.gradle/
target/

# IDE
.idea
Expand Down
32 changes: 30 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,20 @@
```sh
bazel run //:google_java_format_verification
```
or
```sh
mvn fmt:check
```

- Format files.

```sh
bazel run //:google_java_format
```
or
```sh
mvn fmt:format
```

## Test Running

Expand All @@ -112,18 +120,38 @@
```sh
bazel test //:units
```
or
```sh
mvn test
```

- Run a single unit test like `JavaCodeGeneratorTest.java`
- Run a single unit test like `JavaCodeGeneratorTest.java`:

```sh
bazel test //:unit_com_google_api_generator_engine_JavaCodeGeneratorTest
```
or
```sh
mvn test -Dtest=JavaCodeGeneratorTest
mvn test "-Dtest=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyTest.class#one.*|two.*], %regex[#fast.*|slow.*]"
```
- Update all unit test golden files:

- Update unit test golden files, for example `JavaCodeGeneratorTest.java`:
```sh
mvn test -DupdateUnitGoldens
```

- Update a single unit test golden file, for example `JavaCodeGeneratorTest.java`:

```sh
bazel run //:update_com_google_api_generator_engine_JavaCodeGeneratorTest
```
or
```sh
mvn test -DupdateUnitGoldens -Dtest=JavaCodeGeneratorTest
```

- Run a single integration test for API like `Redis`, it generates Java source
code using the Java microgenerator and compares them with the goldens files
Expand Down
Loading

0 comments on commit 3e53671

Please sign in to comment.