From 28e19462652df1b8c0dc3fc922c1ba8e102b2212 Mon Sep 17 00:00:00 2001 From: jclausen Date: Sat, 29 Apr 2023 12:51:10 -0400 Subject: [PATCH] add 2023 tests --- .github/workflows/ci.yml | 6 +- .github/workflows/tests.yml | 120 ++++++++++++++++++++++++++++ test-harness/server-adobe@2023.json | 23 ++++++ 3 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml create mode 100644 test-harness/server-adobe@2023.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba1d11d..bbbc77d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,10 @@ env: jobs: tests: + uses: ./.github/workflows/tests.yml + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + name: Tests runs-on: ubuntu-20.04 env: @@ -36,7 +40,7 @@ jobs: - name: Setup CommandBox uses: elpete/setup-commandbox@v1.0.0 - + - name: Setup Elasticsearch run: | diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f9240e1 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,120 @@ +name: Test Suites + +# We are a reusable Workflow only +on: + workflow_call: + secrets: + SLACK_WEBHOOK_URL: + required: true + +jobs: + tests: + name: Tests + runs-on: ubuntu-20.04 + env: + ELASTICSEARCH_PROTOCOL: http + ELASTICSEARCH_HOST: 127.0.0.1 + ELASTICSEARCH_PORT: 9200 + continue-on-error: ${{ matrix.experimental }} + strategy: + matrix: + cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ] + ELASTICSEARCH_VERSION: [ "7.17.8", "8.6.1" ] + experimental: [false] + include: + - cfengine: "adobe@2023" + ELASTICSEARCH_VERSION: "8.6.1" + experimental: true + steps: + - name: Checkout Repository + uses: actions/checkout@v3.2.0 + + - name: Setup Java + uses: actions/setup-java@v3.9.0 + with: + distribution: "temurin" + java-version: "11" + + - name: Setup CommandBox CLI + uses: Ortus-Solutions/setup-commandbox@v2.0.1 + + - name: Install Dependencies + run: | + box run-script harness:install + + - name: Install Node 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Compile Release Static assets + run: | + npm install && npm run prod + cd $GITHUB_WORKSPACE + + - name: Setup Elasticsearch + run: | + docker run -d -p "${{ env.ELASTICSEARCH_PORT }}:9200" -v $PWD/build/resources/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml elasticsearch:${{ matrix.ELASTICSEARCH_VERSION }} + rm -rf test-harness/modules_app + + - name: Start ${{ matrix.cfengine }} Server + env: + ENVIRONMENT: development + run: | + cd test-harness + box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug + cd ../ + curl http://127.0.0.1:60299 + + - name: Run Tests + env: + ENVIRONMENT: development + run: | + mkdir -p test-harness/tests/results + box package set testbox.runner="http://127.0.0.1:60299/tests/runner.cfm?seed=true" + box testbox run --verbose outputFile=test-harness/tests/results/test-results outputFormats=json,antjunit + ls -lR test-harness/tests + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + junit_files: test-harness/tests/results/**/*.xml + check_name: "${{ matrix.cfengine }} Test Results" + + - name: Upload Test Results to Artifacts + if: always() + uses: actions/upload-artifact@v3.1.1 + with: + name: test-results-${{ matrix.cfengine }} + path: | + test-harness/tests/results/**/* + + - name: Failure Debugging Log + if: ${{ failure() }} + run: | + cd test-harness + box server log serverConfigFile="server-${{ matrix.cfengine }}.json" + cd ../ + + - name: Upload Debugging Log To Artifacts + if: ${{ failure() }} + uses: actions/upload-artifact@v3.1.1 + with: + name: Failure Debugging Info - ${{ matrix.cfengine }} + path: | + test-harness/.engine/**/logs/* + test-harness/.engine/**/WEB-INF/cfusion/logs/* + + - name: Slack Notifications + # Only on failures and NOT in pull requests + if: ${{ failure() && !startsWith( 'pull_request', github.event_name ) }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: coding + SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' + SLACK_ICON_EMOJI: ":bell:" + SLACK_MESSAGE: '${{ github.repository }} tests failed :cry:' + SLACK_TITLE: ${{ github.repository }} Tests For ${{ matrix.cfengine }} failed + SLACK_USERNAME: CI + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/test-harness/server-adobe@2023.json b/test-harness/server-adobe@2023.json new file mode 100644 index 0000000..5df4014 --- /dev/null +++ b/test-harness/server-adobe@2023.json @@ -0,0 +1,23 @@ +{ + "name":"logstash-adobe@2023", + "app":{ + "serverHomeDirectory":"./.engine/adobe2023", + "cfengine":"adobe@2023.0.0-beta.1" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "aliases":{ + "/moduleroot/stachebox/includes":"../includes", + "/stachebox/includes":"../includes" + } + }, + "openBrowser":"false", + "scripts":{ + "onServerInstall":"cfpm install zip,document,feed" + } +} \ No newline at end of file