Skip to content

Commit

Permalink
Add Unit test action
Browse files Browse the repository at this point in the history
  • Loading branch information
AsemLab committed Jul 29, 2024
1 parent 42dc031 commit 5fe37c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ jobs:
java_version:
name: Use Java
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, 'Update')
# Runs only when commit message startsWith 'Update'
if: startsWith(github.event.head_commit.message, 'Update')

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java
uses: actions/[email protected]
with:
java-version: 17

# Print Hello, world!
- name: Run a one-line script
run: echo Hello, world!

# Print Java compiler version
- name: Print Java
run: javac -version
run: javac -version

- name: Run Debug Tests
run: ./gradlew :app:testDebugUnitTest
2 changes: 1 addition & 1 deletion app/src/test/java/com/asemlab/samples/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ import org.junit.Assert.*
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
assertEquals(5, 2 + 2)
}
}

0 comments on commit 5fe37c4

Please sign in to comment.