Skip to content

Commit 8f9aaf6

Browse files
committed
[cicd] add aliyun runner profile for opensrc tests (#214)
1 parent 6006dd5 commit 8f9aaf6

1 file changed

Lines changed: 54 additions & 14 deletions

File tree

.github/workflows/test-opensrc.yml

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ on:
1515
options:
1616
- ubuntu-24.04-arm
1717
- ubuntu-latest
18+
- aliyun-ecs-x64
1819
default: ubuntu-latest
1920
rebuildDiskCache:
2021
description: "Rebuild disk cache"
2122
type: boolean
2223
default: false
2324
concurrency:
24-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.runs-on || 'ubuntu-latest' }}
25+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest' }}
2526
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2627
jobs:
27-
test:
28-
strategy:
28+
test-github:
29+
if: ${{ (inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest') == 'ubuntu-latest' || (inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest') == 'ubuntu-24.04-arm' }}
30+
strategy: &test_strategy
2931
fail-fast: false
3032
matrix:
3133
include:
@@ -39,7 +41,7 @@ jobs:
3941
test_target: "//kv_cache_manager/client/..."
4042
test_args: "--config=client"
4143
name: ${{ matrix.name }}
42-
runs-on: ${{ inputs.runs-on || 'ubuntu-latest' }}
44+
runs-on: ${{ inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest' }}
4345
container:
4446
image: ghcr.io/alibaba/tair-kvcache-kvcm-dev:2026_02_13_12_03_24230b1
4547
volumes:
@@ -57,18 +59,22 @@ jobs:
5759
rm -rf /host_root/opt/ghc
5860
echo "Disk space after cleanup:"
5961
df -h
60-
- uses: actions/checkout@v4
61-
- uses: bazel-contrib/setup-bazel@0.18.0
62+
- &checkout_step
63+
uses: actions/checkout@v4
64+
- &setup_bazel_step
65+
uses: bazel-contrib/setup-bazel@0.18.0
6266
with:
6367
bazelisk-cache: true
6468
disk-cache: ${{ runner.os }}-${{ github.workflow }}-${{ matrix.name }}
6569
repository-cache: true
6670
cache-save: ${{ inputs.rebuildDiskCache || false }}
67-
- name: clean_disk_cache
71+
- &clean_disk_cache_step
72+
name: clean_disk_cache
6873
if: ${{ inputs.rebuildDiskCache || false }}
6974
run: |
7075
rm -rf ~/.cache/bazel-disk
71-
- name: setup_coredump
76+
- &setup_coredump_step
77+
name: setup_coredump
7278
run: |
7379
set -x
7480
# Create directory for core dumps
@@ -78,13 +84,15 @@ jobs:
7884
echo "/tmp/corefile/core.%e.%p.%s.%t" > /proc/sys/kernel/core_pattern
7985
# Verify configuration
8086
echo "core_pattern: $(cat /proc/sys/kernel/core_pattern)"
81-
- name: bazel_test
87+
- &bazel_test_step
88+
name: bazel_test
8289
run: |
8390
set -x
8491
set -e
8592
ulimit -c unlimited
8693
bazelisk test ${{ matrix.test_target }} ${{ matrix.test_args }} --cache_test_results=no --test_output=errors
87-
- name: delete_old_disk_cache
94+
- &delete_old_disk_cache_step
95+
name: delete_old_disk_cache
8896
if: ${{ inputs.rebuildDiskCache || false }}
8997
env:
9098
GH_TOKEN: ${{ github.token }}
@@ -105,7 +113,8 @@ jobs:
105113
jq -r --arg arch "$RUNNER_ARCH_LOWER" --arg name "$DISK_CACHE_NAME" \
106114
'.[] | select((.key | contains($arch)) and (.key | contains($name))) | .id' | \
107115
xargs -I {} gh cache delete {} --repo ${{ github.repository }} || true
108-
- name: detect_crashes
116+
- &detect_crashes_step
117+
name: detect_crashes
109118
if: failure()
110119
run: |
111120
set +e
@@ -149,7 +158,8 @@ jobs:
149158
fi
150159
fi
151160
done
152-
- name: create_archive
161+
- &create_archive_step
162+
name: create_archive
153163
if: failure()
154164
run: |
155165
set -x
@@ -170,9 +180,39 @@ jobs:
170180
if [ -f bazel-out.tar ]; then
171181
gzip -f bazel-out.tar
172182
fi
173-
- uses: actions/upload-artifact@v6
183+
- &upload_artifact_step
184+
uses: actions/upload-artifact@v6
174185
if: failure()
175186
with:
176187
name: ${{ matrix.name }}-bazel-out.tar.gz
177188
path: ./bazel-out.tar.gz
178-
overwrite: true
189+
overwrite: true
190+
191+
test-aliyun:
192+
if: ${{ (inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest') == 'aliyun-ecs-x64' }}
193+
strategy: *test_strategy
194+
name: ${{ matrix.name }}
195+
runs-on: aliyun-ecs-x64
196+
container:
197+
image: ghcr.io/alibaba/tair-kvcache-kvcm-dev:2026_02_13_12_03_24230b1
198+
options: --privileged
199+
steps:
200+
- *checkout_step
201+
- *setup_bazel_step
202+
- *clean_disk_cache_step
203+
- *setup_coredump_step
204+
- *bazel_test_step
205+
- *delete_old_disk_cache_step
206+
- *detect_crashes_step
207+
- *create_archive_step
208+
- *upload_artifact_step
209+
210+
validate-runner-selection:
211+
if: ${{ (inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest') != 'ubuntu-latest' && (inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest') != 'ubuntu-24.04-arm' && (inputs.runs-on || vars.TEST_OPEN_SRC_RUNS_ON || 'ubuntu-latest') != 'aliyun-ecs-x64' }}
212+
name: validate_runner_selection
213+
runs-on: ubuntu-latest
214+
steps:
215+
- name: fail_invalid_runner_selection
216+
run: |
217+
echo "::error::Invalid runner selection. Set runs-on or TEST_OPEN_SRC_RUNS_ON to one of: ubuntu-latest, ubuntu-24.04-arm, aliyun-ecs-x64."
218+
exit 1

0 commit comments

Comments
 (0)