From 987375bbb2589b4756ee7525bc52530d4077dbc2 Mon Sep 17 00:00:00 2001 From: MarkusJx <28785953+markusjx@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:32:10 +0100 Subject: [PATCH 1/4] feat(tests): add test container dockerfile Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com> --- .github/workflows/test-container.yml | 46 ++++++++++++++++++++++++++++ .prettierignore | 3 +- test/Dockerfile-test-template.hbs | 24 +++++++++++++++ 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-container.yml create mode 100644 test/Dockerfile-test-template.hbs diff --git a/.github/workflows/test-container.yml b/.github/workflows/test-container.yml new file mode 100644 index 0000000..9e0121b --- /dev/null +++ b/.github/workflows/test-container.yml @@ -0,0 +1,46 @@ +name: Build test container +on: + workflow_dispatch: + inputs: + node-version: + description: 'Node version' + required: true + debian-version: + description: 'Debian version' + required: true + jdk-version: + description: 'JDK version' + required: true + +env: + REGISTRY: ghcr.io + IMAGE_NAME: java-bridge-asan-testcontainer + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Create dockerfile + uses: edgardleal/mustache-template-action@v1.0.4 + env: + DEBIAN_VERSION: ${{github.event.inputs.debian-version}} + JDK_VERSION: ${{github.event.inputs.jdk-version}} + NODE_VERSION: ${{github.event.inputs.node-version}} + with: + input: ./test/Dockerfile-test-template.hbs + output: Dockerfile + + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin + - name: Push latest image + if: ${{github.event.inputs.set-latest == 'true'}} + run: | + IMAGE_ID=$REGISTRY/${{ github.repository }} + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')/$IMAGE_NAME + docker tag $IMAGE_NAME $IMAGE_ID:latest + docker push $IMAGE_ID:latest diff --git a/.prettierignore b/.prettierignore index a03d598..4a001d8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -318,4 +318,5 @@ Temporary Items docs/ test/javaDefinitions/** /test/system_test/javaDefinitions/ -testOut/ \ No newline at end of file +testOut/ +test/Dockerfile-test-template.hbs \ No newline at end of file diff --git a/test/Dockerfile-test-template.hbs b/test/Dockerfile-test-template.hbs new file mode 100644 index 0000000..e7ae20d --- /dev/null +++ b/test/Dockerfile-test-template.hbs @@ -0,0 +1,24 @@ +FROM ghcr.io/markusjx/prebuilt-debug-jdk:{{JDK_VERSION}} as jdk +FROM ghcr.io/markusjx/prebuilt-debug-nodejs:{{NODE_VERSION}} as node +FROM debian:{{DEBIAN_VERSION}}-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + libclang-dev clang libatomic1 && apt-get install -y curl && \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y && \ + PATH="$PATH:/root/.cargo/bin" \ + rustup toolchain install nightly --allow-downgrade --profile default --component clippy && \ + PATH="$PATH:/root/.cargo/bin" \ + rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu && \ + apt-get remove -y curl && apt-get autoremove -y && apt-get clean -y + +COPY --from=jdk /jdk /jdk +COPY --from=node /nodejs /nodejs + +ENV JAVA_HOME=/jdk +ENV RUSTFLAGS="-Clinker=clang -Zsanitizer=address" +ENV RUSTDOCFLAGS="-Clinker=clang -Zsanitizer=address" +ENV ASAN_OPTIONS="detect_leaks=0" +ENV PATH="$PATH:/root/.cargo/bin:/jdk/bin:/nodejs/node:/nodejs/npm" + +WORKDIR /app +CMD [ "/bin/bash" ] \ No newline at end of file From 282759707a9ec0e8c8988ae0722fe2911e8dfae5 Mon Sep 17 00:00:00 2001 From: MarkusJx <28785953+markusjx@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:34:03 +0100 Subject: [PATCH 2/4] fix: broken workflow file Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com> --- .github/workflows/test-container.yml | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test-container.yml b/.github/workflows/test-container.yml index 9e0121b..a5b6271 100644 --- a/.github/workflows/test-container.yml +++ b/.github/workflows/test-container.yml @@ -20,27 +20,27 @@ jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Create dockerfile - uses: edgardleal/mustache-template-action@v1.0.4 - env: - DEBIAN_VERSION: ${{github.event.inputs.debian-version}} - JDK_VERSION: ${{github.event.inputs.jdk-version}} - NODE_VERSION: ${{github.event.inputs.node-version}} - with: - input: ./test/Dockerfile-test-template.hbs - output: Dockerfile + steps: + - uses: actions/checkout@v3 + - name: Create dockerfile + uses: edgardleal/mustache-template-action@v1.0.4 + env: + DEBIAN_VERSION: ${{github.event.inputs.debian-version}} + JDK_VERSION: ${{github.event.inputs.jdk-version}} + NODE_VERSION: ${{github.event.inputs.node-version}} + with: + input: ./test/Dockerfile-test-template.hbs + output: Dockerfile - - name: Build image - run: docker build . --file Dockerfile --tag $IMAGE_NAME + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME - - name: Log into registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin - - name: Push latest image - if: ${{github.event.inputs.set-latest == 'true'}} - run: | - IMAGE_ID=$REGISTRY/${{ github.repository }} - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')/$IMAGE_NAME - docker tag $IMAGE_NAME $IMAGE_ID:latest - docker push $IMAGE_ID:latest + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin + - name: Push latest image + if: ${{github.event.inputs.set-latest == 'true'}} + run: | + IMAGE_ID=$REGISTRY/${{ github.repository }} + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')/$IMAGE_NAME + docker tag $IMAGE_NAME $IMAGE_ID:latest + docker push $IMAGE_ID:latest From 53765905df436e9a558806d07ba86e91b9a4a9f0 Mon Sep 17 00:00:00 2001 From: MarkusJx <28785953+markusjx@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:36:31 +0100 Subject: [PATCH 3/4] fix: broken workflow file Signed-off-by: MarkusJx <28785953+MarkusJx@users.noreply.github.com> --- .github/workflows/test-container.yml | 46 ---------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/test-container.yml diff --git a/.github/workflows/test-container.yml b/.github/workflows/test-container.yml deleted file mode 100644 index a5b6271..0000000 --- a/.github/workflows/test-container.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build test container -on: - workflow_dispatch: - inputs: - node-version: - description: 'Node version' - required: true - debian-version: - description: 'Debian version' - required: true - jdk-version: - description: 'JDK version' - required: true - -env: - REGISTRY: ghcr.io - IMAGE_NAME: java-bridge-asan-testcontainer - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Create dockerfile - uses: edgardleal/mustache-template-action@v1.0.4 - env: - DEBIAN_VERSION: ${{github.event.inputs.debian-version}} - JDK_VERSION: ${{github.event.inputs.jdk-version}} - NODE_VERSION: ${{github.event.inputs.node-version}} - with: - input: ./test/Dockerfile-test-template.hbs - output: Dockerfile - - - name: Build image - run: docker build . --file Dockerfile --tag $IMAGE_NAME - - - name: Log into registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin - - name: Push latest image - if: ${{github.event.inputs.set-latest == 'true'}} - run: | - IMAGE_ID=$REGISTRY/${{ github.repository }} - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')/$IMAGE_NAME - docker tag $IMAGE_NAME $IMAGE_ID:latest - docker push $IMAGE_ID:latest From 3c502fbcfee29887b0f09e21a97b18a893bb2e33 Mon Sep 17 00:00:00 2001 From: Markus <28785953+MarkusJx@users.noreply.github.com> Date: Sun, 5 Mar 2023 15:38:31 +0100 Subject: [PATCH 4/4] Create test-container.yml --- .github/workflows/test-container.yml | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/test-container.yml diff --git a/.github/workflows/test-container.yml b/.github/workflows/test-container.yml new file mode 100644 index 0000000..a5b6271 --- /dev/null +++ b/.github/workflows/test-container.yml @@ -0,0 +1,46 @@ +name: Build test container +on: + workflow_dispatch: + inputs: + node-version: + description: 'Node version' + required: true + debian-version: + description: 'Debian version' + required: true + jdk-version: + description: 'JDK version' + required: true + +env: + REGISTRY: ghcr.io + IMAGE_NAME: java-bridge-asan-testcontainer + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Create dockerfile + uses: edgardleal/mustache-template-action@v1.0.4 + env: + DEBIAN_VERSION: ${{github.event.inputs.debian-version}} + JDK_VERSION: ${{github.event.inputs.jdk-version}} + NODE_VERSION: ${{github.event.inputs.node-version}} + with: + input: ./test/Dockerfile-test-template.hbs + output: Dockerfile + + - name: Build image + run: docker build . --file Dockerfile --tag $IMAGE_NAME + + - name: Log into registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $REGISTRY -u ${{ github.actor }} --password-stdin + - name: Push latest image + if: ${{github.event.inputs.set-latest == 'true'}} + run: | + IMAGE_ID=$REGISTRY/${{ github.repository }} + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')/$IMAGE_NAME + docker tag $IMAGE_NAME $IMAGE_ID:latest + docker push $IMAGE_ID:latest