Skip to content

Commit

Permalink
Merge pull request #16 from Best-offer-finder/tests_workflow
Browse files Browse the repository at this point in the history
Add tests workflow
  • Loading branch information
Rivixer authored May 23, 2024
2 parents 17253c0 + 9ee1a25 commit 2c1665e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run tests

on:
workflow_run:
workflows: ["Build"]
types:
- completed

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Add Gradle wrapper permissions
run: chmod +x gradlew

- name: Run tests with Gradle
run: ./gradlew test
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ dependencies {
implementation 'mysql:mysql-connector-java:8.0.28'
implementation 'com.google.protobuf:protobuf-java:3.25.2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'com.h2database:h2'
}

tasks.named('test') {
useJUnitPlatform()
systemProperty 'spring.profiles.active', 'test'
}
4 changes: 4 additions & 0 deletions src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver

0 comments on commit 2c1665e

Please sign in to comment.