Skip to content

Commit ecf9923

Browse files
committed
ci: added IT tests and test workflow
1 parent 9e5501b commit ecf9923

7 files changed

Lines changed: 121 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
cache: maven
2626

2727
- name: Build and verify
28-
run: ./mvnw --no-transfer-progress --batch-mode verify
28+
run: ./mvnw --no-transfer-progress --batch-mode verify -DskipITs

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test CI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macos-latest]
12+
13+
steps:
14+
- uses: actions/checkout@v6
15+
16+
- name: Set up JDK 22
17+
uses: actions/setup-java@v5
18+
with:
19+
java-version: '22'
20+
distribution: 'temurin'
21+
cache: maven
22+
23+
- name: Build and verify (no IT tests)
24+
run: ./mvnw --no-transfer-progress --batch-mode verify -DskipITs
25+
26+
- name: Build and verify (IT tests only)
27+
shell: bash
28+
run: |
29+
MVN="./mvnw --no-transfer-progress --batch-mode verify -DskipTests"
30+
if [[ "$RUNNER_OS" == "Linux" ]]; then
31+
# Allocate a PTY so /dev/tty is available for the Terminal IT tests
32+
script -q -e -c "$MVN" /dev/null
33+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
34+
# BSD script: command args follow the output file
35+
script -q /dev/null $MVN
36+
else
37+
$MVN
38+
fi

miniterm-ffm/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,21 @@
107107
<argLine>--enable-native-access=ALL-UNNAMED</argLine>
108108
</configuration>
109109
</plugin>
110+
<plugin>
111+
<groupId>org.apache.maven.plugins</groupId>
112+
<artifactId>maven-failsafe-plugin</artifactId>
113+
<configuration>
114+
<argLine>--enable-native-access=ALL-UNNAMED</argLine>
115+
</configuration>
116+
<executions>
117+
<execution>
118+
<goals>
119+
<goal>integration-test</goal>
120+
<goal>verify</goal>
121+
</goals>
122+
</execution>
123+
</executions>
124+
</plugin>
110125
<plugin>
111126
<groupId>com.diffplug.spotless</groupId>
112127
<artifactId>spotless-maven-plugin</artifactId>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright TamboUI and miniterm Contributors
3+
* SPDX-License-Identifier: MIT
4+
*/
5+
package org.codejive.miniterm;
6+
7+
import static org.assertj.core.api.Assertions.assertThat;
8+
9+
import java.io.IOException;
10+
import org.junit.jupiter.api.Test;
11+
12+
class TerminalIT {
13+
14+
@Test
15+
void terminalCanBeCreatedAndClosed() throws IOException {
16+
Terminal terminal = Terminal.create();
17+
try {
18+
assertThat(terminal).isNotNull();
19+
assertThat(terminal.charset()).isNotNull();
20+
assertThat(terminal.rawModeEnabled()).isFalse();
21+
} finally {
22+
terminal.close();
23+
}
24+
}
25+
}

miniterm/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@
8080
</archive>
8181
</configuration>
8282
</plugin>
83+
<plugin>
84+
<groupId>org.apache.maven.plugins</groupId>
85+
<artifactId>maven-failsafe-plugin</artifactId>
86+
<executions>
87+
<execution>
88+
<goals>
89+
<goal>integration-test</goal>
90+
<goal>verify</goal>
91+
</goals>
92+
</execution>
93+
</executions>
94+
</plugin>
8395
<plugin>
8496
<groupId>com.diffplug.spotless</groupId>
8597
<artifactId>spotless-maven-plugin</artifactId>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright TamboUI and miniterm Contributors
3+
* SPDX-License-Identifier: MIT
4+
*/
5+
package org.codejive.miniterm;
6+
7+
import static org.assertj.core.api.Assertions.assertThat;
8+
9+
import java.io.IOException;
10+
import org.junit.jupiter.api.Test;
11+
12+
class TerminalIT {
13+
14+
@Test
15+
void terminalCanBeCreatedAndClosed() throws IOException {
16+
Terminal terminal = Terminal.create();
17+
try {
18+
assertThat(terminal).isNotNull();
19+
assertThat(terminal.charset()).isNotNull();
20+
assertThat(terminal.rawModeEnabled()).isFalse();
21+
} finally {
22+
terminal.close();
23+
}
24+
}
25+
}

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
<artifactId>maven-surefire-plugin</artifactId>
100100
<version>3.5.5</version>
101101
</plugin>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-failsafe-plugin</artifactId>
105+
<version>3.5.5</version>
106+
</plugin>
102107
<plugin>
103108
<groupId>org.apache.maven.plugins</groupId>
104109
<artifactId>maven-jar-plugin</artifactId>

0 commit comments

Comments
 (0)