diff --git a/.github/runners/Dockerfile b/.github/runners/Dockerfile new file mode 100644 index 0000000..6f5827d --- /dev/null +++ b/.github/runners/Dockerfile @@ -0,0 +1,52 @@ +FROM docker.io/pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + sudo \ + unzip \ + curl \ + wget \ + git \ + git-lfs \ + jq \ + && rm -rf /var/lib/apt/lists/* + +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ + unzip awscliv2.zip && \ + ./aws/install + +ENV HOME=/home/runner + +RUN mkdir -p /home/runner + +ARG RUNNER_VERSION=2.317.0 + +ARG RUNNER_UID=1000 +ARG DOCKER_GID=1001 + +RUN adduser --disabled-password --gecos "" --uid $RUNNER_UID runner \ + && groupadd docker --gid $DOCKER_GID \ + && usermod -aG sudo runner \ + && usermod -aG docker runner \ + && echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \ + && echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers + +# cd into the user directory, download and unzip the github actions runner +RUN cd /home/runner && mkdir actions-runner && cd actions-runner \ + && curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz \ + && tar xzf ./actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz + +RUN chown -R runner:runner /home/runner && /home/runner/actions-runner/bin/installdependencies.sh + +ADD ./start.sh /home/runner/start.sh + +RUN chmod +x /home/runner/start.sh + +# Add /usr/local/cuda-11.7/compat to LD_LIBRARY_PATH +ENV LD_LIBRARY_PATH=/usr/local/cuda-12.1/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} + +ENTRYPOINT ["/bin/bash", "/home/runner/start.sh"] + +USER runner \ No newline at end of file diff --git a/.github/runners/start.sh b/.github/runners/start.sh new file mode 100644 index 0000000..84d3c3d --- /dev/null +++ b/.github/runners/start.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +RUNNER_REPO=$RUNNER_REPO +RUNNER_PAT=$RUNNER_PAT +RUNNER_GROUP=$RUNNER_GROUP +RUNNER_LABELS=$RUNNER_LABELS +RUNNER_NAME=$(hostname) + +cd /home/runner/actions-runner + +./config.sh --unattended --replace --url https://github.com/${RUNNER_REPO} --pat ${RUNNER_PAT} --name ${RUNNER_NAME} --runnergroup ${RUNNER_GROUP} --labels ${RUNNER_LABELS} --work /home/runner/actions-runner/_work + +cleanup() { + echo "Removing runner..." + ./config.sh remove --unattended --pat ${RUNNER_PAT} +} + +trap 'cleanup; exit 130' INT +trap 'cleanup; exit 143' TERM + +./run.sh & wait $! \ No newline at end of file diff --git a/.github/workflows/test-flow.yml b/.github/workflows/test-flow.yml index c39ceef..ae463b3 100644 --- a/.github/workflows/test-flow.yml +++ b/.github/workflows/test-flow.yml @@ -8,7 +8,8 @@ on: jobs: test: - runs-on: ubuntu-latest + runs-on: - ubuntu-latest + - research steps: - uses: actions/checkout@v4