|
| 1 | +# |
| 2 | +# Copyright (c) 2026 Huawei Technologies Co., Ltd. All Rights Reserved. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# This file is a part of the vllm-ascend project. |
| 16 | +# |
| 17 | + |
| 18 | +name: 'Validate: Basic Actions on Self-Hosted' |
| 19 | + |
| 20 | +on: |
| 21 | + workflow_dispatch: |
| 22 | + |
| 23 | +defaults: |
| 24 | + run: |
| 25 | + shell: bash -el {0} |
| 26 | + |
| 27 | +jobs: |
| 28 | + validate-basic-actions: |
| 29 | + name: validate-basic-actions-on-${{ matrix.runner }} |
| 30 | + runs-on: ${{ matrix.runner }} |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + runner: |
| 35 | + - linux-amd64-cpu-4-hk |
| 36 | + - linux-amd64-cpu-8-hk |
| 37 | + - linux-arm64-cpu-16 |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Checkout repo |
| 41 | + uses: actions/checkout@v7 |
| 42 | + |
| 43 | + - name: Setup Python |
| 44 | + uses: actions/setup-python@v6 |
| 45 | + with: |
| 46 | + python-version: '3.12' |
| 47 | + |
| 48 | + - name: Verify checkout and python |
| 49 | + run: | |
| 50 | + echo "Runner: ${{ matrix.runner }}" |
| 51 | + echo "Arch: $(uname -m)" |
| 52 | + echo "Python: $(python3 --version)" |
| 53 | + echo "Git: $(git --version)" |
| 54 | + echo "Repo files: $(ls -1 | head -5)" |
| 55 | + test -f setup.py && echo "checkout OK" || echo "checkout FAILED" |
| 56 | +
|
| 57 | + - name: Cache pip packages |
| 58 | + id: cache-pip |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: ~/.cache/pip |
| 62 | + key: validate-basic-actions-pip-${{ matrix.runner }}-${{ hashFiles('requirements.txt') }} |
| 63 | + restore-keys: | |
| 64 | + validate-basic-actions-pip-${{ matrix.runner }}- |
| 65 | +
|
| 66 | + - name: Install a small pip package (cache miss test) |
| 67 | + if: steps.cache-pip.outputs.cache-hit != 'true' |
| 68 | + run: pip install pyyaml |
| 69 | + |
| 70 | + - name: Verify cache hit on rerun |
| 71 | + if: steps.cache-pip.outputs.cache-hit == 'true' |
| 72 | + run: echo "Cache restored successfully" |
| 73 | + |
| 74 | + - name: Create test artifact content |
| 75 | + run: | |
| 76 | + mkdir -p /tmp/validate-artifact |
| 77 | + echo "runner=${{ matrix.runner }}" > /tmp/validate-artifact/info.txt |
| 78 | + echo "arch=$(uname -m)" >> /tmp/validate-artifact/info.txt |
| 79 | + echo "python=$(python3 --version)" >> /tmp/validate-artifact/info.txt |
| 80 | + echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> /tmp/validate-artifact/info.txt |
| 81 | +
|
| 82 | + - name: Upload artifact |
| 83 | + uses: actions/upload-artifact@v7 |
| 84 | + with: |
| 85 | + name: validate-basic-${{ matrix.runner }} |
| 86 | + path: /tmp/validate-artifact/ |
| 87 | + retention-days: 1 |
| 88 | + |
| 89 | + - name: Verify upload |
| 90 | + run: echo "Upload artifact step completed for runner=${{ matrix.runner }}" |
| 91 | + |
| 92 | + validate-download-and-script: |
| 93 | + name: validate-download-artifact-and-github-script |
| 94 | + runs-on: linux-amd64-cpu-4-hk |
| 95 | + needs: validate-basic-actions |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Download artifact |
| 99 | + uses: actions/download-artifact@v8 |
| 100 | + with: |
| 101 | + pattern: validate-basic-* |
| 102 | + merge-multiple: true |
| 103 | + path: /tmp/downloaded-artifacts |
| 104 | + |
| 105 | + - name: Verify downloaded artifact |
| 106 | + run: | |
| 107 | + echo "Downloaded artifacts:" |
| 108 | + ls -la /tmp/downloaded-artifacts/ |
| 109 | + cat /tmp/downloaded-artifacts/info.txt || true |
| 110 | + test -d /tmp/downloaded-artifacts && echo "download OK" || echo "download FAILED" |
| 111 | +
|
| 112 | + - name: GitHub script validation |
| 113 | + uses: actions/github-script@v9 |
| 114 | + with: |
| 115 | + script: | |
| 116 | + const runner = process.env.RUNNER_OS || 'unknown'; |
| 117 | + console.log(`github-script works on self-hosted runner`); |
| 118 | + console.log(`Runner OS: ${runner}`); |
| 119 | + console.log(`Repository: ${context.repo.owner}/${context.repo.repo}`); |
| 120 | + console.log(`Workflow: ${context.workflow}`); |
| 121 | + console.log(`Action: ${context.action}`); |
| 122 | + return { success: true, runner: runner }; |
| 123 | +
|
| 124 | + - name: Verify github-script output |
| 125 | + run: echo "GitHub script validation completed successfully" |
| 126 | + |
| 127 | + validate-cache-restore-save: |
| 128 | + name: validate-cache-restore-save-flow |
| 129 | + runs-on: linux-amd64-cpu-4-hk |
| 130 | + |
| 131 | + steps: |
| 132 | + - name: Checkout repo |
| 133 | + uses: actions/checkout@v7 |
| 134 | + |
| 135 | + - name: Cache restore |
| 136 | + id: cache-restore |
| 137 | + uses: actions/cache/restore@v4 |
| 138 | + with: |
| 139 | + path: /tmp/cache-test-dir |
| 140 | + key: validate-cache-restore-save-test-${{ github.run_id }} |
| 141 | + |
| 142 | + - name: Create cache content (first run) |
| 143 | + if: steps.cache-restore.outputs.cache-hit != 'true' |
| 144 | + run: | |
| 145 | + mkdir -p /tmp/cache-test-dir |
| 146 | + echo "cached at $(date -u +%Y-%m-%dT%H:%M:%SZ)" > /tmp/cache-test-dir/timestamp.txt |
| 147 | +
|
| 148 | + - name: Cache save |
| 149 | + if: steps.cache-restore.outputs.cache-hit != 'true' |
| 150 | + uses: actions/cache/save@v4 |
| 151 | + with: |
| 152 | + path: /tmp/cache-test-dir |
| 153 | + key: validate-cache-restore-save-test-${{ github.run_id }} |
| 154 | + |
| 155 | + - name: Verify cache flow |
| 156 | + run: | |
| 157 | + if [ "${{ steps.cache-restore.outputs.cache-hit }}" == "true" ]; then |
| 158 | + echo "Cache hit - restore/save flow OK" |
| 159 | + else |
| 160 | + echo "Cache miss - saved new entry, verify on rerun" |
| 161 | + fi |
0 commit comments