|
8 | 8 | - master |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - docker-os-matrix: |
| 11 | + # ============================================================ |
| 12 | + # Job 1: ShellCheck 静态分析 |
| 13 | + # ============================================================ |
| 14 | + shellcheck: |
| 15 | + name: ShellCheck Lint |
| 16 | + runs-on: ubuntu-latest |
| 17 | + timeout-minutes: 5 |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install ShellCheck |
| 24 | + run: sudo apt-get update -qq && sudo apt-get install -y shellcheck |
| 25 | + |
| 26 | + - name: Lint docker.sh |
| 27 | + run: shellcheck -x -s bash docker.sh |
| 28 | + |
| 29 | + - name: Lint tests/run_os_matrix.sh |
| 30 | + run: shellcheck -x -s bash tests/run_os_matrix.sh |
| 31 | + |
| 32 | + # ============================================================ |
| 33 | + # Job 2: RPM 系发行版矩阵 |
| 34 | + # ============================================================ |
| 35 | + rpm-matrix: |
| 36 | + name: "RPM: ${{ matrix.image }}" |
| 37 | + runs-on: ubuntu-latest |
| 38 | + timeout-minutes: 10 |
| 39 | + |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + include: |
| 44 | + - image: "rockylinux:8" |
| 45 | + os_id: rhel |
| 46 | + version: "8" |
| 47 | + expected_pkg: dnf |
| 48 | + expected_repo: "centos/8" |
| 49 | + - image: "rockylinux:9" |
| 50 | + os_id: rhel |
| 51 | + version: "9" |
| 52 | + expected_pkg: dnf |
| 53 | + expected_repo: "centos/9" |
| 54 | + - image: "quay.io/centos/centos:stream10" |
| 55 | + os_id: rhel |
| 56 | + version: "10" |
| 57 | + expected_pkg: dnf |
| 58 | + expected_repo: "centos/10" |
| 59 | + - image: "almalinux:8" |
| 60 | + os_id: rhel |
| 61 | + version: "8" |
| 62 | + expected_pkg: dnf |
| 63 | + expected_repo: "centos/8" |
| 64 | + - image: "almalinux:9" |
| 65 | + os_id: rhel |
| 66 | + version: "9" |
| 67 | + expected_pkg: dnf |
| 68 | + expected_repo: "centos/9" |
| 69 | + - image: "oraclelinux:8" |
| 70 | + os_id: ol |
| 71 | + version: "8" |
| 72 | + expected_pkg: dnf |
| 73 | + expected_repo: "centos/8" |
| 74 | + - image: "oraclelinux:9" |
| 75 | + os_id: ol |
| 76 | + version: "9" |
| 77 | + expected_pkg: dnf |
| 78 | + expected_repo: "centos/9" |
| 79 | + - image: "openanolis/anolisos:23" |
| 80 | + os_id: anolis |
| 81 | + version: "23" |
| 82 | + expected_pkg: dnf |
| 83 | + expected_repo: "centos/9" |
| 84 | + - image: "opencloudos/opencloudos9-minimal" |
| 85 | + os_id: opencloudos |
| 86 | + version: "9.4" |
| 87 | + expected_pkg: dnf |
| 88 | + expected_repo: "centos/9" |
| 89 | + - image: "openeuler/openeuler:24.03-lts" |
| 90 | + os_id: openeuler |
| 91 | + version: "24.03" |
| 92 | + expected_pkg: dnf |
| 93 | + expected_repo: "centos/9" |
| 94 | + |
| 95 | + steps: |
| 96 | + - name: Checkout |
| 97 | + uses: actions/checkout@v4 |
| 98 | + |
| 99 | + - name: Pull image |
| 100 | + run: docker pull "${{ matrix.image }}" |
| 101 | + |
| 102 | + - name: Run TEST_MODE |
| 103 | + run: | |
| 104 | + output=$(docker run --rm \ |
| 105 | + -e TEST_MODE=1 \ |
| 106 | + -e OVERRIDE_OS_ID="${{ matrix.os_id }}" \ |
| 107 | + -e OVERRIDE_OS_VERSION_ID="${{ matrix.version }}" \ |
| 108 | + -v "$PWD/docker.sh:/tmp/docker.sh:ro" \ |
| 109 | + "${{ matrix.image }}" \ |
| 110 | + bash /tmp/docker.sh) |
| 111 | + echo "$output" |
| 112 | + echo "$output" | grep -q "TEST_MODE_OK" |
| 113 | + echo "$output" | grep -q "pkg=${{ matrix.expected_pkg }}" |
| 114 | + echo "$output" | grep -q "repo=${{ matrix.expected_repo }}" |
| 115 | +
|
| 116 | + - name: Summary |
| 117 | + if: always() |
| 118 | + run: | |
| 119 | + echo "### ${{ matrix.image }} (${{ matrix.os_id }} ${{ matrix.version }})" >> "$GITHUB_STEP_SUMMARY" |
| 120 | + echo "- Expected pkg: \`${{ matrix.expected_pkg }}\`" >> "$GITHUB_STEP_SUMMARY" |
| 121 | + echo "- Expected repo: \`${{ matrix.expected_repo }}\`" >> "$GITHUB_STEP_SUMMARY" |
| 122 | +
|
| 123 | + # ============================================================ |
| 124 | + # Job 3: Debian/Ubuntu 系发行版矩阵 |
| 125 | + # ============================================================ |
| 126 | + deb-matrix: |
| 127 | + name: "DEB: ${{ matrix.image }}" |
| 128 | + runs-on: ubuntu-latest |
| 129 | + timeout-minutes: 10 |
| 130 | + |
| 131 | + strategy: |
| 132 | + fail-fast: false |
| 133 | + matrix: |
| 134 | + include: |
| 135 | + - image: "ubuntu:24.04" |
| 136 | + os_id: ubuntu |
| 137 | + version: "24.04" |
| 138 | + expected_pkg: apt-get |
| 139 | + expected_repo: "ubuntu/noble" |
| 140 | + - image: "ubuntu:22.04" |
| 141 | + os_id: ubuntu |
| 142 | + version: "22.04" |
| 143 | + expected_pkg: apt-get |
| 144 | + expected_repo: "ubuntu/jammy" |
| 145 | + - image: "ubuntu:20.04" |
| 146 | + os_id: ubuntu |
| 147 | + version: "20.04" |
| 148 | + expected_pkg: apt-get |
| 149 | + expected_repo: "ubuntu/focal" |
| 150 | + - image: "debian:12" |
| 151 | + os_id: debian |
| 152 | + version: "12" |
| 153 | + expected_pkg: apt-get |
| 154 | + expected_repo: "debian/bookworm" |
| 155 | + - image: "debian:11" |
| 156 | + os_id: debian |
| 157 | + version: "11" |
| 158 | + expected_pkg: apt-get |
| 159 | + expected_repo: "debian/bullseye" |
| 160 | + |
| 161 | + steps: |
| 162 | + - name: Checkout |
| 163 | + uses: actions/checkout@v4 |
| 164 | + |
| 165 | + - name: Pull image |
| 166 | + run: docker pull "${{ matrix.image }}" |
| 167 | + |
| 168 | + - name: Run TEST_MODE |
| 169 | + run: | |
| 170 | + output=$(docker run --rm \ |
| 171 | + -e TEST_MODE=1 \ |
| 172 | + -e OVERRIDE_OS_ID="${{ matrix.os_id }}" \ |
| 173 | + -e OVERRIDE_OS_VERSION_ID="${{ matrix.version }}" \ |
| 174 | + -v "$PWD/docker.sh:/tmp/docker.sh:ro" \ |
| 175 | + "${{ matrix.image }}" \ |
| 176 | + bash /tmp/docker.sh) |
| 177 | + echo "$output" |
| 178 | + echo "$output" | grep -q "TEST_MODE_OK" |
| 179 | + echo "$output" | grep -q "pkg=${{ matrix.expected_pkg }}" |
| 180 | + echo "$output" | grep -q "repo=${{ matrix.expected_repo }}" |
| 181 | +
|
| 182 | + - name: Summary |
| 183 | + if: always() |
| 184 | + run: | |
| 185 | + echo "### ${{ matrix.image }} (${{ matrix.os_id }} ${{ matrix.version }})" >> "$GITHUB_STEP_SUMMARY" |
| 186 | + echo "- Expected pkg: \`${{ matrix.expected_pkg }}\`" >> "$GITHUB_STEP_SUMMARY" |
| 187 | + echo "- Expected repo: \`${{ matrix.expected_repo }}\`" >> "$GITHUB_STEP_SUMMARY" |
| 188 | +
|
| 189 | + # ============================================================ |
| 190 | + # Job 4: Fedora 矩阵 |
| 191 | + # ============================================================ |
| 192 | + fedora-matrix: |
| 193 | + name: "Fedora: ${{ matrix.image }}" |
| 194 | + runs-on: ubuntu-latest |
| 195 | + timeout-minutes: 10 |
| 196 | + |
| 197 | + strategy: |
| 198 | + fail-fast: false |
| 199 | + matrix: |
| 200 | + include: |
| 201 | + - image: "fedora:41" |
| 202 | + os_id: fedora |
| 203 | + version: "41" |
| 204 | + expected_pkg: dnf |
| 205 | + expected_repo: "fedora/41" |
| 206 | + - image: "fedora:40" |
| 207 | + os_id: fedora |
| 208 | + version: "40" |
| 209 | + expected_pkg: dnf |
| 210 | + expected_repo: "fedora/40" |
| 211 | + |
| 212 | + steps: |
| 213 | + - name: Checkout |
| 214 | + uses: actions/checkout@v4 |
| 215 | + |
| 216 | + - name: Pull image |
| 217 | + run: docker pull "${{ matrix.image }}" |
| 218 | + |
| 219 | + - name: Run TEST_MODE |
| 220 | + run: | |
| 221 | + output=$(docker run --rm \ |
| 222 | + -e TEST_MODE=1 \ |
| 223 | + -e OVERRIDE_OS_ID="${{ matrix.os_id }}" \ |
| 224 | + -e OVERRIDE_OS_VERSION_ID="${{ matrix.version }}" \ |
| 225 | + -v "$PWD/docker.sh:/tmp/docker.sh:ro" \ |
| 226 | + "${{ matrix.image }}" \ |
| 227 | + bash /tmp/docker.sh) |
| 228 | + echo "$output" |
| 229 | + echo "$output" | grep -q "TEST_MODE_OK" |
| 230 | + echo "$output" | grep -q "pkg=${{ matrix.expected_pkg }}" |
| 231 | + echo "$output" | grep -q "repo=${{ matrix.expected_repo }}" |
| 232 | +
|
| 233 | + - name: Summary |
| 234 | + if: always() |
| 235 | + run: | |
| 236 | + echo "### ${{ matrix.image }} (${{ matrix.os_id }} ${{ matrix.version }})" >> "$GITHUB_STEP_SUMMARY" |
| 237 | + echo "- Expected pkg: \`${{ matrix.expected_pkg }}\`" >> "$GITHUB_STEP_SUMMARY" |
| 238 | + echo "- Expected repo: \`${{ matrix.expected_repo }}\`" >> "$GITHUB_STEP_SUMMARY" |
| 239 | +
|
| 240 | + # ============================================================ |
| 241 | + # Job 5: 完整矩阵测试(本地脚本) |
| 242 | + # ============================================================ |
| 243 | + full-matrix-script: |
| 244 | + name: Full Matrix (Script) |
12 | 245 | runs-on: ubuntu-latest |
13 | 246 | timeout-minutes: 45 |
| 247 | + needs: [shellcheck] |
14 | 248 |
|
15 | 249 | steps: |
16 | 250 | - name: Checkout |
|
0 commit comments