Skip to content

Commit

Permalink
add default-cfconfig test
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jun 24, 2024
1 parent 72a2791 commit 24f031e
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/default-cfconfig.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Check Default .CFConfig

on:
workflow_dispatch:
inputs:
compile:
required: false
default: false
type: boolean
workflow_call:

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
luceeVersion:
[
6.0/snapshot/jar,
6.1/snapshot/jar,
6.1.0/snapshot/jar,
6.2/snapshot/jar,
]
javaVersion: [ 11 ]
env:
luceeVersionQuery: ${{ matrix.luceeVersion }}
compile: ${{ github.event.inputs.compile }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{matrix.javaVersion}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.javaVersion}}
distribution: "temurin"
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: maven-cache
- name: Cache Lucee files
uses: actions/cache@v4
with:
path: /home/runner/work/_actions/lucee/script-runner/main/lucee-download-cache
key: lucee-downloads
- name: Save Default .CFConfig.json
uses: lucee/script-runner@main
with:
webroot: ${{ github.workspace }}/custom/default-cfconfig
execute: /saveDefault.cfm
luceeVersionQuery: ${{ matrix.luceeVersion }}
- name: Save Default .CFConfig.json
uses: lucee/script-runner@main
with:
webroot: ${{ github.workspace }}/custom/default-cfconfig
execute: /compareDefault.cfm
luceeVersionQuery: ${{ matrix.luceeVersion }}
env:
LUCEE_BASE_CONFIG: ${{ github.workspace }}/custom/default-cfconfig/.CFConfig-empty.json

1 change: 1 addition & 0 deletions custom/default-cfconfig/.CFConfig-empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
18 changes: 18 additions & 0 deletions custom/default-cfconfig/compareDefault.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<cfscript>
default = fileRead( expandPath( "./.CFConfig-default.json" ) ).toJson();
empty = fileRead( expandPath('{lucee-config}.CFConfig.json') ).toJson();
for ( cfc in default ){
if (!structKeyExists( empty, cfg ) ){
systemOutput("", true );
systemOutput("#cfg# missing in empty .CFConfig.json", true );
} else {
if ( empty[cfg].toJson() neq default[cfg].toJson() ){
systemOutput("", true );
systemOutput("#cfg# is different!", true );
systemOutput("#chr(9)# empty : #empty[cfg].toJson()# ", true );
systemOutput("#chr(9)# default: #default[cfg].toJson()# ", true );
}
}
}
</cfscript>
4 changes: 4 additions & 0 deletions custom/default-cfconfig/saveDefault.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<cfscript>
default = fileRead( expandPath('{lucee-config}.CFConfig.json') );
fileWrite( expandPath("./.CFConfig-default.json"), default )
</cfscript>

0 comments on commit 24f031e

Please sign in to comment.