KEYCLOAK-14229 Add GitHub Actions
This commit is contained in:
parent
f70af83fb6
commit
0e952a5a9f
3 changed files with 112 additions and 0 deletions
51
.github/workflows/ci.yml
vendored
Normal file
51
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
name: Keycloak CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Cache Maven packages
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.m2/repository
|
||||||
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: ${{ runner.os }}-m2
|
||||||
|
- name: Build
|
||||||
|
run: mvn clean install -B -DskipTests -Pdistribution
|
||||||
|
- name: Tar Maven Repo
|
||||||
|
shell: bash
|
||||||
|
run: tar -czvf maven-repo.tgz -C ~ .m2/repository
|
||||||
|
- name: Persist Maven Repo
|
||||||
|
uses: actions/upload-artifact@v1
|
||||||
|
with:
|
||||||
|
name: maven-repo
|
||||||
|
path: maven-repo.tgz
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
- name: Download Maven Repo
|
||||||
|
uses: actions/download-artifact@v1
|
||||||
|
with:
|
||||||
|
name: maven-repo
|
||||||
|
path: .
|
||||||
|
- name: Extract Maven Repo
|
||||||
|
shell: bash
|
||||||
|
run: tar -xzvf maven-repo.tgz -C ~
|
||||||
|
- name: Build testsuite
|
||||||
|
run: mvn clean install -B -Pauth-server-wildfly -DskipTests -f testsuite/pom.xml
|
||||||
|
- name: Run base tests
|
||||||
|
run: mvn clean install -B -Pauth-server-wildfly -f testsuite/integration-arquillian/tests/base/pom.xml | misc/log/trimmer.sh; exit ${PIPESTATUS[0]}
|
52
misc/log/LogTrimmer.java
Normal file
52
misc/log/LogTrimmer.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple utility class for trimming test output (if successful).
|
||||||
|
*
|
||||||
|
* Created to shrink down the output for Travis.
|
||||||
|
*
|
||||||
|
* Created by st on 03/07/17.
|
||||||
|
*/
|
||||||
|
public class LogTrimmer {
|
||||||
|
|
||||||
|
private static Pattern TEST_START_PATTERN = Pattern.compile("(\\[INFO\\] )?Running (.*)");
|
||||||
|
private static int TEST_NAME_GROUP = 2;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try (Scanner scanner = new Scanner(System.in)) {
|
||||||
|
String testRunning = null;
|
||||||
|
String line = null;
|
||||||
|
Matcher testMatcher = null;
|
||||||
|
StringBuilder testText = new StringBuilder();
|
||||||
|
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
line = scanner.nextLine();
|
||||||
|
if (testRunning == null) {
|
||||||
|
testMatcher = TEST_START_PATTERN.matcher(line);
|
||||||
|
if (testMatcher.find()) {
|
||||||
|
testRunning = testMatcher.group(TEST_NAME_GROUP);
|
||||||
|
System.out.println(line);
|
||||||
|
} else {
|
||||||
|
System.out.println("-- " + line);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (line.contains("Tests run:")) {
|
||||||
|
if (!(line.contains("Failures: 0") && line.contains("Errors: 0"))) {
|
||||||
|
System.out.println("--------- " + testRunning + " output start ---------");
|
||||||
|
System.out.println(testText.toString());
|
||||||
|
System.out.println("--------- " + testRunning + " output end ---------");
|
||||||
|
}
|
||||||
|
System.out.println(line);
|
||||||
|
testRunning = null;
|
||||||
|
testText = new StringBuilder();
|
||||||
|
} else {
|
||||||
|
testText.append(testRunning.substring(testRunning.lastIndexOf('.') + 1) + " ++ " + line);
|
||||||
|
testText.append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
misc/log/trimmer.sh
Executable file
9
misc/log/trimmer.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
if [ ! -f "LogTrimmer.class" ]; then
|
||||||
|
javac LogTrimmer.java
|
||||||
|
fi
|
||||||
|
|
||||||
|
java LogTrimmer
|
Loading…
Reference in a new issue