Skip to content

Commit ae82e0f

Browse files
authored
gradle subproject
1 parent f7b868b commit ae82e0f

File tree

6 files changed

+28
-43
lines changed

6 files changed

+28
-43
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,26 @@ Provides GitHub Workflow and Action samples.
4545
- [python-unittest.yml](python-unittest.yml) [setup.cfg](setup.cfg)
4646

4747
<details><summary>Unittest Results</summary>
48-
48+
4949
![test-failed.png](./screenshots/test-failed.png?raw=true)
5050

5151
![test-failed-details.png](./screenshots/test-failed-details.png?raw=true)
5252

5353
</details>
5454

55+
## Plugins
56+
57+
| Plugin | Description |
58+
|-------------|--------------------------------|
59+
| [actions/setup-java@v3](https://github.com/actions/setup-java) | |
60+
| [actions/setup-python@v4](https://github.com/actions/setup-python) | |
61+
| [actions/cache@v3](https://github.com/actions/cache) | |
62+
| [actions/github-script@v6](https://github.com/actions/github-script) | |
63+
| [hashicorp/[email protected]](https://github.com/hashicorp/setup-terraform) | |
64+
| [jacobtomlinson/gha-find-replace@v2](https://github.com/jacobtomlinson/gha-find-replace) | Find and Replace Action |
65+
| [google-github-actions/auth@v1](https://github.com/google-github-actions/auth) | GitHub Action authenticates to Google Cloud |
66+
| [EnricoMi/publish-unit-test-result-action/composite@v2](https://github.com/EnricoMi/publish-unit-test-result-action) | Publish Test Results |
67+
5568
## Reference
5669

5770
- [GitHub Actions /Using workflows / Cache dependencies / Caching dependencies to speed up workflows](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches)

build-java.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v3
1515
- name: Set up JDK 11
16-
uses: actions/setup-java@v1
16+
uses: actions/setup-java@v3
1717
with:
1818
java-version: 11
1919
- name: Cache Gradle packages
@@ -32,7 +32,7 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v3
3434
- name: Set up JDK 11
35-
uses: actions/setup-java@v1
35+
uses: actions/setup-java@v3
3636
with:
3737
java-version: 11
3838
- name: Build and analyze

build.gradle

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
11
plugins {
2-
id 'org.springframework.boot' version '2.2.1.RELEASE'
3-
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
42
id 'java'
53
id 'base'
64
id "org.sonarqube" version "3.5.0.2730"
75
}
8-
sourceCompatibility = '1.8'
9-
archivesBaseName = 'app'
10-
11-
repositories {
12-
mavenCentral()
13-
}
14-
15-
dependencies {
16-
implementation 'org.springframework.boot:spring-boot-starter-web'
17-
testImplementation('org.springframework.boot:spring-boot-starter-test') {
18-
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
19-
}
20-
}
21-
22-
springBoot {
23-
mainClassName = 'com.sample.SampleApplication.java'
24-
}
25-
test {
26-
useJUnitPlatform()
27-
}
286

297
sonarqube {
308
properties {
@@ -34,7 +12,17 @@ sonarqube {
3412
// property "sonar.host.url", "http://127.0.0.1:9000"
3513
property "sonar.host.url", "https://sonarcloud.io"
3614
property "sonar.sourceEncoding", "UTF-8"
15+
property "sonar.sources", "."
16+
property "sonar.python.version", "3.9"
17+
property "sonar.inclusions", "**/*.yml"
18+
property "sonar.exclusions", "build/**, gha-creds-*.json, .*sa, java/**"
3719
// property "sonar.java.binaries", "build"
3820
property "sonar.links.ci", "https://github.com/DevSecOpsSamples/githubactions/actions"
3921
}
22+
}
23+
24+
clean.doFirst {
25+
delete "${rootDir}/.pytest_cache"
26+
delete fileTree(dir: './' , include: '**/.coverage')
27+
delete fileTree(dir: 'python' , include: '**/*.pyc')
4028
}

java/build.gradle

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ plugins {
33
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
44
id 'java'
55
id 'base'
6-
id "org.sonarqube" version "3.5.0.2730"
76
}
87
sourceCompatibility = '1.8'
98
archivesBaseName = 'app'
@@ -24,19 +23,4 @@ springBoot {
2423
}
2524
test {
2625
useJUnitPlatform()
27-
}
28-
29-
sonarqube {
30-
properties {
31-
property "sonar.projectName", "test-githubaction-java"
32-
// property "sonar.projectKey", "DevSecOpsSamples_test-githubaction-java"
33-
// property "sonar.organization", "devsecopssamples"
34-
property "sonar.projectKey", "engel80-todo_test-githubaction-java"
35-
property "sonar.organization", "engel80-todo"
36-
// property "sonar.host.url", "http://127.0.0.1:9000"
37-
property "sonar.host.url", "https://sonarcloud.io"
38-
property "sonar.sourceEncoding", "UTF-8"
39-
property "sonar.java.binaries", "build"
40-
property "sonar.links.ci", "https://github.com/DevSecOpsSamples/test-githubaction-java/actions"
41-
}
4226
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include 'java'

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ exclude = .terraform
77
log_cli=True
88
log_cli_level=DEBUG
99
; --html=report.html = pip install pytest-html
10-
addopts=--failed-first --cov=src/bucket-api --cov=src/pubsub-api --junit-xml=build/test-result.xml --html=build/test-report.html --cov-report=xml:build/test-coverage.xml
10+
addopts=--failed-first --cov=python --junit-xml=build/test-result.xml --html=build/test-report.html --cov-report=xml:build/test-coverage.xml
1111
junit_family=legacy
1212
; --cov-branch
1313
; norecursedirs=.pyenv-python
1414
env =
1515
D:GOOGLE_APPLICATION_CREDENTIALS=.sa
16-
D:GCS_BUCKET_NAME={PROJECT_ID}-bucket-api
1716
D:GOOGLE_CLOUD_PROJECT={PROJECT_ID}

0 commit comments

Comments
 (0)