Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "monthly"
# - package-ecosystem: "gradle"
# directory: "/"
# schedule:
# interval: "monthly"

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
35 changes: 22 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,56 @@ jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
java: [11, 16]
env:
DEFAULT_JAVA: 11

steps:
- uses: actions/checkout@v2

- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow

- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
java-version: ${{ matrix.java }}

- uses: gradle/wrapper-validation-action@v1

- name: Cache Gradle packages and wrapper
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-gradle-
${{ runner.os }}-maven-
key: ${{ runner.os }}-java-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-gradle-

- name: Cache SonarQube packages
uses: actions/cache@v2
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
key: ${{ runner.os }}-java-${{ matrix.java }}-sonar
restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-sonar

- name: Build with Gradle
run: |
./gradlew build --info --warning-mode=summary
- name: Publish Test Report
./gradlew build --warning-mode=summary

- name: Publish Test Report for Java ${{ matrix.java }}
uses: scacap/action-surefire-report@v1
if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
with:
report_paths: '**/build/test-results/*/TEST-*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Sonar analysis
if: ${{ env.SONAR_TOKEN != null }}
if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: |
./gradlew sonarqube -Dsonar.host.url=https://sonarcloud.io \
-Dsonar.organization=itsallcode \
-Dsonar.login=$SONAR_TOKEN \
--info --warning-mode=summary
./gradlew sonarqube -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=itsallcode -Dsonar.login=$SONAR_TOKEN --warning-mode=summary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Pull request [#24](https://github.com/itsallcode/openfasttrace-gradle/pull/24):
- Upgrade to [OpenFastTrace 3.2.1](https://github.com/itsallcode/openfasttrace/releases/tag/3.2.1)
- Upgrade other dependencies
- Build and test with Java 16. Please note that Java 16 is only supported with Gradle 7.0+.

## [0.9.0] - 2021-05-30

### Changed
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ Import into eclipse using [buildship](https://projects.eclipse.org/projects/tool
$ ./gradlew licenseFormat
```

### Check if dependencies are up-to-date

```bash
$ ./gradlew dependencyUpdates
```

### Run local sonar analysis

```bash
Expand Down
20 changes: 17 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ plugins {
id 'jacoco'
id 'com.gradle.plugin-publish' version '0.15.0'
id 'com.github.hierynomus.license' version '0.16.1'
id 'org.sonarqube' version '3.2.0'
id 'org.sonarqube' version '3.3'
id 'pl.droidsonroids.jacoco.testkit' version '1.0.8'
id 'com.github.ben-manes.versions' version '0.39.0'
}

repositories {
Expand All @@ -20,7 +21,7 @@ targetCompatibility = 11

ext {
gradlePluginId = 'org.itsallcode.openfasttrace'
oftVersion = '3.2.0'
oftVersion = '3.2.1'
junitVersion = '5.7.2'
if (project.hasProperty('oftSourceDir')) {
oftSourceDir = file(project.oftSourceDir)
Expand Down Expand Up @@ -114,7 +115,7 @@ test.onlyIf { rootProject.name == 'openfasttrace-gradle' }
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
xml.required = true
}
}

Expand All @@ -135,3 +136,16 @@ downloadLicenses {
includeProjectDependencies = true
ignoreFatalParseErrors = false
}

def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}

tasks.named("dependencyUpdates").configure {
gradleReleaseChannel = "current"
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@ private GradleTestConfig(String gradleVersion)
{
this.gradleVersion = gradleVersion;
}

public boolean supportedWithJvm() {
if(this == SIX_ZERO) {
return System.getProperty("java.version").startsWith("11");
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeTrue;

import java.io.BufferedReader;
import java.io.IOException;
Expand Down Expand Up @@ -264,6 +265,7 @@ private static String fileContent(Path file) throws IOException
private static BuildResult runBuild(GradleTestConfig config, Path projectDir,
String... arguments)
{
assumeTrue(config.supportedWithJvm());
configureJacoco(projectDir);
final List<String> allArgs = new ArrayList<>();
allArgs.addAll(asList(arguments));
Expand Down