1+ ---
12name : Self-Hosted Runner Test
23
3- on :
4+ " on " :
45 workflow_dispatch :
56 push :
6- branches : [ main ]
7+ branches : [main]
78 paths :
89 - ' .github/workflows/self-hosted-runner.yml'
910
@@ -14,35 +15,41 @@ permissions:
1415jobs :
1516 test-self-hosted-x86 :
1617 runs-on : [self-hosted, x86_64]
17- if : ${{ contains(github.event.head_commit.message, '[test-runner]') || github.event_name == 'workflow_dispatch' }}
18-
18+ if : >-
19+ ${{ contains(github.event.head_commit.message, '[test-runner]')
20+ || github.event_name == 'workflow_dispatch' }}
1921 steps :
2022 - name : System Information
2123 run : |
2224 echo "## 🖥️ Self-Hosted Runner Information" >> $GITHUB_STEP_SUMMARY
2325 echo "" >> $GITHUB_STEP_SUMMARY
2426 echo "- **Architecture**: $(uname -m)" >> $GITHUB_STEP_SUMMARY
25- echo "- **OS**: $(cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2 | tr -d '\"')" >> $GITHUB_STEP_SUMMARY
27+ OS_REL="/etc/os-release"
28+ OS_NAME=$(cat $OS_REL | grep PRETTY_NAME | cut -d= -f2 | tr -d '\"')
29+ echo "- **OS**: $OS_NAME" >> $GITHUB_STEP_SUMMARY
2630 echo "- **CPU Cores**: $(nproc)" >> $GITHUB_STEP_SUMMARY
27- echo "- **Memory**: $(free -h | grep Mem | awk '{print $2}')" >> $GITHUB_STEP_SUMMARY
28- echo "- **Disk**: $(df -h / | tail -1 | awk '{print $4}') available" >> $GITHUB_STEP_SUMMARY
31+ MEM=$(free -h | grep Mem | awk '{print $2}')
32+ echo "- **Memory**: $MEM" >> $GITHUB_STEP_SUMMARY
33+ DISK=$(df -h / | tail -1 | awk '{print $4}')
34+ echo "- **Disk**: $DISK available" >> $GITHUB_STEP_SUMMARY
2935 echo "" >> $GITHUB_STEP_SUMMARY
30-
36+
3137 - name : Check Docker
3238 run : |
3339 docker --version
3440 docker info
3541 echo "✅ Docker is available" >> $GITHUB_STEP_SUMMARY
36-
42+
3743 - name : Checkout repository
3844 uses : actions/checkout@v4
39-
45+
4046 - name : Build Docker image on self-hosted runner
4147 run : |
4248 echo "🔨 Building Docker image on self-hosted x86_64 runner..."
4349 docker build -t ipfs-datasets-py:self-hosted -f Dockerfile.test .
44- echo "✅ Docker image built successfully" >> $GITHUB_STEP_SUMMARY
45-
50+ MSG="✅ Docker image built successfully"
51+ echo "$MSG" >> $GITHUB_STEP_SUMMARY
52+
4653 - name : Test Docker image
4754 run : |
4855 echo "🧪 Testing Docker image..."
@@ -51,12 +58,12 @@ jobs:
5158 print(f'Python: {sys.version}')
5259 print(f'Platform: {platform.platform()}')
5360 print(f'Machine: {platform.machine()}')
54-
61+
5562 import ipfs_datasets_py
5663 print('✅ Package imported successfully')
5764 "
5865 echo "✅ Docker container test passed" >> $GITHUB_STEP_SUMMARY
59-
66+
6067 - name : Cleanup
6168 if : always()
6269 run : |
@@ -68,27 +75,31 @@ jobs:
6875 container :
6976 image : python:3.12-slim
7077 options : --user root
71-
78+
7279 steps :
7380 - name : System Information
7481 run : |
7582 echo "## 🐙 GitHub-Hosted Runner Information" >> $GITHUB_STEP_SUMMARY
7683 echo "" >> $GITHUB_STEP_SUMMARY
7784 echo "- **Architecture**: $(uname -m)" >> $GITHUB_STEP_SUMMARY
78- echo "- **OS**: $(cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2 | tr -d '\"')" >> $GITHUB_STEP_SUMMARY
85+ OS_REL="/etc/os-release"
86+ OS_NAME=$(cat $OS_REL | grep PRETTY_NAME | cut -d= -f2 | tr -d '\"')
87+ echo "- **OS**: $OS_NAME" >> $GITHUB_STEP_SUMMARY
7988 echo "- **CPU Cores**: $(nproc)" >> $GITHUB_STEP_SUMMARY
80- echo "- **Memory**: $(free -h | grep Mem | awk '{print $2}')" >> $GITHUB_STEP_SUMMARY
89+ MEM=$(free -h | grep Mem | awk '{print $2}')
90+ echo "- **Memory**: $MEM" >> $GITHUB_STEP_SUMMARY
8191 echo "" >> $GITHUB_STEP_SUMMARY
82-
92+
8393 - name : Checkout repository
8494 uses : actions/checkout@v4
85-
95+
8696 - name : Build Docker image on GitHub runner
8797 run : |
8898 echo "🔨 Building Docker image on GitHub-hosted runner..."
8999 docker build -t ipfs-datasets-py:github-hosted -f Dockerfile.test .
90- echo "✅ Docker image built successfully" >> $GITHUB_STEP_SUMMARY
91-
100+ MSG="✅ Docker image built successfully"
101+ echo "$MSG" >> $GITHUB_STEP_SUMMARY
102+
92103 - name : Test Docker image
93104 run : |
94105 echo "🧪 Testing Docker image..."
97108 print(f'Python: {sys.version}')
98109 print(f'Platform: {platform.platform()}')
99110 print(f'Machine: {platform.machine()}')
100-
111+
101112 import ipfs_datasets_py
102113 print('✅ Package imported successfully')
103114 "
@@ -110,25 +121,30 @@ jobs:
110121 options : --user root
111122 needs : [test-self-hosted-x86, test-github-hosted]
112123 if : always()
113-
124+
114125 steps :
115126 - name : Runner Comparison Summary
116127 run : |
117128 echo "## 📊 Runner Comparison" >> $GITHUB_STEP_SUMMARY
118129 echo "" >> $GITHUB_STEP_SUMMARY
119130 echo "| Runner Type | Status |" >> $GITHUB_STEP_SUMMARY
120131 echo "|------------|--------|" >> $GITHUB_STEP_SUMMARY
121- echo "| Self-Hosted x86_64 | ${{ needs.test-self-hosted-x86.result }} |" >> $GITHUB_STEP_SUMMARY
122- echo "| GitHub-Hosted | ${{ needs.test-github-hosted.result }} |" >> $GITHUB_STEP_SUMMARY
132+ SELF_RESULT="${{ needs.test-self-hosted-x86.result }}"
133+ echo "| Self-Hosted x86_64 | $SELF_RESULT |" >> $GITHUB_STEP_SUMMARY
134+ GH_RESULT="${{ needs.test-github-hosted.result }}"
135+ echo "| GitHub-Hosted | $GH_RESULT |" >> $GITHUB_STEP_SUMMARY
123136 echo "" >> $GITHUB_STEP_SUMMARY
124-
137+
125138 if [ "${{ needs.test-self-hosted-x86.result }}" = "success" ]; then
126- echo "✅ Self-hosted runner is configured and working!" >> $GITHUB_STEP_SUMMARY
139+ MSG="✅ Self-hosted runner is configured and working!"
140+ echo "$MSG" >> $GITHUB_STEP_SUMMARY
127141 else
128- echo "⚠️ Self-hosted runner test was skipped or failed." >> $GITHUB_STEP_SUMMARY
142+ MSG="⚠️ Self-hosted runner test was skipped or failed."
143+ echo "$MSG" >> $GITHUB_STEP_SUMMARY
129144 echo "To set up a self-hosted runner:" >> $GITHUB_STEP_SUMMARY
130145 echo "1. Go to Settings > Actions > Runners" >> $GITHUB_STEP_SUMMARY
131146 echo "2. Click 'New self-hosted runner'" >> $GITHUB_STEP_SUMMARY
132147 echo "3. Follow the setup instructions" >> $GITHUB_STEP_SUMMARY
133- echo "4. Add labels: \`self-hosted\`, \`x86_64\`" >> $GITHUB_STEP_SUMMARY
148+ LBL='4. Add labels: `self-hosted`, `x86_64`'
149+ echo "$LBL" >> $GITHUB_STEP_SUMMARY
134150 fi
0 commit comments