Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Integration Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
integration-tests:
name: Run Integration Tests
runs-on: ubuntu-latest
services:
httpbin:
image: kennethreitz/httpbin
ports:
- 31888:80
steps:

- name: Wait for httpbin to be ready
run: |
for i in {1..10}; do
if curl -sSf http://localhost:31888/get >/dev/null; then
echo "httpbin is ready!"
exit 0
fi
echo "Waiting for httpbin..."
sleep 3
done
echo "httpbin did not start in time" >&2
exit 1

- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: temurin
cache: maven

- name: Set up Maven settings.xml
uses: s4u/maven-settings-action@v3.1.0
with:
sonatypeSnapshots: true
repositories: >-
[
{
"id": "central-snapshots",
"name": "Maven Repository Switchboard",
"url": "https://central.sonatype.com/repository/maven-snapshots",
"snapshots": { "enabled": true },
"releases": { "enabled": false }
}
]

- name: Run Integration Tests
env:
HTTPBIN_BASE_URL: http://localhost:31888
run: |
mvn clean -B verify -Pintegration-tests \
-Dhttpbin.url=$HTTPBIN_BASE_URL
59 changes: 58 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.metricshub</groupId>
<artifactId>oss-parent</artifactId>
<version>2</version>
<version>4</version>
</parent>

<artifactId>simple-http-java</artifactId>
Expand Down Expand Up @@ -218,4 +218,61 @@
</plugins>
</build>

<profiles>
<profile>
<id>integration-tests</id>
<build>
<plugins>
<!-- Build Helper Maven Plugin to add integration test sources -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

<!-- Maven Failsafe Plugin to run integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<includes>
<include>**/*IT.java</include>
</includes>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<trimStackTrace>false</trimStackTrace>
<argLine>
--add-exports java.base/sun.net.www.protocol.http=ALL-UNNAMED
--add-exports java.base/sun.security.ssl=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Loading
Loading