From efeef58eb215d85cbd1e2bf50b51f32614a3bb1d Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Sat, 8 Jun 2024 12:22:56 +0200 Subject: [PATCH] add lucee-spreadsheet --- .github/workflows/lucee-spreadsheet.yml | 73 +++++++++++++++++++++++ custom/lucee-cfspreadsheet/test/index.cfm | 39 ++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 .github/workflows/lucee-spreadsheet.yml create mode 100644 custom/lucee-cfspreadsheet/test/index.cfm diff --git a/.github/workflows/lucee-spreadsheet.yml b/.github/workflows/lucee-spreadsheet.yml new file mode 100644 index 0000000..5099254 --- /dev/null +++ b/.github/workflows/lucee-spreadsheet.yml @@ -0,0 +1,73 @@ +name: Run lucee-spreadsheet test suite + +on: + [ workflow_dispatch, workflow_call ] + +jobs: + setup-lucee-spreadsheet: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout lucee-spreadsheet Repository + uses: actions/checkout@v4 + with: + repository: cfsimplicity/spreadsheet-cfml + path: src + - name: Copy custom test runner tweaks + run: | + cp -R custom/lucee-spreadsheet src + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + - name: Install the ortus security key + run: curl -fsSl https://downloads.ortussolutions.com/debs/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/ortussolutions.gpg > /dev/null + + - name: Add the commandbox source + run: echo "deb [signed-by=/usr/share/keyrings/ortussolutions.gpg] https://downloads.ortussolutions.com/debs/noarch /" | sudo tee /etc/apt/sources.list.d/commandbox.list + + - name: Update apt and install commandbox + run: sudo apt-get update && sudo apt-get install apt-transport-https commandbox + + - name: Install dependencies + run: | + cd src + box install + - name: installed webroot for matrix steps + uses: actions/upload-artifact@v4 + with: + name: webroot + path: ${{ github.workspace }}/src + + tests: + runs-on: ubuntu-latest + needs: [ setup-lucee-spreadsheet ] + strategy: + fail-fast: false + matrix: + luceeVersion: [ 5.4/snapshot/jar, 6.0/snapshot/jar, 6.1/snapshot/jar ] + javaVersion: [ 11, 21 ] + exclude: + - luceeVersion: 5.4/snapshot/jar + javaVersion: 21 + - luceeVersion: 6.0/snapshot/jar + javaVersion: 21 + steps: + - name: Restore pre-prepared webroot + uses: actions/download-artifact@v4 + with: + name: webroot + path: ${{ github.workspace }} + - name: Set up JDK ${{matrix.javaVersion}} + uses: actions/setup-java@v4 + with: + java-version: ${{matrix.javaVersion}} + distribution: 'temurin' + - name: Run Test Suite + uses: lucee/script-runner@main + with: + webroot: ${{ github.workspace }}/test + execute: /index.cfm + luceeVersionQuery: ${{ matrix.luceeVersion }} diff --git a/custom/lucee-cfspreadsheet/test/index.cfm b/custom/lucee-cfspreadsheet/test/index.cfm new file mode 100644 index 0000000..84d79f0 --- /dev/null +++ b/custom/lucee-cfspreadsheet/test/index.cfm @@ -0,0 +1,39 @@ + + paths = [ "root.test.suite" ]; + try{ + setting requesttimeout=10000; + testRunner = New testbox.system.TestBox(); + result = testRunner.runRaw( bundles=paths ); + reporter = testRunner.buildReporter( "text" ); + try { + report = reporter.runReport( results=result, testbox=testRunner, justReturn=true ); + } catch (e) { + systemOutput(e, true); + } + failure = ( result.getTotalFail() + result.getTotalError() ) > 0; + + headline = "Lucee #server.lucee.version# / Java #server.java.version#"; + + if ( structKeyExists( server.system.environment, "GITHUB_STEP_SUMMARY" ) ){ + fileWrite( server.system.environment.GITHUB_STEP_SUMMARY, "## #(failure?':x:':':heavy_check_mark:')#" & headline & chr(10) ); + //fileAppend( server.system.environment.GITHUB_STEP_SUMMARY, report ); + } else { + systemOutput( headline, true ); + } + systemOutput( report, true ); + + if ( failure ) { + error = "TestBox could not successfully execute all testcases: #result.getTotalFail()# tests failed; #result.getTotalError()# tests errored."; + if ( structKeyExists( server.system.environment, "GITHUB_STEP_SUMMARY" ) ){ + fileAppend( server.system.environment.GITHUB_STEP_SUMMARY, chr(10) & "#### " & error ); + } else { + systemOutput( error, true ); + } + throw error; + } + } + catch( any exception ){ + systemOutput( exception, true ); + rethrow; + } + \ No newline at end of file