Skip to content

Commit bec0a0d

Browse files
authored
Merge pull request #8 from leiberbertel/chore/pipe-unit-testing
Configure initial pipeline file to run unit tests and generate reports, correct dotenv version, update gitignore, fix db connection
2 parents 9c0dfcf + f29bad8 commit bec0a0d

5 files changed

Lines changed: 291 additions & 51 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Java Test
2+
3+
on:
4+
push:
5+
branches: [ "main", "development" ]
6+
7+
pull_request:
8+
branches: [ "main", "development" ]
9+
10+
jobs:
11+
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
cache: gradle
24+
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Build and test with Gradle
29+
run: ./gradlew clean test
30+
31+
- name: Publish Unit Test Results
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: test-results
35+
path: build/test-results/test

.gitignore

Lines changed: 247 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,251 @@
1-
HELP.md
1+
# Created by https://www.toptal.com/developers/gitignore/api/gradle,java,intellij,jetbrains
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=gradle,java,intellij,jetbrains
3+
4+
### Intellij ###
5+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
6+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
7+
8+
# User-specific stuff
9+
.idea/**/workspace.xml
10+
.idea/**/tasks.xml
11+
.idea/**/usage.statistics.xml
12+
.idea/**/dictionaries
13+
.idea/**/shelf
14+
15+
# AWS User-specific
16+
.idea/**/aws.xml
17+
18+
# Generated files
19+
.idea/**/contentModel.xml
20+
21+
# Sensitive or high-churn files
22+
.idea/**/dataSources/
23+
.idea/**/dataSources.ids
24+
.idea/**/dataSources.local.xml
25+
.idea/**/sqlDataSources.xml
26+
.idea/**/dynamic.xml
27+
.idea/**/uiDesigner.xml
28+
.idea/**/dbnavigator.xml
29+
30+
# Gradle
31+
.idea/**/gradle.xml
32+
.idea/**/libraries
33+
34+
# Gradle and Maven with auto-import
35+
# When using Gradle or Maven with auto-import, you should exclude module files,
36+
# since they will be recreated, and may cause churn. Uncomment if using
37+
# auto-import.
38+
# .idea/artifacts
39+
# .idea/compiler.xml
40+
# .idea/jarRepositories.xml
41+
# .idea/modules.xml
42+
# .idea/*.iml
43+
# .idea/modules
44+
# *.iml
45+
# *.ipr
46+
47+
# CMake
48+
cmake-build-*/
49+
50+
# Mongo Explorer plugin
51+
.idea/**/mongoSettings.xml
52+
53+
# File-based project format
54+
*.iws
55+
56+
# IntelliJ
57+
out/
58+
59+
# mpeltonen/sbt-idea plugin
60+
.idea_modules/
61+
62+
# JIRA plugin
63+
atlassian-ide-plugin.xml
64+
65+
# Cursive Clojure plugin
66+
.idea/replstate.xml
67+
68+
# SonarLint plugin
69+
.idea/sonarlint/
70+
71+
# Crashlytics plugin (for Android Studio and IntelliJ)
72+
com_crashlytics_export_strings.xml
73+
crashlytics.properties
74+
crashlytics-build.properties
75+
fabric.properties
76+
77+
# Editor-based Rest Client
78+
.idea/httpRequests
79+
80+
# Android studio 3.1+ serialized cache file
81+
.idea/caches/build_file_checksums.ser
82+
83+
### Intellij Patch ###
84+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
85+
86+
# *.iml
87+
# modules.xml
88+
# .idea/misc.xml
89+
# *.ipr
90+
91+
# Sonarlint plugin
92+
# https://plugins.jetbrains.com/plugin/7973-sonarlint
93+
.idea/**/sonarlint/
94+
95+
# SonarQube Plugin
96+
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
97+
.idea/**/sonarIssues.xml
98+
99+
# Markdown Navigator plugin
100+
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
101+
.idea/**/markdown-navigator.xml
102+
.idea/**/markdown-navigator-enh.xml
103+
.idea/**/markdown-navigator/
104+
105+
# Cache file creation bug
106+
# See https://youtrack.jetbrains.com/issue/JBR-2257
107+
.idea/$CACHE_FILE$
108+
109+
# CodeStream plugin
110+
# https://plugins.jetbrains.com/plugin/12206-codestream
111+
.idea/codestream.xml
112+
113+
# Azure Toolkit for IntelliJ plugin
114+
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
115+
.idea/**/azureSettings.xml
116+
117+
### Java ###
118+
# Compiled class file
119+
*.class
120+
121+
# Log file
122+
*.log
123+
124+
# BlueJ files
125+
*.ctxt
126+
127+
# Mobile Tools for Java (J2ME)
128+
.mtj.tmp/
129+
130+
# Package Files #
131+
*.jar
132+
*.war
133+
*.nar
134+
*.ear
135+
*.zip
136+
*.tar.gz
137+
*.rar
138+
139+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
140+
hs_err_pid*
141+
replay_pid*
142+
143+
### JetBrains ###
144+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
145+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
146+
147+
# User-specific stuff
148+
149+
# AWS User-specific
150+
151+
# Generated files
152+
153+
# Sensitive or high-churn files
154+
155+
# Gradle
156+
157+
# Gradle and Maven with auto-import
158+
# When using Gradle or Maven with auto-import, you should exclude module files,
159+
# since they will be recreated, and may cause churn. Uncomment if using
160+
# auto-import.
161+
# .idea/artifacts
162+
# .idea/compiler.xml
163+
# .idea/jarRepositories.xml
164+
# .idea/modules.xml
165+
# .idea/*.iml
166+
# .idea/modules
167+
# *.iml
168+
# *.ipr
169+
170+
# CMake
171+
172+
# Mongo Explorer plugin
173+
174+
# File-based project format
175+
176+
# IntelliJ
177+
178+
# mpeltonen/sbt-idea plugin
179+
180+
# JIRA plugin
181+
182+
# Cursive Clojure plugin
183+
184+
# SonarLint plugin
185+
186+
# Crashlytics plugin (for Android Studio and IntelliJ)
187+
188+
# Editor-based Rest Client
189+
190+
# Android studio 3.1+ serialized cache file
191+
192+
### JetBrains Patch ###
193+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
194+
195+
# *.iml
196+
# modules.xml
197+
# .idea/misc.xml
198+
# *.ipr
199+
200+
# Sonarlint plugin
201+
# https://plugins.jetbrains.com/plugin/7973-sonarlint
202+
203+
# SonarQube Plugin
204+
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
205+
206+
# Markdown Navigator plugin
207+
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
208+
209+
# Cache file creation bug
210+
# See https://youtrack.jetbrains.com/issue/JBR-2257
211+
212+
# CodeStream plugin
213+
# https://plugins.jetbrains.com/plugin/12206-codestream
214+
215+
# Azure Toolkit for IntelliJ plugin
216+
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
217+
218+
### Gradle ###
2219
.gradle
3-
build/
4-
!gradle/wrapper/gradle-wrapper.jar
5-
!**/src/main/**/build/
6-
!**/src/test/**/build/
220+
**/build/
221+
!src/**/build/
7222

8-
### STS ###
9-
.apt_generated
10-
.classpath
11-
.factorypath
223+
# Ignore Gradle GUI config
224+
gradle-app.setting
225+
226+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
227+
!gradle-wrapper.jar
228+
229+
# Avoid ignore Gradle wrappper properties
230+
!gradle-wrapper.properties
231+
232+
# Cache of project
233+
.gradletasknamecache
234+
235+
# Eclipse Gradle plugin generated files
236+
# Eclipse Core
12237
.project
13-
.settings
14-
.springBeans
15-
.sts4-cache
16-
bin/
17-
!**/src/main/**/bin/
18-
!**/src/test/**/bin/
19-
20-
### IntelliJ IDEA ###
238+
# JDT-specific (Eclipse Java Development Tools)
239+
.classpath
240+
241+
### Gradle Patch ###
242+
# Java heap dump
243+
*.hprof
244+
245+
# env
246+
.env
247+
248+
# idea
21249
.idea
22-
*.iws
23-
*.iml
24-
*.ipr
25-
out/
26-
!**/src/main/**/out/
27-
!**/src/test/**/out/
28-
29-
### NetBeans ###
30-
/nbproject/private/
31-
/nbbuild/
32-
/dist/
33-
/nbdist/
34-
/.nb-gradle/
35-
36-
### VS Code ###
37-
.vscode/
250+
251+
# End of https://www.toptal.com/developers/gitignore/api/gradle,java,intellij,jetbrains

build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ dependencies {
2828
implementation 'com.auth0:java-jwt:4.3.0'
2929
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0'
3030
implementation 'org.springframework.boot:spring-boot-starter-actuator'
31-
32-
// https://mvnrepository.com/artifact/io.github.cdimascio/java-dotenv
33-
implementation group: 'io.github.cdimascio', name: 'java-dotenv', version: '5.2.2'
31+
32+
implementation 'me.paulschwarz:spring-dotenv:3.0.0'
3433

3534
testImplementation 'org.springframework.boot:spring-boot-starter-test'
3635

@@ -44,6 +43,10 @@ dependencies {
4443
testImplementation 'org.mockito:mockito-junit-jupiter:4.0.0'
4544
}
4645

47-
tasks.named('test') {
46+
test {
4847
useJUnitPlatform()
49-
}
48+
49+
testLogging {
50+
events "passed", "skipped", "failed"
51+
}
52+
}

src/main/resources/application.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
12
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
23
spring.datasource.url=jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?createDatabaseIfNotExist=true
34
spring.datasource.username=${DB_USER}

src/test/java/com/leiber/pizza/LeiberPizzeriaApplicationTests.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)