Skip to content

Commit

Permalink
chore(build): update to newer spinnaker project plugin (#776)
Browse files Browse the repository at this point in the history
updates to gradle 6.3
updates to kotlin 1.3.70
updates github actions workflows for new release flags
  • Loading branch information
cfieber committed Apr 19, 2020
1 parent 90bc995 commit 8a72d9e
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 108 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- master
- version-*

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g

jobs:
branch-build:
# Only run this on repositories in the 'spinnaker' org, not on forks.
Expand All @@ -21,15 +24,11 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v1.1.2
- uses: actions/cache@v1
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: ./gradlew -PenableCrossCompilerPlugin=true -PenablePublishing=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" build snapshot --stacktrace
run: ./gradlew -PenableCrossCompilerPlugin=true build --stacktrace
9 changes: 5 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: PR Build

on: [ pull_request ]

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,13 +18,11 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v1.1.2
- uses: actions/cache@v1
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
env:
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: ./gradlew -PenableCrossCompilerPlugin=true build javadoc
run: ./gradlew -PenableCrossCompilerPlugin=true build
117 changes: 56 additions & 61 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,63 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
# Install Java 8 for cross-compilation support. Setting it up before
# Java 11 means it comes later in $PATH (because of how setup-java works)
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v1
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Assemble release info
id: release_info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. .github/workflows/release_info.sh ${{ github.event.repository.name }}
echo ::set-output name=CHANGELOG::$(echo -e "${CHANGELOG}")
echo ::set-output name=SKIP_RELEASE::${SKIP_RELEASE}
echo ::set-output name=IS_CANDIDATE::${IS_CANDIDATE}
- name: Candidate build
if: steps.release_info.outputs.IS_CANDIDATE == 'true'
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: |
./gradlew -PenableCrossCompilerPlugin=true -PenablePublishing=true --info -Prelease.disableGitChecks=true -Prelease.useLastTag=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" candidate
- name: Release build
if: steps.release_info.outputs.IS_CANDIDATE == 'false'
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: |
./gradlew -PenableCrossCompilerPlugin=true -PenablePublishing=true --info -Prelease.disableGitChecks=true -Prelease.useLastTag=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" final
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.event.repository.name }} ${{ github.ref }}
body: |
${{ steps.release_info.outputs.CHANGELOG }}
draft: false
prerelease: ${{ steps.release_info.outputs.IS_CANDIDATE }}
- name: Pause before dependency bump
run: sleep 300
- name: Trigger dependency bump workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.SPINNAKER_GITHUB_TOKEN }}
event-type: bump-dependencies
client-payload: '{"ref": "${{ github.ref }}"}'
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
# Install Java 8 for cross-compilation support. Setting it up before
# Java 11 means it comes later in $PATH (because of how setup-java works)
- uses: actions/setup-java@v1
with:
java-version: 8
- uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v1
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Assemble release info
id: release_info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. .github/workflows/release_info.sh ${{ github.event.repository.full_name }}
echo ::set-output name=CHANGELOG::$(echo -e "${CHANGELOG}")
echo ::set-output name=SKIP_RELEASE::${SKIP_RELEASE}
echo ::set-output name=IS_CANDIDATE::${IS_CANDIDATE}
echo ::set-output name=RELEASE_VERSION::${RELEASE_VERSION}
- name: Release build
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
RELEASE_VERSION: ${{ steps.release_info.outputs.RELEASE_VERSION }}
run: |
./gradlew -PenableCrossCompilerPlugin=true --info -Pversion="${RELEASE_VERSION}" -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" publish
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.event.repository.name }} ${{ github.ref }}
body: |
${{ steps.release_info.outputs.CHANGELOG }}
draft: false
prerelease: ${{ steps.release_info.outputs.IS_CANDIDATE }}
- name: Pause before dependency bump
run: sleep 90
- name: Trigger dependency bump workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.SPINNAKER_GITHUB_TOKEN }}
event-type: bump-dependencies
client-payload: '{"ref": "${{ github.ref }}"}'
6 changes: 5 additions & 1 deletion .github/workflows/release_info.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -x

# Only look to the latest release to determine the previous tag -- this allows us to skip unsupported tag formats (like `version-1.0.0`)
export PREVIOUS_TAG=`curl --silent "https://api.github.com/repos/spinnaker/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
export PREVIOUS_TAG=`curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
echo "PREVIOUS_TAG=$PREVIOUS_TAG"
export NEW_TAG=${GITHUB_REF/refs\/tags\//}
echo "NEW_TAG=$NEW_TAG"
Expand Down Expand Up @@ -29,3 +29,7 @@ SEMVER_REGEX="\

# Used in downstream steps to determine if the release should be marked as a "prerelease" and if the build should build candidate release artifacts
export IS_CANDIDATE=`[[ $NEW_TAG =~ $SEMVER_REGEX && ! -z ${BASH_REMATCH[4]} ]] && echo "true" || echo "false"`

# This is the version string we will pass to the build, trim off leading 'v' if present
export RELEASE_VERSION=`[[ $NEW_TAG =~ $SEMVER_REGEX ]] && echo "${NEW_TAG:1}" || echo "${NEW_TAG}"`
echo "RELEASE_VERSION=$RELEASE_VERSION"
26 changes: 5 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,14 @@
* limitations under the License.
*/

buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/spinnaker/gradle" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.netflix.spinnaker.gradle:spinnaker-dev-plugin:$spinnakerGradleVersion"
classpath "com.netflix.nebula:nebula-kotlin-plugin:1.3.10"
if (Boolean.valueOf(enablePublishing)) {
classpath "com.netflix.spinnaker.gradle:spinnaker-gradle-project:$spinnakerGradleVersion"
// TODO: nebula-publishing-plugin version override should be removed as soon as spinnaker-gradle-project is updated
// this override is needed to omit compileOnly dependencies from generated pom.xml
classpath "com.netflix.nebula:nebula-publishing-plugin:12.0.1"
}
}
plugins {
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
id 'nebula.kotlin' version '1.3.70' apply false
}

allprojects { project ->
subprojects { project ->
group = "com.netflix.spinnaker.front50"
apply plugin: 'spinnaker.base-project'
if (Boolean.valueOf(enablePublishing)) {
apply plugin: "spinnaker.project"
}
apply plugin: 'io.spinnaker.project'

if ([korkVersion, fiatVersion].find { it.endsWith("-SNAPSHOT") }) {
repositories {
Expand Down
11 changes: 0 additions & 11 deletions front50-bom/front50-bom.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,12 @@
*/

apply plugin: "java-platform"
apply plugin: "maven-publish"

javaPlatform {
allowDependencies()
}


if (Boolean.valueOf(enablePublishing)) {
publishing {
publications {
nebula(MavenPublication) {
from components.javaPlatform
}
}
}
}

dependencies {
api(platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion"))

Expand Down
2 changes: 1 addition & 1 deletion front50-web/front50-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

apply plugin: 'spinnaker.application'
apply plugin: 'io.spinnaker.package'

ext {
springConfigLocation = System.getProperty('spring.config.additional-location', "${System.getProperty('user.home')}/.spinnaker/")
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
clouddriverVersion=5.47.1
enablePublishing=false
fiatVersion=1.18.3
includeProviders=azure,gcs,oracle,redis,s3,swift,sql
korkVersion=7.37.0
org.gradle.parallel=true
spinnakerGradleVersion=7.11.6
spinnakerGradleVersion=8.0.0-rc.3
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-5.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 8a72d9e

Please sign in to comment.