Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3153d53
Configure workflow to show surefire test results as PR checks
brenuart Aug 5, 2021
fefcf50
Simulate failing test
brenuart Aug 5, 2021
476e49c
Tell Maven to not fail build on failed test
brenuart Aug 5, 2021
7106248
Upload test reports
brenuart Aug 6, 2021
6425744
Redirect test output into file
brenuart Aug 6, 2021
b20f13c
Uptdae surefire action version
brenuart Aug 6, 2021
801d927
Test with a modified Surefire report
brenuart Aug 6, 2021
6b695c8
Postprocess surefire XML reports to make their sysout accessible thro…
brenuart Aug 6, 2021
7bb3e5b
Install XML tools
brenuart Aug 6, 2021
8ad3a86
Limit to target/surefire-reports-github only
brenuart Aug 6, 2021
c8cf627
Check if xalan is installed
brenuart Aug 6, 2021
4de715c
Revert "Check if xalan is installed"
brenuart Aug 6, 2021
1b028e4
Use mikepenz/action-junit-report instead of scacap/action/surefire-re…
brenuart Aug 10, 2021
9cb7fd4
Fail the build early when test failure but always process test reports
brenuart Aug 10, 2021
4073a7e
Use MAVEN_OPTS to declare maven options applicable to all invocations
brenuart Aug 10, 2021
51c5158
Revert "Use MAVEN_OPTS to declare maven options applicable to all inv…
brenuart Aug 10, 2021
6c4ef58
Move JVM options into .mvn/jvm.config
brenuart Aug 10, 2021
1a19f59
Test action brenuart/action-junit-report
brenuart Aug 11, 2021
350846a
Try without explicit github token (and rely on default)
brenuart Aug 12, 2021
fb28ba3
Revert "Try without explicit github token (and rely on default)"
brenuart Aug 12, 2021
cfbd5f0
Discard surefire action
brenuart Aug 13, 2021
cb3e671
Remove failing test
brenuart Aug 13, 2021
841cc69
Add JUnit5 extension to log the test name before it starts
brenuart Aug 13, 2021
62c98aa
Cleanup and remove useless files
brenuart Aug 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
paths-ignore:
- "*.md"

env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"

jobs:
build:
name: build
Expand All @@ -20,54 +17,72 @@ jobs:
matrix:
java: [ '8', '11', '16' ]
steps:
- uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v2

- name: Setup JAVA
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: ${{ matrix.java }}
- uses: actions/[email protected]

- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml verify

- name: Upload Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: test-reports-${{ matrix.java }}
path: '**/target/surefire-reports/**'
if-no-files-found: ignore

release:
name: release
if: github.event_name == 'push' && github.repository == 'logstash/logstash-logback-encoder' && github.ref == 'refs/heads/main' && startsWith(github.event.commits[0].message, '[release]')
runs-on: ubuntu-20.04
needs: [build]
if: github.event_name == 'push' && github.repository == 'logstash/logstash-logback-encoder' && github.ref == 'refs/heads/main' && startsWith(github.event.commits[0].message, '[release]')
steps:
- uses: actions/checkout@v2
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: main

- name: Setup JAVA
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: 1.8

- name: Setup GPG
run: .github/workflows/steps/setup-gpg.sh
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Setup GIT
run: |
.github/workflows/steps/setup-git.sh
git switch main
- uses: actions/[email protected]

- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.m2/wrapper
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '.mvn/wrapper/maven-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Release
run: ./mvnw --batch-mode --no-transfer-progress --show-version --settings .github/maven/settings.xml --activate-profiles ossrh release:prepare release:perform
env:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

dependency-reduced-pom.xml

META-INF/
target/

.idea
Expand Down
1 change: 1 addition & 0 deletions .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-XX:+TieredCompilation -XX:TieredStopAtLevel=1
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,18 @@
</plugins>
</build>
</profile>

<profile>
<id>github</id>
<activation>
<property>
<name>env.CI</name>
</property>
</activation>
<properties>
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
</properties>
</profile>
</profiles>

<distributionManagement>
Expand Down
45 changes: 45 additions & 0 deletions src/test/java/net/logstash/logback/test/TestExecutionLogger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2013-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.logstash.logback.test;

import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

/**
* Simple JUnit5 test extension logging the name of each test before it starts to help
* troubleshooting output when running multiple tests at once.
*/
public class TestExecutionLogger implements BeforeEachCallback, BeforeAllCallback {

@Override
public void beforeEach(ExtensionContext context) throws Exception {

StringBuilder sb = new StringBuilder("---- Running ");
if (context.getTestClass().isPresent()) {
sb.append(context.getTestClass().get().getName());
}
sb.append("#")
.append(context.getDisplayName());

System.out.println(sb);
}

@Override
public void beforeAll(ExtensionContext context) throws Exception {
System.out.println("---- Initializing " + context.getTestClass().orElse(null));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
net.logstash.logback.test.TestExecutionLogger
1 change: 1 addition & 0 deletions src/test/resources/junit-platform.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
junit.jupiter.extensions.autodetection.enabled = true