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

Run CI on self-hosted machine #499

Merged
merged 6 commits into from
Nov 18, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
skip_check:
runs-on: ubuntu-24.04
runs-on: [self-hosted, Linux, X64]
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
Expand All @@ -30,7 +30,7 @@ jobs:

name: Integration testing
timeout-minutes: 30
runs-on: ubuntu-24.04
runs-on: [self-hosted, Linux, X64]

strategy:
matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
skip_check:
runs-on: ubuntu-24.04
runs-on: [self-hosted, Linux, X64]
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
Expand All @@ -30,7 +30,7 @@ jobs:

name: Various lints
timeout-minutes: 30
runs-on: ubuntu-24.04
runs-on: [self-hosted, Linux, X64]

strategy:
matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
skip_check:
runs-on: ubuntu-24.04
runs-on: [self-hosted, Linux, X64]
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
Expand All @@ -29,7 +29,7 @@ jobs:
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: Run Tests
timeout-minutes: 30
runs-on: ubuntu-24.04
runs-on: [self-hosted, Linux, X64]

strategy:
matrix:
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ cargo clippy
```

Alas, `cargo build` doesn't work. That's a known problem and we're working on it. Please use `cargo make build` instead for now.

### Setting up self-hosted CI docker container

To set up docker container for CI, you can run the following command:

```sh
docker build -t ceno-runner scripts/ci/
docker run -d ceno-runner
kunxian-xia marked this conversation as resolved.
Show resolved Hide resolved
```
31 changes: 31 additions & 0 deletions scripts/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# this dockerfile is borrowed from https://baccini-al.medium.com/how-to-containerize-a-github-actions-self-hosted-runner-5994cc08b9fb
kunxian-xia marked this conversation as resolved.
Show resolved Hide resolved
FROM ubuntu:22.04
kunxian-xia marked this conversation as resolved.
Show resolved Hide resolved

ARG DEBIAN_FRONTEND=noninteractive
ARG RUNNER_VERSION="2.320.0"
ARG CHECKSUM="93ac1b7ce743ee85b5d386f5c1787385ef07b3d7c728ff66ce0d3813d5f46900"

RUN apt update -y && apt upgrade -y && useradd -m docker
RUN apt install -y --no-install-recommends \
curl jq build-essential libssl-dev libffi-dev python3 python3-venv python3-dev python3-pip

# these are the dependencies of actions-runner
RUN apt install -y --no-install-recommends \
libkrb5-3 zlib1g libicu70

RUN cd /home/docker && mkdir actions-runner && cd actions-runner \
&& curl -o actions-runner-linux-x64-$RUNNER_VERSION.tar.gz -L https://github.com/actions/runner/releases/download/v$RUNNER_VERSION/actions-runner-linux-x64-$RUNNER_VERSION.tar.gz \
&& echo "$CHECKSUM actions-runner-linux-x64-$RUNNER_VERSION.tar.gz" | shasum -a 256 -c \
&& tar xzf ./actions-runner-linux-x64-$RUNNER_VERSION.tar.gz

RUN chown -R docker ~docker && cd /home/docker/actions-runner/bin/ \
&& chmod +x installdependencies.sh \
&& ./installdependencies.sh

COPY start.sh start.sh
RUN chmod +x start.sh

# GitHub action runner scripts (config.sh and run.sh) are not allowed to be run as root
USER docker

ENTRYPOINT ["./start.sh"]
7 changes: 7 additions & 0 deletions scripts/ci/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

cd /home/docker/actions-runner/
echo "begin to configure"
./config.sh --url https://github.com/scroll-tech/ceno --token $TOKEN

./run.sh