Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.

Commit 0967c0f

Browse files
add: github action to deploy to github repository and run unit test with junit
1 parent 430cd55 commit 0967c0f

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Maven deployments
2+
3+
on: [release]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up JDK 17
11+
uses: actions/setup-java@v2
12+
with:
13+
java-version: '17'
14+
distribution: 'adopt'
15+
- name: Deploy to GitHub
16+
run: mvn --batch-mode deploy
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/junit.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Java unit tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v1
11+
- name: Set up JDK 17
12+
uses: actions/setup-java@v2
13+
with:
14+
java-version: '17'
15+
distribution: 'adopt'
16+
- name: Build
17+
run: mvn --batch-mode -DskipTests package
18+
- name: Test
19+
run: mvn --batch-mode -Dmaven.test.failure.ignore=true test
20+
- name: Report
21+
uses: dorny/test-reporter@v1
22+
if: always()
23+
with:
24+
name: Maven Tests
25+
path: target/surefire-reports/*.xml
26+
reporter: java-junit
27+
fail-on-error: true

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ test:
4040
# This command remove the target directory
4141
clean:
4242
mvn clean
43+
rm -rf target | true

src/main/java/net/httpclient/wrapper/ratelimiter/RateLimiter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public synchronized void acquire() {
4242
Thread.sleep(durationToSleep.toMillis());
4343
lastAcquire = Instant.now();
4444
} catch (InterruptedException e) {
45-
e.printStackTrace();
45+
throw (new RuntimeException(e));
4646
}
4747
}
4848

0 commit comments

Comments
 (0)