From 07c1677881f8acf69fb5ed0b79ef07753279ac9b Mon Sep 17 00:00:00 2001 From: Jason Cameron Date: Sat, 21 Sep 2024 19:37:01 -0400 Subject: [PATCH] Add GHA to build and push wlmoj's judge --- .docker/wlmoj/Dockerfile | 29 +++++++++++++++++++++++++++++ .docker/wlmoj/config.yml | 2 ++ .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .docker/wlmoj/Dockerfile create mode 100644 .docker/wlmoj/config.yml diff --git a/.docker/wlmoj/Dockerfile b/.docker/wlmoj/Dockerfile new file mode 100644 index 000000000..9056000fb --- /dev/null +++ b/.docker/wlmoj/Dockerfile @@ -0,0 +1,29 @@ +FROM dmoj/runtimes-tier3 + +LABEL org.opencontainers.image.source="https://github.com/mcpt/wlmoj-judge" + +# Keep in a seperate RUN command as this should always have a cache hit while the rest of the image may not +RUN apt-get update && \ + apt-get -y --no-install-recommends install make cmake git gcc-multilib git && \ + rm -rf /var/lib/apt/lists/* + +RUN cd /tmp/ && git clone https://github.com/justinmeza/lci && \ + cd lci && \ + cmake . && \ + make && \ + make install && \ + rm -rf /tmp/lci/ && \ + cd /tmp/ && \ + git clone --recursive https://github.com/mcpt/wlmoj-judge /judge && \ + cd /judge && \ + python3 -m venv --prompt=DMOJ /env && \ + /env/bin/pip3 install cython setuptools && \ + /env/bin/pip3 install -e . && \ + /env/bin/python3 setup.py develop && \ + HOME=~judge . ~judge/.profile && \ + runuser -u judge -w PATH -- /env/bin/dmoj-autoconf -V > /judge-runtime-paths.yml && \ + echo ' crt_x86_in_lib32: true' >> /judge-runtime-paths.yml + +COPY config.yml /config.yml + +ENTRYPOINT ["/usr/bin/tini", "--", "/judge/.docker/entry"] \ No newline at end of file diff --git a/.docker/wlmoj/config.yml b/.docker/wlmoj/config.yml new file mode 100644 index 000000000..32911c898 --- /dev/null +++ b/.docker/wlmoj/config.yml @@ -0,0 +1,2 @@ +problem_storage_root: + - /problems/ \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 641a5ceb2..9a9b9d5ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -164,3 +164,33 @@ jobs: --entrypoint=/usr/bin/tini --cap-add=SYS_PTRACE dmoj/runtimes-tier3 /source/run - name: Upload coverage data uses: codecov/codecov-action@v1 + + # build the docker image the tests pass + build: + permissions: + packages: write + depends-on: [lint, mypy, test-sdist, amd64, arm64] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: .docker/wlmoj/Dockerfile + push: true + tags: "ghcr.io/mcpt/wlmoj-judge:latest" + cache-from: type=gha + cache-to: type=gha,mode=max +