Unit Testing #4
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
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('MavenBack/**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-m2 | |
working-directory: MavenBack | |
# Step 4: Build and test with Maven | |
- name: Build and run tests | |
run: mvn clean test |