Skip to content

Commit bd6bf50

Browse files
committed
prepare a new Github Actions workflow to build and run tests
1 parent fad02f5 commit bd6bf50

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

.github/workflows/main.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: run-test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
# check the compilation and run tests
11+
test-plugin:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Build Image
18+
run: |
19+
docker build -f docker/Dockerfile.ci -t test-plugin .
20+
21+
- name: Run tests
22+
run: |
23+
docker run --rm -v $(pwd):/workspace test-plugin

docker/Dockerfile.ci

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ARG JDK_VERSION=21
2+
3+
FROM gradle:8-jdk${JDK_VERSION} AS test-runner
4+
5+
RUN apt-get update && apt-get install -y dumb-init procps && rm -rf /var/lib/apt/lists/*
6+
7+
# Create a non-root user to run elasticsearch when testing
8+
RUN useradd -m -u 1001 -s /bin/bash testuser && \
9+
usermod -aG sudo testuser
10+
11+
COPY --chown=testuser:testuser . /workspace
12+
WORKDIR /workspace
13+
14+
USER testuser
15+
16+
# ENV ES_JAVA_OPTS="-Xms1g -Xmx1g -Djava.io.tmpdir=/tmp"
17+
18+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
19+
CMD ["./gradlew", "spotlessCheck", "check", "--no-daemon"]

0 commit comments

Comments
 (0)