Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 59 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
name: Java CI Combined

on: [push, pull_request, workflow_dispatch]
on:
push:
pull_request:
workflow_dispatch:
inputs:
lucee-versions:
description: 'JSON array of Lucee versions to test'
default: '["7.0/snapshot/light","7.0/stable/light","6.2/snapshot/light","6.2/stable/light"]'
dry-run:
description: 'Dry run - skip deploy to Maven'
type: boolean
default: false

jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.VERSION }}
lucee-matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -31,6 +43,16 @@ jobs:
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Set Lucee test matrix
id: set-matrix
run: |
DEFAULT='["7.0/snapshot/light","7.0/stable/light","6.2/snapshot/light","6.2/stable/light"]'
MATRIX="${{ inputs.lucee-versions || '' }}"
if [ -z "$MATRIX" ]; then
MATRIX="$DEFAULT"
fi
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT

- name: Cache Lucee files
uses: actions/cache@v4
with:
Expand All @@ -43,23 +65,9 @@ jobs:
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

build-and-test:
build:
runs-on: ubuntu-latest
needs: setup
env:
testLabels: image
testAdditional: ${{ github.workspace }}/tests
LUCEE_TEST_VERSIONS_JAKARTA: ${{ vars.LUCEE_TEST_VERSIONS_JAKARTA }}
strategy:
fail-fast: false
matrix:
lucee: ${{ fromJSON(vars.LUCEE_TEST_VERSIONS_JAKARTA) }}
java: [ 11, 21 ]
services:
minio:
image: fclairamb/minio-github-actions
ports:
- 9000:9000
steps:
- uses: actions/checkout@v4

Expand All @@ -69,6 +77,14 @@ jobs:
java-version: '11'
distribution: 'adopt'

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build and Install with Maven
run: |
echo "------- Maven Install -------";
Expand All @@ -77,9 +93,31 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: image-lex-${{ matrix.lucee.version }}-${{ matrix.java }}
name: image-lex
path: target/*.lex

test:
runs-on: ubuntu-latest
needs: [setup, build]
strategy:
fail-fast: false
matrix:
lucee: ${{ fromJSON(needs.setup.outputs.lucee-matrix) }}
java: [ 11, 21 ]
services:
minio:
image: fclairamb/minio-github-actions
ports:
- 9000:9000
steps:
- uses: actions/checkout@v4

- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: image-lex
path: target

- name: Checkout Lucee
uses: actions/checkout@v4
with:
Expand All @@ -97,8 +135,7 @@ jobs:
with:
webroot: ${{ github.workspace }}/lucee/test
execute: /bootstrap-tests.cfm
luceeVersion: ${{ matrix.lucee.version }}
luceeVersionQuery: ${{ matrix.lucee.query }}
luceeVersion: ${{ matrix.lucee }}
extensionDir: ${{ github.workspace }}/target
env:
testLabels: image
Expand All @@ -108,8 +145,8 @@ jobs:

deploy:
runs-on: ubuntu-latest
needs: [setup, build-and-test]
if: always() && needs.build-and-test.result == 'success'
needs: [setup, test]
if: always() && needs.test.result == 'success' && github.ref == 'refs/heads/master' && !inputs.dry-run
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -146,4 +183,4 @@ jobs:
else
echo "------- Maven Deploy release on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml
fi
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ WEB-INF
*.iml
*.ipr
*.iws
test-output/
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,11 @@ private String touchDestination() throws IOException, PageException {
destination = folder.getRealResource(name);
cleanOld(folder);

// create path
String cp = pageContext.getHttpServletRequest().getContextPath();
// create path (use reflection to avoid jakarta/javax bytecode binding)
Object req = eng.getClassUtil().callMethod(pageContext,
eng.getCastUtil().toKey("getHttpServletRequest"), new Object[] {});
String cp = (String) eng.getClassUtil().callMethod(req,
eng.getCastUtil().toKey("getContextPath"), new Object[] {});
if (eng.getStringUtil().isEmpty(cp))
cp = "";
return cp + "/lucee/graph.cfm?img=" + name + "&type="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,11 @@ private String touchDestination() throws IOException, PageException {
destination = folder.getRealResource(name);
cleanOld(folder);

// create path
String cp = pageContext.getHttpServletRequest().getContextPath();
// create path (use reflection to avoid jakarta/javax bytecode binding)
Object req = eng.getClassUtil().callMethod(pageContext,
eng.getCastUtil().toKey("getHttpServletRequest"), new Object[] {});
String cp = (String) eng.getClassUtil().callMethod(req,
eng.getCastUtil().toKey("getContextPath"), new Object[] {});
if (eng.getStringUtil().isEmpty(cp)) cp = "";
return cp + "/lucee/graph.cfm?img=" + name + "&type=" + (eng.getListUtil().last(ImageUtil.getMimeTypeFromFormat(format), "/", true).trim());
}
Expand Down
22 changes: 22 additions & 0 deletions tests/LDEV6157.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="image" {

function run( testResults, testBox ) {
describe( "LDEV-6157 cfimage jakarta/javax compat", function() {

it( title="cfimage action=writeToBrowser should not throw jakarta error on Lucee 6", body=function() {
local.result = _internalRequest(
template: "#createURI( 'LDEV6157' )#/LDEV6157.cfm"
);
expect( result.filecontent.trim() ).toInclude( "<img " );
});

});
}

private string function createURI( string calledName, boolean contract=true ) {
var base = getDirectoryFromPath( getCurrentTemplatePath() );
var baseURI = contract ? contractPath( base ) : "/test/#listLast( base, '\/' )#";
return baseURI & "/" & calledName;
}

}
2 changes: 2 additions & 0 deletions tests/LDEV6157/LDEV6157.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<cfset img = imageNew( "", 100, 100, "rgb", "red" )>
<cfimage action="writeToBrowser" source="#img#" format="png">
Loading