-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.13 KB
/
Copy pathjava-ci.yml
File metadata and controls
45 lines (40 loc) · 1.13 KB
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
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
compile:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2
- name: Set up JDK 17
uses: actions/setup-java@v4.7.0
with:
java-version: '17'
distribution: 'temurin'
- name: Compile all Java files
run: |
echo "Finding and compiling all .java files..."
files=$(find . -name "*.java" -not -path "./.git/*")
echo "Files found: $(echo "$files" | wc -l)"
failed=0
while IFS= read -r f; do
mkdir -p out
if ! javac -encoding UTF-8 -d out "$f" 2>err.txt; then
echo "FAILED: $f"
cat err.txt
failed=$((failed + 1))
fi
done <<< "$files"
if [ $failed -gt 0 ]; then
echo "$failed file(s) failed to compile."
exit 1
fi
echo "All files compiled successfully!"