From 62f4e6f8b415f94f75e7a0dc3b73c863997b8b8c Mon Sep 17 00:00:00 2001 From: Siphalor Date: Sat, 30 Jul 2022 12:48:42 +0200 Subject: [PATCH] Implement a CI --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++++ .github/workflows/error-filter.py | 11 ++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/error-filter.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c5854a9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: Java CI with Gradle + +on: + push: + pull_request: + +jobs: + test: + strategy: + matrix: + jdk-version: [8, 11, 17] + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.jdk-version }} + distribution: temurin + - name: Make gradlew executable + run: chmod +x gradlew + - name: Build with Gradle + uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 + with: + arguments: test + - name: Process Errors + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Gradle test (Java ${{matrix.jdk-version}}) + path: build/test-results/test/*.xml + reporter: java-junit diff --git a/.github/workflows/error-filter.py b/.github/workflows/error-filter.py new file mode 100644 index 0000000..7d9b30d --- /dev/null +++ b/.github/workflows/error-filter.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 +import sys +import re + +_in = sys.stdin.read() +for match in re.finditer(r"(\S+\.(\w+)) > (\S+) FAILED\n\s*(.*)(?:.*\n)*?.*\(\2\.java:(\d+)", _in): + file = 'src/test/java/' + match[1].replace('.', '/') + '.java' + line = match[5] + title = match[3] + message = match[4] + print(f"::error file={file},line={line},title=Failed in {title}::{message}")