Skip to content

Commit f8f3eff

Browse files
committed
Merge branch 'development'
2 parents 6432d11 + 8ace348 commit f8f3eff

File tree

11 files changed

+349
-12
lines changed

11 files changed

+349
-12
lines changed

.github/workflows/ci.yml

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: cbvalidation CI
2+
3+
# Only on Development we build snapshots
4+
on:
5+
push:
6+
branches:
7+
- development
8+
- master
9+
10+
env:
11+
MODULE_ID: cbvalidation
12+
13+
jobs:
14+
#############################################
15+
# Tests First baby! We fail, no build :(
16+
#############################################
17+
tests:
18+
name: Tests
19+
runs-on: ubuntu-20.04
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
cfengine: [ "lucee@5", "adobe@2016", "adobe@2018", "adobe@2021" ]
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v2
27+
28+
- name: Setup Java
29+
uses: actions/setup-java@v2
30+
with:
31+
distribution: "adopt"
32+
java-version: "11"
33+
34+
- name: Cache CommandBox Dependencies
35+
uses: actions/cache@v1
36+
if: ${{ true }}
37+
with:
38+
path: ~/.CommandBox/artifacts
39+
key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
40+
restore-keys: |
41+
${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
42+
43+
- name: Setup CommandBox
44+
uses: elpete/[email protected]
45+
46+
- name: Install Test Harness Dependencies
47+
working-directory: ./test-harness
48+
run: |
49+
box install
50+
51+
- name: Start ${{ matrix.cfengine }} Server
52+
working-directory: ./test-harness
53+
run: |
54+
box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug
55+
# Install Adobe 2021 cfpm modules
56+
if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then
57+
box run-script install:2021
58+
fi
59+
curl http://127.0.0.1:60299
60+
61+
- name: Run Tests
62+
working-directory: ./test-harness
63+
run: |
64+
mkdir tests/results
65+
box package set testbox.runner="http://localhost:60299/tests/runner.cfm"
66+
box testbox run --verbose outputFile=tests/results/test-results outputFormats=json,antjunit
67+
68+
- name: Publish Test Results
69+
uses: EnricoMi/publish-unit-test-result-action@v1
70+
if: always()
71+
with:
72+
files: test-harness/tests/results/**/*.xml
73+
check_name: "${{ matrix.cfengine }} Test Results"
74+
75+
- name: Upload Test Results Artifacts
76+
if: always()
77+
uses: actions/upload-artifact@v2
78+
with:
79+
name: test-results-${{ matrix.cfengine }}
80+
path: |
81+
test-harness/tests/results/**/*
82+
83+
- name: Slack Notification
84+
if: failure()
85+
uses: rtCamp/action-slack-notify@v2
86+
env:
87+
SLACK_CHANNEL: coding
88+
SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff'
89+
SLACK_ICON_EMOJI: ":bell:"
90+
SLACK_MESSAGE: '${{ env.MODULE_ID }} tests failed :cry:'
91+
SLACK_TITLE: ${{ env.MODULE_ID }} Tests For ${{ matrix.cfengine }} failed
92+
SLACK_USERNAME: CI
93+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
94+
95+
- name: Failure Debugging Info
96+
if: ${{ failure() }}
97+
working-directory: ./test-harness
98+
run: |
99+
box server log serverConfigFile="server-${{ matrix.cfengine }}.json"
100+
101+
- name: Upload Debugging Info To Artifacts
102+
if: ${{ failure() }}
103+
uses: actions/upload-artifact@v2
104+
with:
105+
name: Failure Debugging Info - ${{ matrix.cfengine }}
106+
path: |
107+
test-harness/.engine/**/logs/*
108+
test-harness/.engine/**/WEB-INF/cfusion/logs/*
109+
110+
#############################################
111+
# Build Module
112+
#############################################
113+
build:
114+
name: Build & Publish
115+
needs: tests
116+
runs-on: ubuntu-20.04
117+
steps:
118+
- name: Checkout Repository
119+
uses: actions/checkout@v2
120+
with:
121+
fetch-depth: 0
122+
123+
- name: Setup Java
124+
uses: actions/setup-java@v2
125+
with:
126+
distribution: "adopt"
127+
java-version: "11"
128+
129+
- name: Cache CommandBox Dependencies
130+
uses: actions/cache@v1
131+
if: ${{ true }}
132+
with:
133+
path: ~/.CommandBox/artifacts
134+
key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
135+
restore-keys: |
136+
${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }}
137+
138+
- name: Setup CommandBox
139+
uses: elpete/[email protected]
140+
with:
141+
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
142+
143+
- name: Setup Environment Variables For Build Process
144+
id: current_version
145+
run: |
146+
echo "VERSION=`cat box.json | jq '.version' -r`" >> $GITHUB_ENV
147+
148+
# master or snapshot
149+
echo "Github Ref is $GITHUB_REF"
150+
echo "BRANCH=master" >> $GITHUB_ENV
151+
if [ $GITHUB_REF == 'refs/heads/development' ]
152+
then
153+
echo "BRANCH=development" >> $GITHUB_ENV
154+
fi
155+
156+
- name: Build ${{ env.MODULE_ID }}
157+
run: |
158+
box install commandbox-docbox
159+
box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }}
160+
161+
- name: Upload Build Artifacts
162+
if: success()
163+
uses: actions/upload-artifact@v2
164+
with:
165+
name: ${{ env.MODULE_ID }}
166+
path: |
167+
.artifacts/**/*
168+
169+
- name: Upload Binaries to S3
170+
uses: jakejarvis/s3-sync-action@master
171+
with:
172+
args: --acl public-read
173+
env:
174+
AWS_S3_BUCKET: "downloads.ortussolutions.com"
175+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
176+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
177+
SOURCE_DIR: ".artifacts/${{ env.MODULE_ID }}"
178+
DEST_DIR: "ortussolutions/coldbox-modules/${{ env.MODULE_ID }}"
179+
180+
- name: Upload API Docs to S3
181+
uses: jakejarvis/s3-sync-action@master
182+
with:
183+
args: --acl public-read
184+
env:
185+
AWS_S3_BUCKET: "apidocs.ortussolutions.com"
186+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
187+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }}
188+
SOURCE_DIR: ".tmp/apidocs"
189+
DEST_DIR: "coldbox-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}"
190+
191+
- name: Publish To ForgeBox
192+
run: |
193+
cd .tmp/${{ env.MODULE_ID }}
194+
cat box.json
195+
box forgebox publish
196+
197+
- name: Inform Slack
198+
if: ${{ always() }}
199+
uses: rtCamp/action-slack-notify@v2
200+
env:
201+
SLACK_CHANNEL: coding
202+
SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff'
203+
SLACK_ICON_EMOJI: ":bell:"
204+
SLACK_MESSAGE: '${{ env.MODULE_ID }} Built with ${{ job.status }}!'
205+
SLACK_TITLE: "${{ env.MODULE_ID }} Build"
206+
SLACK_USERNAME: CI
207+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/pr.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Pull Requests
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- "main"
7+
- "master"
8+
- "development"
9+
pull_request:
10+
branches:
11+
- development
12+
13+
jobs:
14+
tests:
15+
name: Tests
16+
runs-on: ubuntu-20.04
17+
env:
18+
DB_USER: root
19+
DB_PASSWORD: root
20+
strategy:
21+
fail-fast: true
22+
matrix:
23+
cfengine: [ "lucee@5", "adobe@2016", "adobe@2018", "adobe@2021" ]
24+
steps:
25+
- name: Checkout Repository
26+
uses: actions/checkout@v2
27+
28+
- name: Setup Java
29+
uses: actions/setup-java@v2
30+
with:
31+
distribution: "adopt"
32+
java-version: "11"
33+
34+
- name: Setup CommandBox
35+
uses: elpete/[email protected]
36+
37+
- name: Install Test Harness Dependencies
38+
working-directory: ./test-harness
39+
run: |
40+
box install
41+
42+
- name: Start ${{ matrix.cfengine }} Server
43+
working-directory: ./test-harness
44+
run: |
45+
box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug
46+
curl http://127.0.0.1:60299
47+
48+
- name: Run Tests
49+
working-directory: ./test-harness
50+
run: |
51+
mkdir tests/results
52+
box package set testbox.runner="http://localhost:60299/tests/runner.cfm"
53+
box testbox run --verbose outputFile=tests/results/test-results outputFormats=json,antjunit
54+
55+
- name: Publish PR Test Reports
56+
uses: mikepenz/action-junit-report@v2
57+
with:
58+
report_paths: 'test-harness/tests/results/**/*.xml'
59+
check_name: "${{ matrix.cfengine }} Test Results"
60+
summary: true
61+
62+
- name: Failure Debugging Info
63+
if: ${{ failure() }}
64+
working-directory: ./test-harness
65+
run: |
66+
box server log serverConfigFile="server-${{ matrix.cfengine }}.json"
67+
68+
format:
69+
name: Format
70+
runs-on: ubuntu-20.04
71+
steps:
72+
- name: Checkout Repository
73+
uses: actions/checkout@v2
74+
75+
- name: Setup Java
76+
uses: actions/setup-java@v2
77+
with:
78+
distribution: "adopt"
79+
java-version: "11"
80+
81+
- name: Set Up CommandBox
82+
uses: elpete/[email protected]
83+
84+
- name: Install CFFormat
85+
run: box install commandbox-cfformat
86+
87+
- name: Run CFFormat
88+
run: box run-script format
89+
90+
- name: Commit Format Changes
91+
uses: stefanzweifel/git-auto-commit-action@v4
92+
with:
93+
commit_message: Apply cfformat changes

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.artifacts/**
44
.tmp/**
5-
modules/**
65

76
test-harness/.engine/**
7+
test-harness/.env
88
test-harness/coldbox/**
99
test-harness/docbox/**
1010
test-harness/testbox/**
File renamed without changes.

build/Build.cfc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ component {
1717

1818
// Source Excludes Not Added to final binary
1919
variables.excludes = [
20-
".gitignore",
21-
".travis.yml",
22-
".artifacts",
23-
".tmp",
2420
"build",
21+
"node-modules",
22+
"resources",
2523
"test-harness",
26-
".DS_Store",
27-
".git"
24+
"(package|package-lock).json",
25+
"webpack.config.js",
26+
"^\..*"
2827
];
2928

3029
// Cleanup + Init Build Directories
@@ -65,9 +64,6 @@ component {
6564
// Create project mapping
6665
fileSystemUtil.createMapping( arguments.projectName, variables.cwd );
6766

68-
// Run the tests
69-
runTests();
70-
7167
// Build the source
7268
buildSource( argumentCollection = arguments );
7369

@@ -99,7 +95,8 @@ component {
9995
.params(
10096
runner = variables.testRunner,
10197
verbose = true,
102-
outputFile = "build/results.json"
98+
outputFile = "#variables.cwd#/test-harness/results/test-results",
99+
outputFormats="json,antjunit"
103100
)
104101
.run();
105102

@@ -201,6 +198,8 @@ component {
201198
version = "1.0.0",
202199
outputDir = ".tmp/apidocs"
203200
){
201+
// Create project mapping
202+
fileSystemUtil.createMapping( arguments.projectName, variables.cwd );
204203
// Generate Docs
205204
print.greenLine( "Generating API Docs, please wait..." ).toConsole();
206205
directoryCreate( arguments.outputDir, true, true );
@@ -285,7 +284,7 @@ component {
285284
function( path ){
286285
var isExcluded = false;
287286
variables.excludes.each( function( item ){
288-
if ( path.replaceNoCase( variables.cwd, "", "all" ).findNoCase( item ) ) {
287+
if ( path.replaceNoCase( variables.cwd, "", "all" ).reFindNoCase( item ) ) {
289288
isExcluded = true;
290289
}
291290
} );

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [3.2.0] => 2021-NOV-12
1111

12+
### Added
13+
14+
* Migrations to github actions
15+
* ACF2021 Support and automated testing
16+
1217
### Fixed
1318

1419
* Binary Type validator was not working by @nockhigan

test-harness/box.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,10 @@
1616
},
1717
"testbox":{
1818
"runner":"http://localhost:60299/tests/runner.cfm"
19+
},
20+
"scripts":{
21+
"cfpm":"echo '\".engine/adobe2021/WEB-INF/cfusion/bin/cfpm.sh\"' | run",
22+
"cfpm:install":"echo '\".engine/adobe2021/WEB-INF/cfusion/bin/cfpm.sh\" install ${1}' | run",
23+
"install:2021":"run-script cfpm:install zip"
1924
}
2025
}

0 commit comments

Comments
 (0)