1- # This is a basic workflow to help you get started with Actions
21name : Run Kotlin Check Tests
32on :
43 push :
54 branches : [ "main", "development" ]
6- pull_request :
7- branches : [ "main", "development" ]
85 workflow_dispatch :
96jobs :
107 build :
@@ -22,18 +19,21 @@ jobs:
2219 curl -s https://get.sdkman.io | bash
2320 source "$HOME/.sdkman/bin/sdkman-init.sh"
2421 sdk install kotlin
25- - name : Compile Kotlin files and create executable jar
22+ - name : Compile Kotlin files
2623 run : |
2724 mkdir -p out/classes
28- # Find all Kotlin source files
2925 find src -name "*.kt" > sources.txt
30- # Compile Kotlin code and include runtime
31- kotlinc @sources.txt -include-runtime -d out/TestRunner.jar
26+ kotlinc @sources.txt -include-runtime -d out/classes
27+ - name : Create Manifest File
28+ run : |
29+ echo "Manifest-Version: 1.0" > MANIFEST.MF
30+ echo "Main-Class: MainKt" >> MANIFEST.MF
31+ - name : Package Executable JAR
32+ run : |
33+ jar cfm out/TestRunner.jar MANIFEST.MF -C out/classes .
3234 - name : Run Tests and Fail on "Failed"
3335 run : |
3436 set -o pipefail
35- # Run the compiled JAR with explicit main class
36- OUTPUT=$(java -jar out/TestRunner.jar | tee output.log)
37+ OUTPUT=$(kotlin out/TestRunner.jar | tee output.log)
3738 echo "$OUTPUT"
38- # Fail the job if "Failed" appears in the output
3939 echo "$OUTPUT" | grep -q "Failed" && exit 1 || echo "All tests passed"
0 commit comments