-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (35 loc) · 1.04 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
name: Java CI with LOC Counting
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v2
# Cache Maven dependencies
- name: Cache Maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/*.java') }}
restore-keys: |
${{ runner.os }}-maven-
# Build with Maven (check for compilation errors)
- name: Build with Maven
run: mvn clean install
# Run Checkstyle (static code analysis)
- name: Run Checkstyle
run: mvn checkstyle:check
# Count Lines of Code using cloc
- name: Count Lines of Code
run: |
sudo apt-get update
sudo apt-get install -y cloc
cloc --exclude-dir=target --quiet . # Exclude 'target' directory to avoid counting compiled files