Skip to content

Commit

Permalink
Enable leak detection when building PRs. (java-native-access#123)
Browse files Browse the repository at this point in the history
Motivation:

We should enable leak detection when building PRs.

Modifications:

- Add profile to make it easy to enable leak detection
- Enable leak detection for pull requests

Result:

Easier to find leaks
  • Loading branch information
normanmaurer authored Dec 22, 2020
1 parent 5887c34 commit 4daf6b4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml → .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ jobs:
restore-keys: |
docker-cache-${{ steps.cache-key.outputs.key }}-
- name: Build docker image
run: docker-compose -f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml build

- name: Execute project build
- name: Build project without leak detection
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker-compose -f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml run build

# Deploy if this was a push to the main branch
- name: Deploy to sonatype
- name: Build project with leak detection
if: ${{ github.event_name == 'pull_request' }}
run: docker-compose -f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml run build-leak

- name: Deploy project snapshot to sonatype
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: docker-compose -f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml run deploy

Expand Down
3 changes: 3 additions & 0 deletions docker/docker-compose.centos-6.18.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ services:
build:
image: netty-codec-quic-centos6:centos-6-1.8

build-leak:
image: netty-codec-quic-centos6:centos-6-1.8

build-clean:
image: netty-codec-quic-centos6:centos-6-1.8

Expand Down
6 changes: 6 additions & 0 deletions docker/docker-compose.centos-6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ services:
<<: *common
command: /bin/bash -cl "mvn clean package -DquicheCheckoutDir=/root/source/quiche"


build-leak:
<<: *common
command: /bin/bash -cl "mvn -Pleak clean package -DquicheCheckoutDir=/root/source/quiche"


build-clean:
<<: *common
command: /bin/bash -cl "mvn clean package"
Expand Down
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
Symbol not found: ___isPlatformVersionAtLeast
-->
<macosxDeploymentTarget>10.12</macosxDeploymentTarget>
<test.argLine>-D_</test.argLine>
</properties>

<profiles>
Expand All @@ -113,7 +114,14 @@
<extraLdflags>-Wl,--strip-debug -Wl,--exclude-libs,ALL -lrt</extraLdflags>
</properties>
</profile>
<profile>
<id>leak</id>
<properties>
<test.argLine>-Dio.netty.leakDetectionLevel=paranoid -Dio.netty.leakDetection.targetRecords=32</test.argLine>
</properties>
</profile>
</profiles>

<build>
<extensions>
<extension>
Expand Down Expand Up @@ -366,6 +374,7 @@
</properties>
<!-- Ensure the whole stacktrace is preserved when an exception is thrown. See https://issues.apache.org/jira/browse/SUREFIRE-1457 -->
<trimStackTrace>false</trimStackTrace>
<argLine>${test.argLine}</argLine>
</configuration>
<dependencies>
<dependency>
Expand Down

0 comments on commit 4daf6b4

Please sign in to comment.