Skip to content

Commit 8579dca

Browse files
committed
fedora test
1 parent 1785d4b commit 8579dca

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/fedora_test.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 工作流的名称
2+
name: Fedora Environment and Shell Test
3+
4+
# 触发工作流的事件
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
13+
# 定义一个名为 'test' 的任务
14+
jobs:
15+
test:
16+
# 任务在 'ubuntu-latest' 虚拟机上运行
17+
runs-on: ubuntu-latest
18+
19+
# 关键步骤:指定一个 Fedora Docker 容器,
20+
# 任务中的所有 'run' 步骤都会在这个容器内执行。
21+
container: fedora:latest
22+
23+
# 任务执行的步骤
24+
steps:
25+
# 第一步:检出你的代码仓库
26+
- name: Checkout Repository
27+
uses: actions/checkout@v5
28+
29+
# 第二步:显示 Fedora 的环境信息
30+
- name: Display Fedora Environment Details
31+
run: |
32+
echo "--- Fedora Environment ---"
33+
echo "OS Version:"
34+
cat /etc/os-release
35+
echo "Kernel Info:"
36+
uname -a
37+
uname -m
38+
echo "--- CPU Brand String ---"
39+
cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F': ' '{print $2}'
40+
echo "--- IP Info ---"
41+
/sbin/ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}'
42+
echo "Current User:"
43+
whoami
44+
echo "Default Shell:"
45+
echo $SHELL
46+
47+
echo "--- sh Info ---"
48+
type -a sh
49+
sh --version
50+
echo "--- bash Info ---"
51+
type -a bash
52+
bash --version
53+
echo "--- zsh Info ---"
54+
type -a zsh
55+
zsh --version
56+
57+
# 第三步:执行一些 Shell 命令
58+
- name: Run a few Shell Commands
59+
run: |
60+
echo "Listing files in current directory:"
61+
ls -la
62+
echo "Installing a tool with DNF (e.g., git):"
63+
dnf install -y git
64+
echo "git installed, checking version:"
65+
git --version
66+
67+
# 第四步:执行一个脚本文件
68+
- name: Run a custom shell script
69+
run: |
70+
echo "Executing test_script.sh from the repository..."
71+
# 确保脚本文件有执行权限
72+
chmod +x ./test_script.sh
73+
# 运行脚本
74+
./test_script.sh

0 commit comments

Comments
 (0)