From fc5796e63bcc24d79a5db5db4ab380cd02f31889 Mon Sep 17 00:00:00 2001 From: Shubham Chaudhary Date: Thu, 16 May 2024 22:10:31 +0530 Subject: [PATCH] add hello test Signed-off-by: Shubham Chaudhary --- .github/workflows/release.yml | 8 ++++++++ custom/nsutil/Dockerfile | 6 ++++++ custom/nsutil/hello.c | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100644 custom/nsutil/hello.c diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31cea5d2..753dc521 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,6 +39,10 @@ jobs: run: gcc -shared -fPIC nsutil.c -o ./../../build/_output/nsutil_amd64.so working-directory: custom/nsutil + - name: Build shared libraries for hello amd64 + run: gcc hello.c -o ./../../build/_output/hello_amd64 + working-directory: custom/nsutil + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -50,6 +54,10 @@ jobs: run: docker create --name myapp-arm64-container myapp-arm64 && docker cp myapp-arm64-container:/app/nsutil.so ./../../build/_output/nsutil_arm64.so working-directory: custom/nsutil + - name: Extract compiled binary hello + run: docker create --name myapp-arm64-container1 myapp-arm64 && docker cp myapp-arm64-container1:/app/hello ./../../build/_output/hello_arm64 + working-directory: custom/nsutil + - name: Build go binary for promql-cli run : | cp custom/promql-cli/promql-linux-amd64 build/_output/ diff --git a/custom/nsutil/Dockerfile b/custom/nsutil/Dockerfile index 7168ed69..9468f927 100644 --- a/custom/nsutil/Dockerfile +++ b/custom/nsutil/Dockerfile @@ -9,5 +9,11 @@ WORKDIR /app # Copy your C code into the container COPY nsutil.c /app +# Copy your C code into the container +COPY hello.c /app + # Compile the C code RUN gcc -shared -fPIC nsutil.c -o nsutil.so + +# Compile the C code +RUN gcc hello.c -o hello diff --git a/custom/nsutil/hello.c b/custom/nsutil/hello.c new file mode 100644 index 00000000..273eb5d6 --- /dev/null +++ b/custom/nsutil/hello.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, const char *argv[]) +{ + printf("Hello World!\n"); + + return 0; +}