Skip to content

Commit 27a62b8

Browse files
committed
add gha build and test
1 parent e40a432 commit 27a62b8

File tree

4 files changed

+107
-4
lines changed

4 files changed

+107
-4
lines changed

.github/workflows/main.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This workflow will build a Java project with Ant
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant
3+
4+
name: Java CI
5+
6+
on: [push, pull_request,workflow_dispatch]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
env:
13+
luceeVersion: 5.3.10.97
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '11'
21+
distribution: 'adopt'
22+
- name: Shutdown Ubuntu MySQL (SUDO)
23+
run: sudo service mysql stop
24+
- name: Setup MariaDB
25+
uses: getong/[email protected]
26+
with:
27+
mysql user: lucee
28+
mysql password: pass
29+
mysql database: tests
30+
env:
31+
INPUT_MYSQL_USER: lucee
32+
INPUT_MYSQL_PASSWORD: pass
33+
INPUT_MYSQL_DATABASE: tests
34+
- name: Cache Maven packages
35+
uses: actions/cache@v3
36+
with:
37+
path: ~/.m2
38+
key: lucee-script-runner-maven-cache
39+
- name: Cache Lucee files
40+
uses: actions/cache@v3
41+
with:
42+
path: _actions/lucee/script-runner/main/lucee-download-cache
43+
key: lucee-downloads-${{ env.luceeVersion }}
44+
restore-keys: |
45+
lucee-downloads
46+
- name: Build with script runner
47+
uses: lucee/script-runner@main
48+
with:
49+
webroot: ${{ github.workspace }}/build
50+
execute: /index.cfm
51+
luceeVersion: ${{ env.luceeVersion }}
52+
- name: Upload Artifact
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: mariadb-lex
56+
path: ./*.lex
57+
- name: Checkout Lucee
58+
uses: actions/checkout@v3
59+
with:
60+
repository: lucee/lucee
61+
path: lucee
62+
- name: Run Lucee Test Suite (testFilter="mariaDb")
63+
uses: lucee/script-runner@main
64+
with:
65+
webroot: ${{ github.workspace }}/lucee/test
66+
execute: /bootstrap-tests.cfm
67+
luceeVersion: ${{ env.luceeVersion }}
68+
extensionDir: ${{ github.workspace }}/
69+
env:
70+
testLabels: mariaDb
71+
testAdditional: ${{ github.workspace }}/test

build/index.cfm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<cfscript>
2+
systemOutput("Building MariaDB extension", true);
3+
task = new Task();
4+
//new task().run( getDirectoryFromPath( getDirectoryFromPath( getDirectoryFromPath( getCurrentTemplatePath() ) ) ) );
5+
task.run( expandPath("../" ) );
6+
7+
systemOutput("Finished building extension", true);
8+
</cfscript>

build/task.cfc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ component{
22

33
property name="rootPath";
44

5-
void function run(){
6-
variables.rootPath = fileSystemUtil.resolvePath( "../" );
5+
void function run(rootPath=""){
6+
if ( isEmpty( arguments.rootPath ) )
7+
variables.rootPath = fileSystemUtil.resolvePath( "../" );
8+
else {
9+
variables.rootPath = arguments.rootPath;
10+
}
11+
systemOutput("Build root path: [#variables.rootPath#]", true);
712
generateLexFile();
813
}
914

test/suite.cfc renamed to test/tests/mariaDb.cfc

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
component extends="testbox.system.BaseSpec"{
1+
component extends="org.lucee.cfml.test.LuceeTestCase" labels="mariaDb" {
22

33
private string function getClassName( required object object ){
44
return GetMetaData( arguments.object ).getCanonicalName()
@@ -11,7 +11,26 @@ component extends="testbox.system.BaseSpec"{
1111
}
1212

1313
function beforeAll(){
14-
include "sql/setup.cfm"
14+
variables.database = {
15+
host: server.system.environment.MARIADB_HOST?:"localhost"
16+
,port: server.system.environment.MARIADB_PORT?:3306
17+
,username: server.system.environment.MARIADB_LUCEE_USER?:"lucee"
18+
,password: server.system.environment.MARIADB_LUCEE_PASSWORD?:"pass"
19+
}
20+
21+
systemOutput(database, true);
22+
23+
application action="update" datasource={
24+
class: "org.mariadb.jdbc.Driver"
25+
,connectionString: "jdbc:mariadb://#database.host#:#database.port#/tests?allowMultiQueries=true"
26+
,username: database.username
27+
,password: database.password
28+
};
29+
30+
dbinfo type="Version" name="verify";
31+
systemOutput(verify, true);
32+
33+
include "../sql/setup.cfm"
1534
insertBlankRow()
1635
variables.testValues = {
1736
bit: 0

0 commit comments

Comments
 (0)