Skip to content

Update ci-unit-test.yml #7

Update ci-unit-test.yml

Update ci-unit-test.yml #7

Workflow file for this run

name: CI Unit test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
run-tests:
runs-on: ubuntu-24.04
strategy:
matrix:
project:
- testing/jUnit/01-SumTest
- web_frameworks/SpringBoot
steps:
# Step 1: Checkout the code
- uses: actions/checkout@v4
# Step 2: Set up JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
# Step 3: Cache Maven dependencies
- name: Cache Maven dependencies
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Step 4: Run Unit Tests
- name: Run Unit Tests for ${{ matrix.project }}
run: mvn -B clean test --file ${{ matrix.project }}/pom.xml
env:
SPRING_PROFILES_ACTIVE: ${{ contains(matrix.project, 'SpringBoot') && 'test' || '' }}