Skip to content

Commit ac4f117

Browse files
committed
add maven build
1 parent 4a97aba commit ac4f117

File tree

6 files changed

+414
-107
lines changed

6 files changed

+414
-107
lines changed

.github/workflows/main.yml

Lines changed: 125 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,132 @@
1-
# This workflow will build a Java project with Ant
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant
1+
name: Java CI Combined
32

4-
name: Java CI
5-
6-
on: [push, pull_request,workflow_dispatch]
3+
on: [push, pull_request, workflow_dispatch]
74

85
jobs:
9-
build:
6+
setup:
7+
runs-on: ubuntu-latest
8+
outputs:
9+
version: ${{ steps.extract-version.outputs.VERSION }}
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Set up JDK 11
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: 'temurin'
18+
java-version: '11'
19+
20+
- name: Cache Maven packages
21+
uses: actions/cache@v4
22+
with:
23+
path: ~/.m2
24+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25+
restore-keys: |
26+
${{ runner.os }}-maven-
1027
28+
- name: Extract version number
29+
id: extract-version
30+
run: |
31+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
32+
echo "::set-output name=VERSION::$VERSION"
33+
34+
- name: Cache Lucee files
35+
uses: actions/cache@v4
36+
with:
37+
path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache
38+
key: lucee-downloads
39+
40+
- name: Import GPG key
41+
run: |
42+
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
43+
env:
44+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
45+
46+
build-and-test:
1147
runs-on: ubuntu-latest
48+
needs: setup
1249
env:
13-
luceeVersion: light-6.0.0.451-BETA
14-
luceeVersionQuery: 0/all/light
50+
LUCEE_TEST_VERSIONS_PLUS: ${{ vars.LUCEE_TEST_VERSIONS_PLUS }}
51+
strategy:
52+
matrix:
53+
lucee: ${{ fromJSON(vars.LUCEE_TEST_VERSIONS_PLUS) }}
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Set up JDK 11
58+
uses: actions/setup-java@v4
59+
with:
60+
java-version: '11'
61+
distribution: 'adopt'
62+
63+
- name: Build and Install with Maven
64+
run: |
65+
echo "------- Maven Install -------";
66+
mvn -B -e -f pom.xml clean install
67+
68+
- name: Upload Artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: argon2-lex-${{ matrix.lucee.version }}
72+
path: target/*.lex
73+
74+
- name: Checkout Lucee
75+
uses: actions/checkout@v4
76+
with:
77+
repository: lucee/lucee
78+
path: lucee
79+
80+
- name: Run Lucee Test Suite
81+
uses: lucee/script-runner@main
82+
with:
83+
webroot: ${{ github.workspace }}/lucee/test
84+
execute: /bootstrap-tests.cfm
85+
luceeVersion: ${{ matrix.lucee.version }}
86+
luceeVersionQuery: ${{ matrix.lucee.query }}
87+
extensionDir: ${{ github.workspace }}/target
88+
env:
89+
testLabels: argon2
90+
testAdditional: ${{ github.workspace }}/tests
91+
92+
deploy:
93+
runs-on: ubuntu-latest
94+
needs: [build-and-test]
95+
if: always() && needs.build-and-test.result == 'success'
1596
steps:
16-
- uses: actions/checkout@v4
17-
- name: Set up JDK 11
18-
uses: actions/setup-java@v4
19-
with:
20-
java-version: '11'
21-
distribution: 'adopt'
22-
- name: Cache Maven packages
23-
uses: actions/cache@v4
24-
with:
25-
path: ~/.m2
26-
key: lucee-script-runner-maven-cache
27-
enableCrossOsArchive: true
28-
- name: Cache Lucee files
29-
uses: actions/cache@v4
30-
with:
31-
path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache
32-
key: lucee-downloads
33-
enableCrossOsArchive: true
34-
- name: Build with Ant
35-
run: ant -noinput -verbose -buildfile build.xml
36-
- name: Upload Artifact
37-
uses: actions/upload-artifact@v4
38-
with:
39-
name: argon2-lex
40-
path: dist/*.lex
41-
- name: Checkout Lucee
42-
uses: actions/checkout@v4
43-
with:
44-
repository: lucee/lucee
45-
path: lucee
46-
- name: Run Lucee Test Suite (testFilter="argon2")
47-
uses: lucee/script-runner@main
48-
with:
49-
webroot: ${{ github.workspace }}/lucee/test
50-
execute: /bootstrap-tests.cfm
51-
luceeVersion: ${{ env.luceeVersion }}
52-
luceeVersionQuery: ${{ env.luceeVersionQuery }}
53-
extensionDir: ${{ github.workspace }}/dist
54-
env:
55-
testLabels: argon2
56-
testAdditional: ${{ github.workspace }}/tests
97+
- name: Checkout repository
98+
uses: actions/checkout@v4
99+
100+
- name: Set up JDK 11
101+
uses: actions/setup-java@v4
102+
with:
103+
distribution: 'temurin'
104+
java-version: '11'
105+
106+
- name: Cache Maven packages
107+
uses: actions/cache@v4
108+
with:
109+
path: ~/.m2
110+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
111+
restore-keys: |
112+
${{ runner.os }}-maven-
113+
114+
- name: Import GPG key
115+
run: |
116+
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
117+
env:
118+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
119+
120+
- name: Build and Deploy with Maven
121+
env:
122+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
123+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
124+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
125+
run: |
126+
if [[ "${{ needs.setup.outputs.version }}" == *-SNAPSHOT ]]; then
127+
echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------";
128+
mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml
129+
else
130+
echo "------- Maven Deploy release on ${{ github.event_name }} -------";
131+
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml
132+
fi

build.number

Lines changed: 0 additions & 3 deletions
This file was deleted.

build.properties

Lines changed: 0 additions & 9 deletions
This file was deleted.

build.xml

Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,16 @@
55
</description>
66
<!-- set global properties for this build -->
77

8-
<property file="build.properties"/>
98

109
<property name="lib" location="source/java/libs"/>
1110
<property name="src" location="source/java/src"/>
1211
<property name="srcImg" location="source/images"/>
1312
<property name="temp" location="temp"/>
1413
<property name="build" location="build"/>
15-
<property name="dist" location="dist"/>
14+
<property name="dist" location="target"/>
1615

1716
<property name="tld" location="source/tld"/>
1817
<property name="fld" location="source/fld"/>
19-
20-
<buildnumber file="build.number"/>
21-
22-
<scriptdef name="replace" language="javascript">
23-
<attribute name="haystack" />
24-
<attribute name="needle" />
25-
<attribute name="repl" />
26-
<attribute name="property" />
27-
<![CDATA[
28-
var text = attributes.get("haystack");
29-
var needle = attributes.get("needle");
30-
var repl = attributes.get("repl");
31-
text=text.trim();
32-
33-
var regex = new RegExp(needle,'g');
34-
text=text.replace(regex,repl);
35-
project.setProperty(attributes.get("property"), text);
36-
]]>
37-
</scriptdef>
3818

3919
<path id="classpath">
4020
<fileset dir="${lib}">
@@ -75,7 +55,7 @@
7555

7656
<echo file="${dist}/extension/META-INF/MANIFEST.MF">Manifest-Version: 1.0
7757
Built-Date: ${NOW}
78-
version: "${bundleversion}${build.number}${appendix}"
58+
version: "${bundleversion}"
7959
id: "${id}"
8060
name: "${label}"
8161
description: "${description}"
@@ -101,39 +81,32 @@ start-bundles: false
10181

10282
<!-- Put everything in ${build} into .jar file -->
10383
<jar
104-
jarfile="${dist}/extension/jars/${filename}-${bundleversion}${build.number}${appendix}.jar" basedir="${build}" manifest="${src}/META-INF/MANIFEST.MF">
84+
jarfile="${dist}/extension/jars/${filename}-${bundleversion}.jar" basedir="${build}" manifest="${src}/META-INF/MANIFEST.MF">
10585
<manifest>
106-
<attribute name="Bundle-Version" value="${bundleversion}${build.number}${appendix}"/>
10786
<attribute name="Built-Date" value="${NOW}"/>
10887
<attribute name="Bundle-SymbolicName" value="${bundlename}"/>
88+
<attribute name="Bundle-Version" value="${bundleversion}"/>
10989

11090
</manifest>
11191
</jar>
11292

113-
114-
115-
<!-- copy the tlds necessary
116-
<loadfile property="content1" srcFile="${tld}/tag.tld" />
117-
<replace haystack="${content1}" needle="{bundle-name}" repl="${bundlename}" property="content2"/>
118-
<replace haystack="${content2}" needle="{bundle-version}" repl="${bundleversion}${build.number}${appendix}" property="content3"/>
119-
<echo message="${content3}" file="${dist}/extension/tlds/pdftag.tld"/>
120-
-->
121-
12293
<!-- copy the flds necessary -->
123-
<loadfile property="c1" srcFile="${fld}/function.fld" />
124-
<replace haystack="${c1}" needle="{bundle-name}" repl="${bundlename}" property="c2"/>
125-
<replace haystack="${c2}" needle="{bundle-version}" repl="${bundleversion}${build.number}${appendix}" property="c3"/>
126-
<echo message="${c3}" file="${dist}/extension/flds/argon2-functions.fld"/>
94+
<copy
95+
file="${fld}/function.fld"
96+
tofile="${dist}/extension/flds/argon2-functions.fld" />
97+
98+
<replaceregexp
99+
file="${dist}/extension/flds/argon2-functions.fld"
100+
match="\{bundle-name\}"
101+
replace="${bundlename}"
102+
byline="true"/>
103+
<replaceregexp
104+
file="${dist}/extension/flds/argon2-functions.fld"
105+
match="\{bundle-version\}"
106+
replace="${bundleversion}"
107+
byline="true"/>
127108

128109

129-
130-
<!-- copy the context necessary
131-
<copy todir="${dist}/extension/webcontexts">
132-
<fileset dir="${context}">
133-
<include name="**/*.*"/>
134-
</fileset>
135-
</copy> -->
136-
137110
<!-- copy the jars necessary -->
138111
<copy todir="${dist}/extension/jars">
139112
<fileset dir="${lib}">
@@ -161,7 +134,7 @@ start-bundles: false
161134
</copy>
162135

163136
<!-- Zip everything -->
164-
<zip destfile="${dist}/${filename}-${bundleversion}${build.number}${appendix}.lex">
137+
<zip destfile="${dist}/${filename}-${bundleversion}.lex">
165138
<zipfileset dir="${dist}/extension"/>
166139
</zip>
167140

maven-settings.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<pluginGroups></pluginGroups>
6+
<proxies></proxies>
7+
<servers>
8+
<server>
9+
<id>ossrh</id>
10+
<username>${env.MAVEN_USERNAME}</username>
11+
<password>${env.MAVEN_PASSWORD}</password>
12+
</server>
13+
</servers>
14+
<mirrors></mirrors>
15+
<profiles>
16+
<profile>
17+
<id>ossrh</id>
18+
<activation>
19+
<activeByDefault>true</activeByDefault>
20+
</activation>
21+
<properties>
22+
<gpg.executable>gpg2</gpg.executable>
23+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
24+
</properties>
25+
</profile>
26+
</profiles>
27+
</settings>

0 commit comments

Comments
 (0)