11# This is a basic workflow to help you get started with Actions
2-
32name : Run Kotlin Check Tests
4-
53# Controls when the workflow will run
64on :
75 # Triggers the workflow on push or pull request events but only for the "main" and "development" branch
86 push :
97 branches : [ "main", "development" ]
108 pull_request :
119 branches : [ "main", "development" ]
12-
1310 # Allows you to run this workflow manually from the Actions tab
1411 workflow_dispatch :
15-
1612# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1713jobs :
1814 # This workflow contains a single job called "build"
1915 build :
2016 # The type of runner that the job will run on
2117 runs-on : ubuntu-latest
22-
2318 # Steps represent a sequence of tasks that will be executed as part of the job
2419 steps :
2520 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2621 - name : Checkout code
2722 uses : actions/checkout@v4
2823
24+
2925 - name : Set up Java (for Kotlin)
3026 uses : actions/setup-java@v3
3127 with :
3228 distribution : ' temurin'
33- java-version : ' 17 '
29+ java-version : ' 19 '
3430
3531 - name : Install Latest Kotlin Compiler
3632 run : |
3733 curl -s https://get.sdkman.io | bash
3834 source "$HOME/.sdkman/bin/sdkman-init.sh"
3935 sdk install kotlin
40-
41- - name : Compile Kotlin files and create executable jar
42- run : |
43- mkdir -p out/classes
4436
45- # Find source files
46- find src -name "*.kt" > sources.txt
37+ - name : Compile Kotlin files
38+ run : |
39+ mkdir -p out
40+ find . -name "*.kt" > sources.txt
41+ kotlinc @sources.txt -include-runtime -d out/TestRunner.jar
4742
48- # Compile Kotlin and include runtime in the JAR
49- kotlinc @sources.txt -include-runtime -d out/TestRunner.jar -main MainKt
50-
43+ - name : Run Tests and Fail on "Failed"
44+ run : |
5145 set -o pipefail
5246 OUTPUT=$(kotlin out/TestRunner.jar | tee output.log)
5347 echo "$OUTPUT"
54- echo "$OUTPUT" | grep -q "Failed" && exit 1 || echo "All tests passed"
48+ echo "$OUTPUT" | grep -q "Failed" && exit 1 || echo "All tests passed"
0 commit comments