origin/main #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a basic workflow to help you get started with Actions | |
| name: Run Kotlin Check Tests | |
| on: | |
| push: | |
| branches: [ "main", "development" ] | |
| pull_request: | |
| branches: [ "main", "development" ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Java (for Kotlin) | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Install Latest Kotlin Compiler | |
| run: | | |
| curl -s https://get.sdkman.io | bash | |
| source "$HOME/.sdkman/bin/sdkman-init.sh" | |
| sdk install kotlin | |
| - name: Compile Kotlin files and create executable jar | |
| run: | | |
| mkdir -p out/classes | |
| # Find all Kotlin source files | |
| find src -name "*.kt" > sources.txt | |
| # Compile Kotlin code and include runtime | |
| kotlinc @sources.txt -include-runtime -d out/TestRunner.jar | |
| - name: Run Tests and Fail on "Failed" | |
| run: | | |
| set -o pipefail | |
| # Run the compiled JAR with explicit main class | |
| OUTPUT=$(java -jar out/TestRunner.jar | tee output.log) | |
| echo "$OUTPUT" | |
| # Fail the job if "Failed" appears in the output | |
| echo "$OUTPUT" | grep -q "Failed" && exit 1 || echo "All tests passed" |