-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.43 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: CI Pipeline
on:
push:
branches:
- main
- develop
- staging
pull_request:
branches:
- main
- develop
- staging
jobs:
build:
runs-on: ubuntu-latest
services:
redis:
image: redis:latest
ports:
- 6379:6379
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up JDK 17
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "17"
# Step 3: Grant execute permission to Maven wrapper
- name: Grant execute permission to Maven wrapper
run: chmod +x ./mvnw
# Step 4: Cache Maven dependencies to speed up builds
- 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 5: Build and run tests with Maven
- name: Build and Test with Maven
run: |
./mvnw clean test -Dspring.profiles.active=test
# Step 6: Upload test results (optional but recommended for reporting)
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: target/surefire-reports/