Skip to content

Commit 217877d

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

7 files changed

Lines changed: 163 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
24+
run: ./mvnw --no-transfer-progress --batch-mode verify
25+
26+
- name: Run IT tests
27+
shell: bash
28+
run: |
29+
MVN="./mvnw --no-transfer-progress --batch-mode verify -DskipITs=false -Dsurefire.skip=true"
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: 37 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>
@@ -155,4 +170,26 @@
155170
</plugins>
156171
</build>
157172

173+
<profiles>
174+
<profile>
175+
<id>macos-it</id>
176+
<activation>
177+
<os><family>mac</family></os>
178+
</activation>
179+
<build>
180+
<plugins>
181+
<plugin>
182+
<groupId>org.apache.maven.plugins</groupId>
183+
<artifactId>maven-failsafe-plugin</artifactId>
184+
<configuration>
185+
<!-- On macOS the forked JVM's stdin is a pipe, not a TTY.
186+
Running in-process avoids the fork so /dev/stdin remains a PTY. -->
187+
<forkCount>0</forkCount>
188+
</configuration>
189+
</plugin>
190+
</plugins>
191+
</build>
192+
</profile>
193+
</profiles>
194+
158195
</project>
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: 31 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>
@@ -244,6 +256,25 @@
244256
</plugins>
245257
</build>
246258
</profile>
259+
<profile>
260+
<id>macos-it</id>
261+
<activation>
262+
<os><family>mac</family></os>
263+
</activation>
264+
<build>
265+
<plugins>
266+
<plugin>
267+
<groupId>org.apache.maven.plugins</groupId>
268+
<artifactId>maven-failsafe-plugin</artifactId>
269+
<configuration>
270+
<!-- On macOS the forked JVM's stdin is a pipe, not a TTY.
271+
Running in-process avoids the fork so /dev/stdin remains a PTY. -->
272+
<forkCount>0</forkCount>
273+
</configuration>
274+
</plugin>
275+
</plugins>
276+
</build>
277+
</profile>
247278
</profiles>
248279

249280
</project>
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
<properties>
4848
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
49+
<skipITs>true</skipITs>
4950

5051
<!-- Dependency versions -->
5152
<version.jspecify>1.0.0</version.jspecify>
@@ -99,6 +100,11 @@
99100
<artifactId>maven-surefire-plugin</artifactId>
100101
<version>3.5.5</version>
101102
</plugin>
103+
<plugin>
104+
<groupId>org.apache.maven.plugins</groupId>
105+
<artifactId>maven-failsafe-plugin</artifactId>
106+
<version>3.5.5</version>
107+
</plugin>
102108
<plugin>
103109
<groupId>org.apache.maven.plugins</groupId>
104110
<artifactId>maven-jar-plugin</artifactId>

0 commit comments

Comments
 (0)