Skip to content

Commit

Permalink
Upgrade dependencies & automatic release (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada authored Sep 7, 2024
1 parent ce69d09 commit b43f1ac
Show file tree
Hide file tree
Showing 24 changed files with 231 additions and 102 deletions.
35 changes: 14 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Cache SonarQube packages
uses: actions/cache@v4
Expand All @@ -57,14 +57,18 @@ jobs:
if: ${{ env.DEFAULT_JAVA == matrix.java && env.DEFAULT_OS == matrix.os }}
with:
name: executable-jar
path: jfxui/build/libs/white-rabbit-fx-*.jar
retention-days: 5
path: |
jfxui/build/libs/white-rabbit-fx-*.jar
jfxui/build/libs-checksums/*
if-no-files-found: error

- name: Archive test reports for ${{ matrix.os }} using Java ${{ matrix.java }}
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-reports-${{ matrix.os }}-java-${{ matrix.java }}
retention-days: 5
path: "**/build/reports/tests/*/**"
if-no-files-found: error

Expand All @@ -79,37 +83,26 @@ jobs:
- name: Build native package for ${{ runner.os }} using Java ${{ matrix.java }}
if: ${{ env.DEFAULT_JAVA == matrix.java }}
run: |
./gradlew jpackage createChecksums --info --warning-mode=summary -PjavaVersion=${{ matrix.java }}
./gradlew jpackage --info --warning-mode=summary -PjavaVersion=${{ matrix.java }}
- name: Stop Gradle Daemon
run: |
./gradlew -status
./gradlew -stop
- name: Archive test reports for ${{ runner.os }}
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test-reports-${{ runner.os }}
path: "**/build/reports/tests/*/**"

- name: Archive native package for ${{ runner.os }}
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_JAVA == matrix.java }}
with:
name: packages-${{ runner.os }}
path: jfxui/build/jpackage-dist/*

- name: Archive checksums for ${{ runner.os }}
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_JAVA == matrix.java }}
with:
name: checksums-${{ runner.os }}
path: jfxui/build/generatedChecksums/*

retention-days: 5
path: |
jfxui/build/jpackage-dist/*
jfxui/build/jpackage-checksums/*
if-no-files-found: error

build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"
- run: echo "Build successful"
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
with:
distribution: 'temurin'
java-version: 21
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v2
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Dependency Submission

on:
# Only runs on main branch
push:
branches: [ main ]

permissions:
contents: write # Required for dependency submission

jobs:
dependency-submission:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
28 changes: 28 additions & 0 deletions .github/workflows/github_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail

base_dir="$( cd "$(dirname "$0")/../.." >/dev/null 2>&1 ; pwd -P )"
readonly base_dir

cd "$base_dir"
echo "Reading project version from Gradle project at ${base_dir}..."
project_version=$(./gradlew properties --console=plain --quiet | grep "^version:" | awk '{print $2}')
readonly project_version
echo "Read project version '$project_version' from Gradle project"

release_artifacts=$(find build/release-artifacts -type f)
readonly release_artifacts
readonly title="Release $project_version"
readonly tag="$project_version"
echo "Creating release:"
echo "Git tag : $tag"
echo "Title : $title"
echo "Artifacts: $release_artifacts"

# shellcheck disable=SC2086
release_url=$(gh release create --draft --latest --title "$title" --target main "$tag" $release_artifacts)
readonly release_url
echo "Release URL: $release_url"
113 changes: 113 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Release
on:
workflow_dispatch:
inputs:
skip-maven-central:
description: "Skip deployment to Maven Central"
required: true
type: boolean
default: false

jobs:

build-native-packages:
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest']
env:
DEFAULT_OS: 'ubuntu-latest'
runs-on: ${{ matrix.os }}
permissions:
contents: read
defaults:
run:
shell: bash
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build
run: ./gradlew build jpackage --info --warning-mode all -PskipFlakyTests=true

- name: Archive executable JAR
uses: actions/upload-artifact@v4
if: ${{ env.DEFAULT_OS == matrix.os }}
with:
name: executable-jar
retention-days: 5
if-no-files-found: error
path: |
jfxui/build/libs/white-rabbit-fx-*.jar
jfxui/build/libs-checksums/*
- name: Archive native package for ${{ runner.os }}
uses: actions/upload-artifact@v4
with:
name: native-package-${{ runner.os }}
retention-days: 5
if-no-files-found: error
path: |
jfxui/build/jpackage-dist/*
jfxui/build/jpackage-checksums/*
release:
runs-on: ubuntu-latest
needs: build-native-packages
defaults:
run:
shell: "bash"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write # Required for creating GitHub release
actions: read # Required for checking build status
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# - name: Fail if not running on main branch
# if: ${{ github.ref != 'refs/heads/main' }}
# uses: actions/github-script@v7
# with:
# script: |
# core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')

# - name: Publish to Central Repository
# if: ${{ ! inputs.skip-maven-central }}
# run: ./gradlew publish closeAndReleaseRepository --info --warning-mode all
# env:
# ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
# ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: build/release-artifacts

- name: List artifacts
run: |
find build/release-artifacts -type f
ls -lh build/release-artifacts
- name: Create GitHub Release
run: ./.github/workflows/github_release.sh
env:
GH_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion api/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org.eclipse.jdt.core.circularClasspath=warning
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=ignore
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.camelCaseMatch=enabled
Expand Down
11 changes: 2 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'eclipse'
id "org.sonarqube" version "5.0.0.4638"
id "org.sonarqube" version "5.1.0.4882"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.8"
id "io.codearte.nexus-staging" version "0.30.0"
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
Expand All @@ -10,14 +10,7 @@ plugins {
id "org.gradle.crypto.checksum" version "1.4.0" apply false
}

def getProjectVersion() {
if(project.hasProperty("releaseVersion")) {
return project.property("releaseVersion")
}
return "1.9.0"
}

version = getProjectVersion()
version = "1.9.0"
group = "org.itsallcode.whiterabbit"

def javaVersion = project.hasProperty('javaVersion') ? project.getProperty('javaVersion') : 21
Expand Down
4 changes: 2 additions & 2 deletions docs/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Run a single test:
Precondition for Windows: Install the [WiX Toolset](https://wixtoolset.org) and add it to the `PATH`.

```sh
./gradlew jpackage --info -PreleaseVersion=x.y.z
./gradlew jpackage --info
```

## Deployment
Expand All @@ -90,7 +90,7 @@ Add the following to your `~/.gradle/gradle.properties`:
2. Run the following command:

```sh
./gradlew clean build publish closeAndReleaseRepository --info -PreleaseVersion=<version>
./gradlew clean build publish closeAndReleaseRepository --info
```

The release will be written to `jfxui/build/libs/white-rabbit-fx-<version>.jar`. Snapshots will be available at [oss.sonatype.org](https://oss.sonatype.org/content/repositories/snapshots/org/itsallcode/whiterabbit/).
Expand Down
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion jfxui/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ org.eclipse.jdt.core.circularClasspath=warning
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=ignore
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.camelCaseMatch=enabled
Expand Down
Loading

0 comments on commit b43f1ac

Please sign in to comment.