Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tests): add test container dockerfile #62

Merged
merged 4 commits into from
Mar 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/test-container.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,5 @@ Temporary Items
docs/
test/javaDefinitions/**
/test/system_test/javaDefinitions/
testOut/
testOut/
test/Dockerfile-test-template.hbs
24 changes: 24 additions & 0 deletions test/Dockerfile-test-template.hbs
Original file line number Diff line number Diff line change
@@ -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" ]