Skip to content

Commit 9bfdd86

Browse files
committed
cherry pick
1 parent 2710445 commit 9bfdd86

File tree

11 files changed

+507
-449
lines changed

11 files changed

+507
-449
lines changed

.github/workflows/pr-test.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: PR Test
2+
3+
on:
4+
# Do not run CI on push to reduce CI time
5+
# push:
6+
# branches: [main]
7+
pull_request:
8+
branches: [main]
9+
types: [synchronize, labeled]
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
e2e-test:
17+
# TODO may use run-ci label etc
18+
if: github.event.pull_request.draft == false
19+
runs-on: self-hosted
20+
container:
21+
image: slimerl/slime:latest
22+
options: >
23+
--gpus all
24+
--ipc=host
25+
--shm-size=16g
26+
--ulimit memlock=-1
27+
--ulimit stack=67108864
28+
--memory=0
29+
--memory-swap=0
30+
-v /data/slime_ci:/data/slime_ci
31+
-v /data/slime_ci/models:/root/models
32+
-v /data/slime_ci/datasets:/root/datasets
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
info:
37+
- {test_file: test_quick_start_glm4_9B.py}
38+
- {test_file: test_qwen3_30B_A3B.py}
39+
# TODO use deterministic kernel
40+
defaults:
41+
run:
42+
working-directory: ${{ github.workspace }}
43+
env:
44+
GITHUB_COMMIT_NAME: ${{ github.sha }}_${{ github.event.pull_request.number || 'non-pr' }}
45+
WANDB_API_KEY: ${{ secrets.WANDB_API_KEY }}
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v4
50+
51+
- name: Install
52+
shell: bash
53+
run: cd $GITHUB_WORKSPACE && pip install -e .
54+
55+
- name: Execute
56+
shell: bash
57+
run: python tests/${{ matrix.info.test_file }}

.github/workflows/slime-ci.yml

Lines changed: 0 additions & 156 deletions
This file was deleted.

tests/ci/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Doc about CI
2+
3+
## Configure GitHub secrets
4+
5+
https://github.com/slimerl/slime/settings/secrets/actions
6+
7+
* `WANDB_API_KEY`: get from https://wandb.ai/authorize
8+
9+
## Setup new GitHub runners
10+
11+
### Step 1: Env
12+
13+
Write `.env` mimicking `.env.example`.
14+
The token can be found at https://github.com/slimerl/slime/settings/actions/runners/new?arch=x64&os=linux.
15+
16+
WARN: The `GITHUB_RUNNER_TOKEN` changes after a while.
17+
18+
### Step 2: Prepare `/home/runner/externals`
19+
20+
```shell
21+
docker run --rm -it --privileged --pid=host -v /:/host_root ubuntu /bin/bash -c 'rm -rf /host_root/home/runner/externals && mkdir -p /host_root/home/runner/externals && chmod -R 777 /host_root/home/runner/externals'
22+
docker run -d --name temp-runner ghcr.io/actions/actions-runner:2.328.0 tail -f /dev/null
23+
docker cp temp-runner:/home/runner/externals/. /home/runner/externals
24+
docker rm -f temp-runner
25+
ls -alh /home/runner/externals
26+
```
27+
28+
### Step 3: Run
29+
30+
```shell
31+
cd /data/tom/primary_synced/slime/tests/ci/github_runner
32+
docker compose up -d
33+
```
34+
35+
### Debugging
36+
37+
Logs
38+
39+
```shell
40+
docker compose logs -f
41+
```
42+
43+
Exec
44+
45+
```shell
46+
docker exec -it github_runner-runner-1 /bin/bash
47+
```
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GITHUB_RUNNER_URL=https://github.com/slimerl/slime
2+
GITHUB_RUNNER_TOKEN=paste-your-token-here

tests/ci/github_runner/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Please refer to `README.md` for how to setup this GitHub action runner
2+
version: "3.9"
3+
4+
services:
5+
runner:
6+
image: ghcr.io/actions/actions-runner:2.328.0
7+
volumes:
8+
- /var/run/docker.sock:/var/run/docker.sock
9+
- /data/slime_ci:/data/slime_ci
10+
# it requires this folder
11+
- /home/runner/externals:/home/runner/externals
12+
deploy:
13+
# TODO 4 runner + lock gpu when running
14+
replicas: 1
15+
restart: always
16+
environment:
17+
RUNNER_ALLOW_RUNASROOT: "1"
18+
privileged: true
19+
user: root
20+
# ref: https://github.com/actions/runner/issues/367#issuecomment-2007558723
21+
# ref: https://github.com/actions/runner
22+
# args ref: https://github.com/actions/runner/blob/68ff57dbc4c836d50f46602a8a53301fb9513eb4/src/Runner.Listener/CommandSettings.cs#L53
23+
# TODO seems we should not run config.sh repeatedly
24+
entrypoint: >
25+
sh -c "
26+
cd /data/slime_ci &&
27+
/home/runner/config.sh --url ${GITHUB_RUNNER_URL} --token ${GITHUB_RUNNER_TOKEN} --unattended --work /data/slime_ci/runner_$(hostname) &&
28+
/home/runner/run.sh
29+
"

0 commit comments

Comments
 (0)