From e3c7f9b632a34f8cd260dd594347f39158550ea2 Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Mon, 30 Nov 2020 13:49:25 +0100 Subject: [PATCH] Capture build artifacts for failed builds Motivation: When a build fails, it's desirable to have the build artifacts available so the build failure can be inspected, investigated and hopefully fixed. Modification: Change the Makefile and CI workflow such that the build artifacts are captured and uploaded when the build fails. Result: A "target.zip" file is now available for download on failed GitHub Actions builds. --- .github/workflows/ci-workflow.yml | 6 ++++++ Makefile | 4 ++-- src/main/java/io/netty/buffer/api/CompositeBuf.java | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 829037f..e9879c6 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -43,3 +43,9 @@ jobs: # Run the make script - name: Make build run: make build + + - uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: target + path: target/ # or path/to/artifact diff --git a/Makefile b/Makefile index 0e92cd9..bcc0f01 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ clean: build: image docker create --name build-container netty-incubator-buffer:build - docker start -a build-container - docker wait build-container + docker start -a build-container || (docker cp build-container:/home/build/target . && false) + docker wait build-container || (docker cp build-container:/home/build/target . && false) docker cp build-container:/home/build/target . docker rm build-container diff --git a/src/main/java/io/netty/buffer/api/CompositeBuf.java b/src/main/java/io/netty/buffer/api/CompositeBuf.java index 8a892c1..d7da05e 100644 --- a/src/main/java/io/netty/buffer/api/CompositeBuf.java +++ b/src/main/java/io/netty/buffer/api/CompositeBuf.java @@ -27,8 +27,7 @@ final class CompositeBuf extends RcSupport implements Buf { * non-composite copy of the buffer. */ private static final int MAX_CAPACITY = Integer.MAX_VALUE - 8; - private static final Drop - COMPOSITE_DROP = new Drop() { + private static final Drop COMPOSITE_DROP = new Drop() { @Override public void drop(CompositeBuf obj) { for (Buf buf : obj.bufs) {