diff --git a/.github/workflows/default-cfconfig.yml b/.github/workflows/default-cfconfig.yml new file mode 100644 index 0000000..897271e --- /dev/null +++ b/.github/workflows/default-cfconfig.yml @@ -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 + diff --git a/custom/default-cfconfig/.CFConfig-empty.json b/custom/default-cfconfig/.CFConfig-empty.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/custom/default-cfconfig/.CFConfig-empty.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/custom/default-cfconfig/compareDefault.cfm b/custom/default-cfconfig/compareDefault.cfm new file mode 100644 index 0000000..046b965 --- /dev/null +++ b/custom/default-cfconfig/compareDefault.cfm @@ -0,0 +1,18 @@ + + 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 ); + } + } + } + \ No newline at end of file diff --git a/custom/default-cfconfig/saveDefault.cfm b/custom/default-cfconfig/saveDefault.cfm new file mode 100644 index 0000000..4a95989 --- /dev/null +++ b/custom/default-cfconfig/saveDefault.cfm @@ -0,0 +1,4 @@ + + default = fileRead( expandPath('{lucee-config}.CFConfig.json') ); + fileWrite( expandPath("./.CFConfig-default.json"), default ) + \ No newline at end of file