-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[setup] Workflow Setup for Unit Testing (#7)
* [setup] Separate properties for unit tests defined * Create build.yml * Create unitTests.yml * Modified unitTests.yml * Merged workflows for build and tests * Cached gradle dependencies * Seggregated workflows * Fixed unitTest workflow * Configured trigger events for workflows
- Loading branch information
1 parent
f64b495
commit d3ca392
Showing
5 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Spring Boot Build | ||
|
||
on: | ||
pull_request: | ||
branch_protection_rule: | ||
branches: [ dev, main ] | ||
workflow_call: | ||
workflow_dispatch: # Manually run the workflow | ||
|
||
jobs: | ||
gradle-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 20.0.1 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 20.0.1 | ||
|
||
- name: Cache Gradle dependencies | ||
id: gradle-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
gradle-${{ runner.os }}- | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build --stacktrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Spring Boot Unit Tests | ||
|
||
on: | ||
pull_request: | ||
branch_protection_rule: | ||
branches: [ dev, main ] | ||
workflow_dispatch: # Manually run the workflow | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 20.0.1 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 20.0.1 | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Restore Gradle build caches | ||
id: gradle-cache-restore | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
gradle-${{ runner.os }}- | ||
- name: Run Tests | ||
id: run-tests | ||
run: ./gradlew test --stacktrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/test/java/spring/practice/zentarea/ZenTareaApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
spring.datasource.url=jdbc:h2:mem:test;MODE=MySQL; | ||
spring.datasource.driver-class-name=org.h2.Driver | ||
spring.datasource.username= | ||
spring.datasource.password= | ||
# We add the MySQL Dialect so that it understands and generates the query based on MySQL | ||
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect | ||
spring.h2.console.enabled=true | ||
spring.jpa.defer-datasource-initialization=true | ||
spring.jpa.hibernate.ddl-auto=update | ||
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl | ||
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl | ||
spring.jpa.properties.hibernate.format_sql=true | ||
spring.sql.init.mode=always |