Skip to content

Commit

Permalink
Add GHA to build and push wlmoj's judge
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLovesDoggo committed Sep 21, 2024
1 parent a597d07 commit 07c1677
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .docker/wlmoj/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 2 additions & 0 deletions .docker/wlmoj/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
problem_storage_root:
- /problems/
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 07c1677

Please sign in to comment.