Skip to content

Commit

Permalink
Drop CircleCI, pickup GitHub Actions (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Jan 28, 2023
2 parents 4f4b1b2 + 391ba0c commit e86d092
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 117 deletions.
89 changes: 0 additions & 89 deletions .circleci/config.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/changelog-print.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: changelogPrint

on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
name: changelogPrint
steps:
- uses: actions/checkout@v3
- name: jdk 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- run: ./gradlew changelogPrint
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
pull_request:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
jre: [11]
os: [ubuntu-latest, windows-latest]
include:
- jre: 17
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install JDK ${{ matrix.jre }}
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: git fetch origin main
run: git fetch origin main
- name: gradlew build
run: ./gradlew build
- name: junit result
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
check_name: JUnit ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# GH_TOKEN
# NEXUS_USER
# NEXUS_PASS64 (base64 NOTE: `base64` and `openssl base64` failed, had to use Java
# byte[] data = "{{password}}".getBytes(StandardCharsets.UTF_8);
# String encoded = new String(Base64.getEncoder().encode(data), StandardCharsets.UTF_8);
# System.out.println(encoded);
# GPG_PASSPHRASE
# GPG_KEY64 (base64)
# gpg --export-secret-keys --armor KEY_ID | openssl base64 | pbcopy
# GRADLE_KEY
# GRADLE_SECRET

name: deploy
on:
workflow_dispatch:
inputs:
to_publish:
description: 'What to publish'
required: true
default: 'all'
type: choice
options:
- all

jobs:
build:
runs-on: ubuntu-latest
name: deploy
env:
gh_token: ${{ secrets.GH_TOKEN }}
ORG_GRADLE_PROJECT_nexus_user: ${{ secrets.NEXUS_USER }}
ORG_GRADLE_PROJECT_nexus_pass64: ${{ secrets.NEXUS_PASS64 }}
ORG_GRADLE_PROJECT_gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_gpg_key64: ${{ secrets.GPG_KEY64 }}
steps:
- uses: actions/checkout@v3
- name: jdk 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: gradle caching
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: git fetch origin main
run: git fetch origin main
- name: publish all
if: "${{ github.event.inputs.to_publish == 'all' }}"
run: |
./gradlew :changelogPush -Prelease=true -Penable_publishing=true -Pgradle.publish.key=${{ secrets.GRADLE_KEY }} -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }} --stacktrace --warning-mode all
23 changes: 23 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Validate Gradle Wrapper"
on:
push:
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/'
pull_request:
paths:
- 'gradlew'
- 'gradlew.bat'
- 'gradle/wrapper/'

permissions:
contents: read

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ String VER_ASSERTJ = '3.23.1'
String VER_JGIT= '5.13.1.202206130422-r'

subprojects {
apply from: 干.file('base/java8.gradle')
apply from: 干.file('base/java.gradle')
apply from: 干.file('spotless/java.gradle')

if (it.name == 'spotless-changelog-lib') {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugin_ifGitDiff_impl=com.diffplug.spotless.changelog.gradle.IfGitDiffPlugin
plugin_ifGitDiff_name=If Git Diff
plugin_ifGitDiff_desc=Decide what to configure based on changes relative to `origin/main`

ver_java=8
maven_group=com.diffplug.spotless-changelog
javadoc_links=\
https://docs.oracle.com/javase/8/docs/api/ \
Expand Down
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.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
36 changes: 19 additions & 17 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
pluginManagement {
plugins {
id 'com.diffplug.blowdryer' version '1.4.1'
id 'com.diffplug.blowdryerSetup' version '1.4.1'
id 'com.diffplug.osgi.bndmanifest' version '3.28.0'
id 'com.diffplug.spotless-changelog' version '2.2.0'
id 'com.diffplug.spotless' version '6.0.0'
id 'com.gradle.plugin-publish' version '0.17.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'org.jdrupes.mdoclet' version '1.0.10'
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id 'com.diffplug.blowdryerSetup'
id 'com.diffplug.osgi.bndmanifest' apply false
id 'com.diffplug.spotless-changelog' apply false
id 'com.diffplug.spotless' apply false
id 'com.gradle.plugin-publish' apply false
id 'io.github.gradle-nexus.publish-plugin' apply false
id 'org.jdrupes.mdoclet' apply false
// https://github.com/diffplug/blowdryer/blob/main/CHANGELOG.md
id 'com.diffplug.blowdryerSetup' version '1.7.0'
// https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md
id 'com.diffplug.spotless' version '6.14.0' apply false
// https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md
id 'com.diffplug.spotless-changelog' version '2.4.1' apply false
// https://plugins.gradle.org/plugin/com.gradle.plugin-publish
id 'com.gradle.plugin-publish' version '1.1.0' apply false
// https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md
id 'dev.equo.ide' version '0.12.1' apply false
// https://github.com/gradle-nexus/publish-plugin/releases
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' apply false
}
blowdryerSetup {
github 'diffplug/blowdryer-diffplug', 'tag', '5.1.3'
github 'diffplug/blowdryer-diffplug', 'tag', '7.0.0'
//devLocal '../blowdryer-diffplug'
setPluginsBlockTo {
it.file 'plugin.versions'
}
}
rootProject.name = 'spotless-changelog'
include 'spotless-changelog-lib'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 DiffPlug
* Copyright (C) 2019-2023 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
*/
package com.diffplug.spotless.changelog.gradle;


import java.io.IOException;
import org.assertj.core.api.AbstractStringAssert;
import org.assertj.core.api.Assertions;
Expand All @@ -38,14 +37,20 @@ protected boolean isConfigCache() {
}

protected GradleRunner gradleRunner() throws IOException {
String version;
if (isConfigCache()) {
setFile("gradle.properties").toContent("org.gradle.unsafe.configuration-cache=true");
version = V_GRADLE_CONFIG_CACHE;
} else {
version = V_GRADLE_OLDEST_SUPPORTED;
GradleRunner runner = GradleRunner.create().withProjectDir(rootFolder()).withPluginClasspath();
if (jreVersion() < 17) {
if (isConfigCache()) {
setFile("gradle.properties").toContent("org.gradle.unsafe.configuration-cache=true");
runner.withGradleVersion(V_GRADLE_CONFIG_CACHE);
} else {
runner.withGradleVersion(V_GRADLE_OLDEST_SUPPORTED);
}
}
return GradleRunner.create().withGradleVersion(version).withProjectDir(rootFolder()).withPluginClasspath();
return runner;
}

private static int jreVersion() {
return Integer.parseInt(System.getProperty("java.vm.specification.version"));
}

private static final String configCacheGunk1 = "Configuration cache is an incubating feature.\n" +
Expand Down

0 comments on commit e86d092

Please sign in to comment.