Skip to content

Commit

Permalink
add maven build
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 24, 2024
1 parent 75db42c commit f26cc86
Show file tree
Hide file tree
Showing 11 changed files with 848 additions and 1,562 deletions.
74 changes: 0 additions & 74 deletions .github/workflows/main-5.4.yml

This file was deleted.

212 changes: 147 additions & 65 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,156 @@
# This workflow will build a Java project with Ant
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant
name: Java CI Combined

name: Java CI - Lucee 6

on: [push, pull_request,workflow_dispatch]
on: [push, pull_request, workflow_dispatch]

jobs:
build:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Set up MySQL (local)
run: |
sudo systemctl start mysql
mysql -e 'CREATE DATABASE lucee' -uroot -proot
mysql -e 'CREATE USER "lucee"@"localhost" IDENTIFIED WITH mysql_native_password BY "lucee";' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON lucee.* TO "lucee"@"localhost"' -uroot -proot
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: lucee-script-runner-maven-cache
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Extract version number
id: extract-version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "::set-output name=VERSION::$VERSION"
- name: Cache Lucee files
uses: actions/cache@v4
with:
path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache
key: lucee-downloads

- name: Import GPG key
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

build-and-test:
runs-on: ubuntu-latest
needs: setup
env:
luceeVersion: light-6.0.0.462-SNAPSHOT
testLabels: orm
testAdditional: ${{ github.workspace }}/tests
MYSQL_SERVER: localhost
MYSQL_USERNAME: lucee
MYSQL_PASSWORD: lucee
MYSQL_PORT: 3306
MYSQL_DATABASE: lucee
strategy:
matrix:
lucee:
- { version: 'light-5.4.6.9', query: '5/all/light' }
- { version: 'light-6.0.3.1', query: '6.0/all/light' }
- { version: 'light-6.1.0.206-SNAPSHOT', query: '6.1/all/light' }
services:
minio:
image: fclairamb/minio-github-actions
ports:
- 9000:9000
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'

- name: Build and Install with Maven
run: |
echo "------- Maven Install -------";
mvn -B -e -f pom.xml clean install
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: hibernate-lex-${{ matrix.lucee.version }}
path: target/*.lex

- name: Checkout Lucee
uses: actions/checkout@v4
with:
repository: lucee/lucee
path: lucee

- name: Run Lucee Test Suite
uses: lucee/script-runner@main
with:
webroot: ${{ github.workspace }}/lucee/test
execute: /bootstrap-tests.cfm
luceeVersion: ${{ matrix.lucee.version }}
luceeVersionQuery: ${{ matrix.lucee.query }}
extensionDir: ${{ github.workspace }}/target
env:
testLabels: s3
testAdditional: ${{ github.workspace }}/tests

deploy:
runs-on: ubuntu-latest
needs: [build-and-test]
if: always() && needs.build-and-test.result == 'success'
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Set up MySQL (local)
run: |
sudo systemctl start mysql
mysql -e 'CREATE DATABASE lucee' -uroot -proot
mysql -e 'CREATE USER "lucee"@"localhost" IDENTIFIED WITH mysql_native_password BY "lucee";' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON lucee.* TO "lucee"@"localhost"' -uroot -proot
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: lucee-script-runner-maven-cache
- name: Cache Lucee files
uses: actions/cache@v3
with:
path: _actions/lucee/script-runner/main/lucee-download-cache
key: lucee-downloads-${{ env.luceeVersion }}
restore-keys: |
lucee-downloads
- name: Build with Ant
run: ant -noinput -verbose -buildfile build.xml
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: hibernate-lex
path: dist/*.lex
- name: Checkout Lucee
uses: actions/checkout@v3
with:
repository: lucee/lucee
path: lucee
- name: Run Lucee Test Suite (testFilter="orm")
uses: lucee/script-runner@main
with:
webroot: ${{ github.workspace }}/lucee/test
execute: /bootstrap-tests.cfm
luceeVersion: ${{ env.luceeVersion }}
extensionDir: ${{ github.workspace }}/dist
extensions:
env:
testLabels: orm
testAdditional: ${{ github.workspace }}/tests
MYSQL_SERVER: localhost
MYSQL_USERNAME: lucee
MYSQL_PASSWORD: lucee
MYSQL_PORT: 3306
MYSQL_DATABASE: lucee
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: ${{ github.workspace }}/lucee/test/reports/junit-test-results.xml
check_name: "Test Results"
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Import GPG key
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Build and Deploy with Maven
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
if [[ "${{ needs.setup.outputs.version }}" == *-SNAPSHOT ]]; then
echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml
else
echo "------- Maven Deploy release on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml
fi
3 changes: 0 additions & 3 deletions build.number

This file was deleted.

12 changes: 0 additions & 12 deletions build.properties

This file was deleted.

19 changes: 8 additions & 11 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
Build Hibernate Extension
</description>
<!-- set global properties for this build -->
<property file="build.properties"/>



<property name="lib" location="source/java/libs"/>
<property name="temp" location="temp"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="dist" location="target"/>
<property name="src" location="source/java/src"/>
<property name="srcImg" location="source/images"/>

<buildnumber file="build.number"/>


<path id="classpath">
<fileset dir="${lib}">
Expand Down Expand Up @@ -55,13 +52,13 @@

<echo file="${dist}/extension/META-INF/MANIFEST.MF">Manifest-Version: 1.0
Built-Date: ${NOW}
version: "${bundleversion}${build.number}${versionAppendix}"
version: "${bundleversion}"
id: "FAD1E8CB-4F45-4184-86359145767C29DE"
name: ${label}
description: ${description}
start-bundles: false
release-type: ${releaseType}
orm: "[{'class':'${class}','name':'${bundlename}','version':'${bundleversion}${build.number}${versionAppendix}'}]"
orm: "[{'class':'${class}','name':'${bundlename}','version':'${bundleversion}'}]"
lucee-core-version: "${luceeCoreVersion}"
</echo>

Expand All @@ -74,7 +71,7 @@ lucee-core-version: "${luceeCoreVersion}"
<target name="compile" depends="copy"
description="compile the source " >
<!-- Compile ACF-Infinspan source -->
<javac srcdir="${temp}" target="1.8" destdir="${build}" debug="true" debuglevel="lines,vars,source">
<javac srcdir="${temp}" target="11" destdir="${build}" debug="true" debuglevel="lines,vars,source">
<classpath refid="classpath" />
</javac>
</target>
Expand All @@ -85,9 +82,9 @@ lucee-core-version: "${luceeCoreVersion}"

<!-- Put everything in ${build} into .jar file -->
<jar
jarfile="${dist}/extension/jars/lucee-hibernate-${bundleversion}${build.number}${versionAppendix}.jar" basedir="${build}" manifest="${src}/META-INF/MANIFEST.MF">
jarfile="${dist}/extension/jars/${bundlename}-${bundleversion}.jar" basedir="${build}" manifest="${src}/META-INF/MANIFEST.MF">
<manifest>
<attribute name="Bundle-Version" value="${bundleversion}${build.number}${versionAppendix}"/>
<attribute name="Bundle-Version" value="${bundleversion}"/>
<attribute name="Built-Date" value="${NOW}"/>
<attribute name="Bundle-SymbolicName" value="${bundlename}"/>
</manifest>
Expand Down Expand Up @@ -115,7 +112,7 @@ lucee-core-version: "${luceeCoreVersion}"
</copy>

<!-- Zip everything -->
<zip destfile="${dist}/hibernate-orm-${bundleversion}${build.number}${versionAppendix}.lex">
<zip destfile="${dist}/${filename}-${bundleversion}.lex">
<zipfileset dir="${dist}/extension"/>
</zip>

Expand Down
Loading

0 comments on commit f26cc86

Please sign in to comment.