Skip to content

Commit

Permalink
Merge branch 'development' of github.com:ortus-boxlang/bx-derby into …
Browse files Browse the repository at this point in the history
…development
  • Loading branch information
michaelborn committed Nov 21, 2024
2 parents 31929f6 + 3266b45 commit c76ca0b
Show file tree
Hide file tree
Showing 11 changed files with 259 additions and 149 deletions.
66 changes: 31 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow is used to build releases
# It can also be called by other workflows to reuse the release flow.
name: BoxLang Apache Derby Release
name: Release

on:
# If you push to main this will trigger a stable release
Expand All @@ -18,12 +18,15 @@ on:
default: false
type: boolean

# Manual Trigger
workflow_dispatch:

env:
MODULE_ID: bx-derby
SNAPSHOT: ${{ inputs.snapshot || false }}
MODULE_ID: ${{ github.event.repository.name }}
JDK: 21
GRADLE: 8.7
BUILD_ID: ${{ github.run_number }}
SNAPSHOT: ${{ inputs.snapshot || false }}

jobs:
#############################################
Expand Down Expand Up @@ -53,17 +56,24 @@ jobs:
java-version: ${{ env.JDK }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/gradle-build-action@v3
with:
gradle-version: ${{ env.GRADLE }}

- name: Setup Environment Variables For Build Process
id: current_version
run: |
# Read Version from gradle.properties
echo "VERSION=`grep '^version=' gradle.properties | cut -d'=' -f2`" >> $GITHUB_ENV
TMPVERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2)
# Replace existing prerelease identifier with -snapshot or append -snapshot if none exists
# If we are on the development branch, we always append -snapshot
if [[ "${{ github.ref }}" == "refs/heads/development" ]]; then
TMPVERSION=$(echo $TMPVERSION | sed 's/-.*$//')-snapshot
fi
# Set the version in the environment
echo "VERSION=$TMPVERSION" >> $GITHUB_ENV
# Branche
# Branch
echo "Github Ref is $GITHUB_REF"
echo "BRANCH=main" >> $GITHUB_ENV
Expand All @@ -84,8 +94,8 @@ jobs:
run: |
npm install -g markdownlint-cli
markdownlint changelog.md --fix
./gradlew downloadBoxLang
./gradlew build -x test --stacktrace --console=plain
gradle downloadBoxLang
gradle build -x test --stacktrace --console=plain
- name: Commit Changelog [unreleased] with latest version
uses: EndBug/[email protected]
Expand All @@ -110,8 +120,6 @@ jobs:
with:
name: boxlang-build
path: |
build/distributions/**
build/libs/**
build/reports/tests/**
changelog.md
Expand All @@ -126,19 +134,17 @@ jobs:
SOURCE_DIR: "build/distributions"
DEST_DIR: "ortussolutions/boxlang-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"

# - name: Upload API Docs to S3
# uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read
# env:
# AWS_S3_BUCKET: "apidocs.ortussolutions.com"
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
# SOURCE_DIR: "build-coldbox/apidocs"
# DEST_DIR: ""

# - name: Publish to Maven Central
# run: |
- name: Upload API Docs to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: "apidocs.ortussolutions.com"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
SOURCE_DIR: "build/docs/javadoc"
DEST_DIR: "boxlang-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"

- name: Publish to ForgeBox
run: |
cd build/module
Expand Down Expand Up @@ -184,16 +190,11 @@ jobs:
steps:
- name: Checkout Development Repository
uses: actions/checkout@v4
if: env.LTS == 'false'
with:
ref: development

- name: Checkout LTS Repository
uses: actions/checkout@v4
if: env.LTS == 'true'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/gradle-build-action@v3
with:
gradle-version: ${{ env.GRADLE }}

Expand All @@ -209,12 +210,7 @@ jobs:
- name: Bump Version
run: |
if [ $LTS == 'true' ]
then
gradle bumpPatchVersion --stacktrace --console=plain
else
gradle bumpMinorVersion --stacktrace --console=plain
fi
gradle bumpMinorVersion --stacktrace --console=plain
git pull
- name: Commit Version Bump
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: BoxLang Apache Derby Snapshots
name: Snapshots

on:
push:
Expand All @@ -10,6 +10,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
MODULE_ID: ${{ github.event.repository.name }}
JDK_VERSION: 21

jobs:
#############################################
# Tests First baby! We fail, no build :(
Expand Down Expand Up @@ -39,15 +43,11 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21
java-version: ${{ env.JDK_VERSION }}

- name: Format Java Source
run: ./gradlew spotlessApply --stacktrace

# - name: Format BoxLang Source
# uses: Ortus-Solutions/[email protected]
# with:
# cmd: run-script format
run: |
./gradlew spotlessApply --stacktrace
- name: Commit Format Changes
uses: stefanzweifel/git-auto-commit-action@v5
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: BoxLang Apache Derby Test Suites
name: Test Suites

# We are a reusable Workflow only
on:
Expand All @@ -7,9 +7,13 @@ on:
SLACK_WEBHOOK_URL:
required: false

env:
MODULE_ID: ${{ github.event.repository.name }}
GRADLE_VERSION: 8.7

jobs:
tests:
name: Tests
name: Tests ${{ github.event.repository.name }}
runs-on: ${{ matrix.os }}
env:
DB_USER: root
Expand Down Expand Up @@ -40,9 +44,9 @@ jobs:
java-version: ${{ matrix.jdkVersion }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/gradle-build-action@v3
with:
gradle-version: "8.7"
gradle-version: ${{ env.GRADLE_VERSION }}

# - name: Setup Database and Fixtures
# run: |
Expand Down Expand Up @@ -71,7 +75,8 @@ jobs:
- name: Test Module
run: |
gradle downloadBoxLang
gradle test --stacktrace --console=plain
# this is done in order to build the module structure before testing
gradle shadowJar test --stacktrace --console=plain
- name: Upload Test Results
if: always()
Expand All @@ -82,6 +87,18 @@ jobs:
**/build/reports/tests/**
**/build/test-results/**
- name: Inform Slack
if: ${{ failure() && github.ref == 'refs/heads/development' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: boxlang
SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff'
SLACK_ICON_EMOJI: ":bell:"
SLACK_MESSAGE: "${{ env.MODULE_ID }} Tests FAILED! You broke the build! :("
SLACK_TITLE: "${{ env.MODULE_ID }} Build Failure"
SLACK_USERNAME: CI
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

publish-test-results:
name: Publish Test Results
runs-on: ubuntu-latest
Expand Down
51 changes: 34 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
// For building shadow jars with jdk 17 ONLY
//id 'com.github.johnrengelman.shadow' version '8.1.1'
// For building shadow jars using JDK 21 +, they had to fork
id "io.github.goooler.shadow" version "8.1.7"
id "io.github.goooler.shadow" version "8.1.8"
// Download task
id "de.undercouch.download" version "5.6.0"
}
Expand All @@ -22,6 +22,12 @@ ext {
buildID = System.getenv( 'BUILD_ID' ) ?: '0'
branch = System.getenv( 'BRANCH' ) ?: 'development'
}
if ( branch == 'development' ) {
// If the branch is 'development', ensure the version ends with '-snapshot'
// This replaces any existing prerelease identifier with '-snapshot'
version = version.contains('-') ? version.replaceAll(/-.*/, '-snapshot') : "${version}-snapshot"
boxlangVersion = boxlangVersion.contains('-') ? boxlangVersion.replaceAll(/-.*/, '-snapshot') : "${boxlangVersion}-snapshot"
}

if ( branch == 'development' ) {
// If the branch is 'development', ensure the version ends with '-snapshot'
Expand All @@ -40,12 +46,12 @@ dependencies {
// Look for it in the local build directory
// You must run `./gradle build -x test` in the BoxLang project
compileOnly files( '../../boxlang/build/distributions/boxlang-' + boxlangVersion + '-all.jar' )
// compileOnly files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )
compileOnly files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )
implementation 'org.apache.derby:derby:10.17.1.0'

// Testing Dependencies
// testImplementation files( 'src/test/resources/libs/boxlang-websupport-1.0.0.jar' )
testImplementation files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '.jar' )
testImplementation files( '../../boxlang/build/distributions/boxlang-' + boxlangVersion + '-all.jar' )
testImplementation files( 'src/test/resources/libs/boxlang-' + boxlangVersion + '-all.jar' )
testImplementation "org.junit.jupiter:junit-jupiter:5.+"
testImplementation "org.mockito:mockito-core:5.+"
testImplementation "com.google.truth:truth:1.+"
Expand All @@ -69,6 +75,20 @@ compileTestJava{
}
compileTestJava.finalizedBy( shadowJar )

/**
* Clean up
*/
clean {
doLast{
var userDir = file( "${System.getProperty('user.home')}/.boxlang/classes" )
if ( userDir.exists() ) {
userDir.deleteDir()
println "+ Cleared user home classes " + userDir.toString()
}
println "+ Clean finalized!"
}
}

javadoc {
// To avoid our own doclet issues
options.addBooleanOption( "Xdoclint:none", true )
Expand All @@ -94,12 +114,12 @@ javadoc.finalizedBy( zipJavadocs )
* This generates the META-INF/services files for the ServiceLoader as part of the `build` task
*/
serviceLoader {
serviceInterface 'ortus.boxlang.runtime.jdbc.drivers.IJDBCDriver'
// serviceInterface 'ortus.boxlang.runtime.bifs.BIF'
// serviceInterface 'ortus.boxlang.runtime.components.Component'
// serviceInterface 'ortus.boxlang.runtime.async.tasks.IScheduler'
// serviceInterface 'ortus.boxlang.runtime.cache.providers.ICacheProvider'
// serviceInterface 'ortus.boxlang.runtime.events.IInterceptor'
serviceInterface 'ortus.boxlang.runtime.jdbc.drivers.IJDBCDriver'
serviceInterface 'ortus.boxlang.runtime.bifs.BIF'
serviceInterface 'ortus.boxlang.runtime.components.Component'
serviceInterface 'ortus.boxlang.runtime.async.tasks.IScheduler'
serviceInterface 'ortus.boxlang.runtime.cache.providers.ICacheProvider'
serviceInterface 'ortus.boxlang.runtime.events.IInterceptor'
}

jar {
Expand Down Expand Up @@ -192,13 +212,10 @@ task downloadBoxLang( type: Download ) {
doFirst {
file( "src/test/resources/libs" ).mkdirs()
}
// Configure the URLs of the files to download
src([
"https://downloads.ortussolutions.com/ortussolutions/boxlang/${boxlangVersion}/boxlang-${boxlangVersion}-all.jar"//,
// "https://downloads.ortussolutions.com/ortussolutions/boxlang-runtimes/boxlang-web-support/${boxlangVersion}/boxlang-web-support-${boxlangVersion}.jar"
])
// Specify the destination directories for the downloaded files
dest "src/test/resources/libs/"
// Configure the URL of the file to download
src "https://downloads.ortussolutions.com/ortussolutions/boxlang/${boxlangVersion}/boxlang-${boxlangVersion}-all.jar"
// Specify the destination directory for the downloaded file
dest "src/test/resources/libs/boxlang-${boxlangVersion}-all.jar"
overwrite true
onlyIfModified false
}
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- URI Delimiter
- Github Actions Consolidation
- More tests

## [1.0.0] => 2024-APR-05

* First iteration of this module
2 changes: 1 addition & 1 deletion src/main/bx/ModuleConfig.bx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class {
* The BoxLang mapping for your module. All BoxLang modules are registered with an internal
* mapping prefix of : bxModules.{this.mapping}, /bxmodules/{this.mapping}. Ex: bxModules.test, /bxmodules/test
*/
this.mapping = "bxderby";
this.mapping = "derby";

/**
* Who built the module
Expand Down
Loading

0 comments on commit c76ca0b

Please sign in to comment.