Skip to content

Commit

Permalink
Convert to Github actions, update webpack, remove references to x-res…
Browse files Browse the repository at this point in the history
…ourceId
  • Loading branch information
jclausen committed Nov 10, 2022
1 parent 97f7040 commit 3ea449e
Show file tree
Hide file tree
Showing 21 changed files with 27,869 additions and 11,466 deletions.
208 changes: 208 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
name: relax CI

# Only on Development we build snapshots
on:
push:
branches:
- development
- master

env:
MODULE_ID: relax

jobs:
#############################################
# Tests First baby! We fail, no build :(
#############################################
tests:
name: Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"

- name: Cache CommandBox Dependencies
uses: actions/cache@v1
if: ${{ true }}
with:
path: ~/.CommandBox/artifacts
key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
restore-keys: |
${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
- name: Setup CommandBox
uses: elpete/setup-commandbox@v1.0.0

- name: Install Test Harness Dependencies
working-directory: ./test-harness
run: |
box install
- name: Start ${{ matrix.cfengine }} Server
working-directory: ./test-harness
run: |
echo "matrix.cfengine=${{ matrix.cfengine }}" > ./.env
box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug
# Install Adobe 2021 cfpm modules
if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then
box run-script install:2021
fi
curl http://127.0.0.1:60299
- name: Run Tests
working-directory: ./test-harness
run: |
mkdir tests/results
box package set testbox.runner="http://localhost:60299/tests/runner.cfm"
box testbox run --verbose outputFile=tests/results/test-results outputFormats=json,antjunit
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: test-harness/tests/results/**/*.xml
check_name: "${{ matrix.cfengine }} Test Results"

- name: Upload Test Results Artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-${{ matrix.cfengine }}
path: |
test-harness/tests/results/**/*
- name: Slack Notification
if: failure()
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: '${{ env.MODULE_ID }} tests failed :cry:'
SLACK_TITLE: ${{ env.MODULE_ID }} Tests For ${{ matrix.cfengine }} failed
SLACK_USERNAME: CI
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Failure Debugging Info
if: ${{ failure() }}
working-directory: ./test-harness
run: |
box server log serverConfigFile="server-${{ matrix.cfengine }}.json"
- name: Upload Debugging Info To Artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: Failure Debugging Info - ${{ matrix.cfengine }}
path: |
test-harness/.engine/**/logs/*
test-harness/.engine/**/WEB-INF/cfusion/logs/*
#############################################
# Build Module
#############################################
build:
name: Build & Publish
needs: tests
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"

- name: Cache CommandBox Dependencies
uses: actions/cache@v1
if: ${{ true }}
with:
path: ~/.CommandBox/artifacts
key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
restore-keys: |
${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
- name: Setup CommandBox
uses: elpete/setup-commandbox@v1.0.0
with:
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}

- name: Setup Environment Variables For Build Process
id: current_version
run: |
echo "VERSION=`cat box.json | jq '.version' -r`" >> $GITHUB_ENV
box package set version=@build.version@+@build.number@
# master or snapshot
echo "Github Ref is $GITHUB_REF"
echo "BRANCH=master" >> $GITHUB_ENV
if [ $GITHUB_REF == 'refs/heads/development' ]
then
echo "BRANCH=development" >> $GITHUB_ENV
fi
- name: Build ${{ env.MODULE_ID }}
run: |
box install commandbox-docbox
box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }}
- name: Upload Build Artifacts
if: success()
uses: actions/upload-artifact@v2
with:
name: ${{ env.MODULE_ID }}
path: |
.artifacts/**/*
- name: Upload Binaries to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: "downloads.ortussolutions.com"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
SOURCE_DIR: ".artifacts/${{ env.MODULE_ID }}"
DEST_DIR: "ortussolutions/coldbox-modules/${{ env.MODULE_ID }}"

- name: Upload API Docs to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: "apidocs.ortussolutions.com"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
SOURCE_DIR: ".tmp/apidocs"
DEST_DIR: "coldbox-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"

- name: Publish To ForgeBox
run: |
cd .tmp/${{ env.MODULE_ID }}
cat box.json
box forgebox publish
- name: Inform Slack
if: ${{ always() }}
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: '${{ env.MODULE_ID }} Built with ${{ job.status }}!'
SLACK_TITLE: "${{ env.MODULE_ID }} Build"
SLACK_USERNAME: CI
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
98 changes: 98 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Pull Requests

on:
push:
branches-ignore:
- "main"
- "master"
- "development"
pull_request:
branches:
- development

jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
env:
DB_USER: root
DB_PASSWORD: root
strategy:
fail-fast: true
matrix:
cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"

- name: Setup CommandBox
uses: elpete/setup-commandbox@v1.0.0

- name: Install Test Harness Dependencies
working-directory: ./test-harness
run: |
box install
- name: Start ${{ matrix.cfengine }} Server
working-directory: ./test-harness
run: |
echo "matrix.cfengine=${{ matrix.cfengine }}" > ./.env
box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug
# Install Adobe 2021 cfpm modules
if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then
box run-script install:2021
fi
curl http://127.0.0.1:60299
- name: Run Tests
working-directory: ./test-harness
run: |
mkdir tests/results
box package set testbox.runner="http://localhost:60299/tests/runner.cfm"
box testbox run --verbose outputFile=tests/results/test-results outputFormats=json,antjunit
- name: Publish PR Test Reports
uses: mikepenz/action-junit-report@v2
with:
report_paths: 'test-harness/tests/results/**/*.xml'
check_name: "${{ matrix.cfengine }} Test Results"
summary: true

- name: Failure Debugging Info
if: ${{ failure() }}
working-directory: ./test-harness
run: |
box server log serverConfigFile="server-${{ matrix.cfengine }}.json"
format:
name: Format
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"

- name: Set Up CommandBox
uses: elpete/setup-commandbox@v1.0.0

- name: Install CFFormat
run: box install commandbox-cfformat

- name: Run CFFormat
run: box run-script format

- name: Commit Format Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply cfformat changes
6 changes: 3 additions & 3 deletions Developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ box install

Then change directory to the `test-harness` directory and re-run `box install` to seed the coldbox application. Once dependencies are installed and assets are compiled ( see below ), you can start the following servers from within the `test-harness` directory to browse the application:

- `box server start name=lucee@5`
- `box server start name=adobe@2016`
- `box server start name=adobe@2018`
- `box server start serverconfigFile=server-lucee@5.json`
- `box server start serverconfigFile=server-adobe@2018.json`
- `box server start serverconfigFile=server-adobe@2018.json`


To compile the packed assets you can use the following webpack commands:
Expand Down
2 changes: 1 addition & 1 deletion box.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"dependencies":{
"cbjavaloader":"^2",
"cbswagger":"^2",
"cbswagger":"be",
"wikitext":"^1.3"
},
"ignore":[
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions build/Build.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ component{
// Create project mapping
fileSystemUtil.createMapping( arguments.projectName, variables.cwd );

// Run the tests
runTests();

// Build the source
buildSource( argumentCollection=arguments );

Expand Down
Loading

0 comments on commit 3ea449e

Please sign in to comment.