-
Notifications
You must be signed in to change notification settings - Fork 0
✨ 添加完整的GitHub Actions CI系统 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d43cf2
✨ 添加完整的GitHub Actions CI系统
ChHsiching 4b87b4e
🔧 清理gitignore规则,移除test_*模式以支持CI测试
ChHsiching abc2363
🔧 修复CI系统的Fish语法和兼容性问题
ChHsiching 53391cc
🔧 修复CI系统的关键语法和兼容性问题
ChHsiching 8f89c07
🔧 修复CI测试脚本的变量引用和递归调用问题
ChHsiching cae5953
🔧 修复CI测试脚本的安全性和变量引用问题
ChHsiching File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: Fish Shell Syntax & Functionality Check | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
|
|
||
| jobs: | ||
| fish-syntax: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Fish shell (Ubuntu) | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y fish | ||
| fish --version | ||
|
|
||
| - name: Install Fish shell (macOS) | ||
| if: matrix.os == 'macos-latest' | ||
| run: | | ||
| brew install fish | ||
| fish --version | ||
|
|
||
| - name: Verify Fish installation and version | ||
| run: | | ||
| echo "Testing Fish shell installation..." | ||
| fish --version | ||
| echo "Current Fish version:" | ||
| fish -c "echo $version" | ||
| echo "Fish version compatibility test passed" | ||
|
|
||
| - name: Check Fish syntax | ||
| run: | | ||
| # Check syntax for all .fish files | ||
| for file in *.fish; do | ||
| if [ -f "$file" ]; then | ||
| echo "Checking syntax for $file..." | ||
| fish -c "source $file" || { | ||
| echo "❌ Syntax error in $file" | ||
| exit 1 | ||
| } | ||
| echo "✅ $file syntax OK" | ||
| fi | ||
| done | ||
|
|
||
| - name: Test function loading | ||
| run: | | ||
| # Test that functions can be loaded without errors | ||
| fish -c " | ||
| # Test nvm function definition | ||
| source nvm.fish | ||
| functions -t nvm | ||
| echo '✅ nvm function loaded successfully' | ||
|
|
||
| # Test helper functions | ||
| if functions -q __nvm_handle_nvmrc_file | ||
| echo '✅ Helper functions available' | ||
| end | ||
| " || { | ||
| echo "❌ Function loading test failed" | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Validate PKGBUILD | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: | | ||
| # Check if PKGBUILD is valid bash | ||
| bash -n PKGBUILD | ||
| echo "✅ PKGBUILD syntax OK" | ||
|
|
||
| - name: Check file permissions | ||
| run: | | ||
| # Ensure fish files are executable | ||
| chmod +x *.fish 2>/dev/null || true | ||
| echo "✅ File permissions set" | ||
|
|
||
| - name: Run CI test script | ||
| run: | | ||
| # Run our comprehensive test suite | ||
| fish test_ci.fish | ||
| echo "✅ CI tests passed" | ||
|
|
||
| code-quality: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Check for common issues | ||
| run: | | ||
| echo "🔍 Checking code quality..." | ||
|
|
||
| # Check for deprecated syntax | ||
| if grep -q 'test.*[[:space:]]-a[[:space:]]' *.fish; then | ||
| echo "❌ Found deprecated '-a' operator in test commands" | ||
| exit 1 | ||
| fi | ||
| echo "✅ No deprecated syntax found" | ||
|
|
||
| # Check for proper error handling | ||
| if grep -q "echo.*error" *.fish | grep -v ">"; then | ||
|
ChHsiching marked this conversation as resolved.
|
||
| echo "⚠️ Consider redirecting error messages to stderr" | ||
| fi | ||
| echo "✅ Error handling check completed" | ||
|
|
||
| # Check file sizes | ||
| for file in *.fish; do | ||
| if [ -f "$file" ]; then | ||
| lines=$(wc -l < "$file") | ||
| if [ "$lines" -gt 500 ]; then | ||
| echo "⚠️ $file is large ($lines lines), consider refactoring" | ||
| fi | ||
| fi | ||
| done | ||
| echo "✅ File size check completed" | ||
|
|
||
| security-scan: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Security check | ||
| run: | | ||
| echo "🔒 Running security checks..." | ||
|
|
||
| # Check for potential security issues | ||
| if grep -q "rm -rf" *.fish *.sh 2>/dev/null; then | ||
| echo "⚠️ Found 'rm -rf' usage - review for security" | ||
| fi | ||
|
|
||
| # Check for eval usage | ||
| if grep -q "eval" *.fish *.sh 2>/dev/null; then | ||
| echo "⚠️ Found 'eval' usage - review for security" | ||
| fi | ||
|
|
||
| # Check for hardcoded paths | ||
| if grep -q "/home/" *.fish *.sh 2>/dev/null | grep -v "#"; then | ||
|
ChHsiching marked this conversation as resolved.
|
||
| echo "⚠️ Found hardcoded paths - consider using variables" | ||
|
ChHsiching marked this conversation as resolved.
|
||
| fi | ||
|
|
||
| echo "✅ Security scan completed" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.