Skip to content

Commit bf6df0e

Browse files
committed
update: run-test
1 parent b89f492 commit bf6df0e

3 files changed

Lines changed: 40 additions & 22 deletions

File tree

.github/workflows/blank.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/run-test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Java CI
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
26+
- name: Build & Run Tests (no Tomcat)
27+
run: ant -noinput -buildfile ci-build.xml test
28+
29+
- name: Report test results
30+
if: always()
31+
uses: dorny/test-reporter@v2
32+
with:
33+
name: Ant Unit Tests
34+
path: build/test-results/*.xml
35+
reporter: java-junit

ci-build.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<mkdir dir="${classes.dir}"/>
1515
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
1616
<classpath>
17-
<fileset dir="web/WEB-INF/lib" erroronmissingdir="false">
17+
<fileset dir="web/WEB-INF/lib">
1818
<include name="**/*.jar"/>
1919
</fileset>
2020
</classpath>
@@ -26,7 +26,7 @@
2626
<javac srcdir="${test.dir}" destdir="${test.classes.dir}" includeantruntime="false">
2727
<classpath>
2828
<pathelement path="${classes.dir}"/>
29-
<fileset dir="web/WEB-INF/lib" erroronmissingdir="false">
29+
<fileset dir="web/WEB-INF/lib">
3030
<include name="**/*.jar"/>
3131
</fileset>
3232
</classpath>
@@ -39,11 +39,13 @@
3939
<classpath>
4040
<pathelement path="${classes.dir}"/>
4141
<pathelement path="${test.classes.dir}"/>
42-
<fileset dir="web/WEB-INF/lib" erroronmissingdir="false">
42+
<fileset dir="web/WEB-INF/lib">
4343
<include name="**/*.jar"/>
4444
</fileset>
4545
</classpath>
46+
<!-- Thêm 2 formatter: plain để log, xml để test-reporter đọc -->
4647
<formatter type="plain"/>
48+
<formatter type="xml"/>
4749
<batchtest todir="${build.dir}/test-results">
4850
<fileset dir="${test.dir}">
4951
<include name="**/*Test.java"/>

0 commit comments

Comments
 (0)