Add GitHub Actions workflow for testing multiple containers
This commit is contained in:
1 parent
ba55116491
commit
9da662f8d6
1 file changed
+58
@@ -0,0 +1,58 @@
|
||||
name: Test Matrix
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test-distros:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
container:
|
||||
- 'debian:11'
|
||||
- 'debian:12'
|
||||
- 'ubuntu:22.04'
|
||||
- 'alpine:latest'
|
||||
- 'almalinux:9' # 推荐:CentOS 9 的完美替代
|
||||
- 'rockylinux:9' # 推荐:CentOS 9 的完美替代
|
||||
- 'centos:7' # 官方 CentOS 7 (需修复源)
|
||||
- 'quay.io/centos/centos:stream9' # 官方 CentOS Stream 9 (原生可用)
|
||||
|
||||
container:
|
||||
image: ${{ matrix.container }}
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# === 关键:针对旧版 CentOS 的“起死回生”补丁 ===
|
||||
- name: Fix CentOS EOL Repos
|
||||
run: |
|
||||
# 如果是 CentOS 8 (已死),需要切到 vault 源
|
||||
if grep -q "CentOS Linux 8" /etc/os-release 2>/dev/null; then
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
|
||||
fi
|
||||
|
||||
# 如果是 CentOS 7 (已死),同样需要切到 vault 源
|
||||
if grep -q "CentOS Linux 7" /etc/os-release 2>/dev/null; then
|
||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Base.repo
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Base.repo
|
||||
fi
|
||||
|
||||
- name: Pre-install basic requirements
|
||||
run: |
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
apk add --no-cache curl sudo openssh-server
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
apt-get update && apt-get install -y curl sudo openssh-server
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# CentOS/Alma/Rocky 都在这里
|
||||
dnf install -y curl sudo openssh-server || yum install -y curl sudo openssh-server
|
||||
fi
|
||||
|
||||
- name: Run Init Script
|
||||
run: |
|
||||
chmod +x init.sh
|
||||
./init.sh --user=root --port=2222 --key-raw="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPQQDejyTCPJO3Jyw5UX9jmojb/zjgcqVuRO28fmpWU5" --no-update --bbr --delay-restart --yes --strict
|
||||
Reference in new issue
Block a user