Skip to content

Commit bfeef4f

Browse files
committed
test fedora arm64
1 parent efaa7fd commit bfeef4f

File tree

3 files changed

+102
-20
lines changed

3 files changed

+102
-20
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# 工作流的名称
2+
name: Fedora Environment and Shell Test (ARM64)
3+
4+
# 触发工作流的事件
5+
on:
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
13+
# 定义一个名为 'test' 的任务
14+
jobs:
15+
test-fedora-arm64:
16+
# 任务在 'ubuntu-latest' 虚拟机上运行,但会通过 QEMU 模拟 ARM64
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
# 第一步:检出你的代码仓库
21+
- name: Checkout Repository
22+
uses: actions/checkout@v5
23+
24+
# 第二步:使用 run-on-arch-action 在 Fedora ARM64 容器中运行命令
25+
- name: Display Fedora ARM64 Environment and Shell Details
26+
uses: uraimo/run-on-arch-action@v2
27+
with:
28+
# 指定架构为 ARM64
29+
arch: aarch64
30+
# 指定操作系统为 Fedora 最新版
31+
distro: fedora_latest
32+
# 这里的所有命令都会在 Fedora ARM64 环境中执行
33+
run: |
34+
echo "--- Fedora ARM64 Environment ---"
35+
echo "OS Version:"
36+
cat /etc/os-release
37+
echo "Kernel Info:"
38+
uname -a
39+
uname -m
40+
echo "--- CPU Brand String ---"
41+
# 注意:在 QEMU 模拟环境中,/proc/cpuinfo 可能不会显示真实的 CPU 品牌
42+
echo "CPU brand string might be generic due to QEMU emulation."
43+
cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F': ' '{print $2}'
44+
echo "--- IP Info ---"
45+
hostname -I | cut -d' ' -f1
46+
echo "Current User:"
47+
whoami
48+
echo "Default Shell:"
49+
echo $SHELL
50+
51+
# 第三步:执行一些 Shell 命令
52+
- name: Run a few Shell Commands
53+
uses: uraimo/run-on-arch-action@v2
54+
with:
55+
# 指定架构为 ARM64
56+
arch: aarch64
57+
# 指定操作系统为 Fedora 最新版
58+
distro: fedora_latest
59+
# 这里的所有命令都会在 Fedora ARM64 环境中执行
60+
run: |
61+
echo "Listing files in current directory:"
62+
ls -la
63+
echo "--- sh Info ---"
64+
type -a sh
65+
sh --version
66+
echo "--- bash Info ---"
67+
type -a bash
68+
bash --version
69+
echo "--- zsh Info ---"
70+
! type zsh &>/dev/null && dnf install -y zsh || echo "zsh installed"
71+
type -a zsh
72+
zsh --version
73+
echo "--- util-linux ---"
74+
! type chsh &>/dev/null && dnf install -y util-linux || echo "util-linux installed"
75+
type -a chsh
76+
chsh --version
77+
78+
# 第三步:执行一个脚本文件
79+
# ⚠️ 注意:这个步骤仍将使用 run-on-arch-action 在模拟环境中运行
80+
- name: Run a custom shell script
81+
uses: uraimo/run-on-arch-action@v2
82+
with:
83+
arch: aarch64
84+
distro: fedora_latest
85+
run: |
86+
echo "Executing test_script.sh from the repository..."
87+
# 确保脚本文件有执行权限
88+
chmod +x ./test_script.sh
89+
# 运行脚本
90+
./test_script.sh

.github/workflows/fedora_test.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
# 定义一个名为 'test' 的任务
1414
jobs:
15-
test:
15+
test-fedora-x86_64:
1616
# 任务在 'ubuntu-latest' 虚拟机上运行
1717
runs-on: ubuntu-latest
1818

@@ -38,12 +38,15 @@ jobs:
3838
echo "--- CPU Brand String ---"
3939
cat /proc/cpuinfo | grep "model name" | head -n 1 | awk -F': ' '{print $2}'
4040
echo "--- IP Info ---"
41-
/sbin/ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{print $2}'
41+
hostname -I | cut -d' ' -f1
4242
echo "Current User:"
4343
whoami
4444
echo "Default Shell:"
4545
echo $SHELL
4646
47+
# 第三步:执行一些 Shell 命令
48+
- name: Run a few Shell Commands
49+
run: |
4750
echo "--- sh Info ---"
4851
type -a sh
4952
sh --version
@@ -59,16 +62,6 @@ jobs:
5962
type -a chsh
6063
chsh --version
6164
62-
# 第三步:执行一些 Shell 命令
63-
- name: Run a few Shell Commands
64-
run: |
65-
echo "Listing files in current directory:"
66-
ls -la
67-
echo "Installing a tool with DNF (e.g., git):"
68-
dnf install -y git
69-
echo "zsh installed, checking version:"
70-
git --version
71-
7265
# 第四步:执行一个脚本文件
7366
- name: Run a custom shell script
7467
run: |

.github/workflows/macos_test.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 工作流的名称
2-
name: macOS Environment and Shell Test
2+
name: macOS Environment and Shell Test (ARM64)
33

44
# 触发工作流的事件,这里是 push 和 pull request
55
on:
@@ -12,7 +12,7 @@ on:
1212

1313
# 定义一个名为 'test' 的任务
1414
jobs:
15-
test:
15+
test-macos-arm64:
1616
# 指定运行此任务的操作系统。'macos-latest' 会使用最新的 macOS 版本,
1717
# 例如 macOS-14。你也可以指定具体的版本,如 'macos-13' 或 'macos-14'。
1818
runs-on: macos-latest
@@ -40,6 +40,11 @@ jobs:
4040
echo "--- Default Shell ---"
4141
echo $SHELL
4242
43+
# 第三步:执行一些 Shell 命令
44+
- name: Run a few Shell Commands
45+
run: |
46+
echo "Listing files in current directory:"
47+
ls -la
4348
echo "--- sh Info ---"
4449
type -a sh
4550
sh --version
@@ -49,12 +54,6 @@ jobs:
4954
echo "--- zsh Info ---"
5055
type -a zsh
5156
zsh --version
52-
53-
# 第三步:执行一些 Shell 命令
54-
- name: Run a few Shell Commands
55-
run: |
56-
echo "Listing files in current directory:"
57-
ls -la
5857
echo "Checking Homebrew (pre-installed):"
5958
brew --version
6059
echo "Installing a tool with Homebrew (e.g., jq):"

0 commit comments

Comments
 (0)