Skip to content

Commit

Permalink
Unit testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ALEEF02 committed Nov 23, 2024
1 parent 5064cf9 commit b5d869e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Java Unit Testing

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Check out the repository
- name: Checkout repository
uses: actions/checkout@v3

# Step 2: Set up JDK
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin' # You can change this to your desired distribution (e.g., 'zulu', 'adopt')

# Step 3: Cache Maven dependencies
- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2
# Step 4: Build and test with Maven
- name: Build and run tests
run: mvn clean test
9 changes: 9 additions & 0 deletions MavenBack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>11.0.12</jetty.version>
<powermock.version>2.0.9</powermock.version>
<exec.mainClass>ppp.ServerMain</exec.mainClass>
</properties>

Expand Down Expand Up @@ -65,6 +66,14 @@
<version>7.5.0</version>
</dependency>

<!-- J-unit testing -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.14.2</version>
<scope>compile</scope>
</dependency>

<!-- Anti "; DROP TABLE *;" -->
<!--
<dependency>
Expand Down

0 comments on commit b5d869e

Please sign in to comment.