Some checks failed
Test Workflow / system-info (push) Successful in 1m27s
Test Workflow / node-test (push) Successful in 59s
Test Workflow / python-test (push) Successful in 1m1s
Test Workflow / matrix-test (Current, 18) (push) Successful in 14s
Test Workflow / matrix-test (Latest, 20) (push) Successful in 22s
Test Workflow / matrix-test (Legacy, 16) (push) Successful in 22s
Test Workflow / artifact-test (push) Failing after 20s
176 lines
4.5 KiB
YAML
176 lines
4.5 KiB
YAML
name: Test Workflow
|
||
|
||
# Запускается при push в любую ветку и при pull request
|
||
on:
|
||
push:
|
||
branches: [ main, master ]
|
||
pull_request:
|
||
branches: [ main, master ]
|
||
|
||
# Также можно запустить вручную
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
# Простая проверка системы
|
||
system-info:
|
||
runs-on: ubuntu-22.04
|
||
steps:
|
||
- name: Checkout code
|
||
uses: actions/checkout@v4
|
||
|
||
- name: System Information
|
||
run: |
|
||
echo "=== System Info ==="
|
||
uname -a
|
||
echo ""
|
||
echo "=== CPU Info ==="
|
||
lscpu | head -10
|
||
echo ""
|
||
echo "=== Memory Info ==="
|
||
free -h
|
||
echo ""
|
||
echo "=== Disk Space ==="
|
||
df -h
|
||
echo ""
|
||
echo "=== Docker Version ==="
|
||
docker --version
|
||
echo ""
|
||
echo "=== Environment Variables ==="
|
||
env | grep -E "(CI|GITEA|GITHUB)" | sort
|
||
|
||
# Проверка с Node.js
|
||
node-test:
|
||
runs-on: ubuntu-22.04
|
||
steps:
|
||
- name: Checkout code
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Setup Node.js
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: '18'
|
||
|
||
- name: Node.js info
|
||
run: |
|
||
echo "Node.js version:"
|
||
node --version
|
||
echo "NPM version:"
|
||
npm --version
|
||
|
||
- name: Create test package.json
|
||
run: |
|
||
cat > package.json << 'EOF'
|
||
{
|
||
"name": "test-actions",
|
||
"version": "1.0.0",
|
||
"scripts": {
|
||
"test": "echo \"Test passed!\" && exit 0"
|
||
}
|
||
}
|
||
EOF
|
||
|
||
- name: Install dependencies
|
||
run: npm install
|
||
|
||
- name: Run tests
|
||
run: npm test
|
||
|
||
# Проверка с Python
|
||
python-test:
|
||
runs-on: ubuntu-22.04
|
||
steps:
|
||
- name: Checkout code
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Setup Python
|
||
uses: actions/setup-python@v4
|
||
with:
|
||
python-version: '3.9'
|
||
|
||
- name: Python info
|
||
run: |
|
||
echo "Python version:"
|
||
python --version
|
||
echo "Pip version:"
|
||
pip --version
|
||
|
||
- name: Create test script
|
||
run: |
|
||
cat > test_script.py << 'EOF'
|
||
import sys
|
||
import os
|
||
|
||
print("=== Python Test ===")
|
||
print(f"Python version: {sys.version}")
|
||
print(f"Platform: {sys.platform}")
|
||
print("Environment variables:")
|
||
for key in sorted(os.environ.keys()):
|
||
if any(prefix in key.upper() for prefix in ['CI', 'GITEA', 'GITHUB']):
|
||
print(f" {key}={os.environ[key]}")
|
||
|
||
print("Test completed successfully!")
|
||
EOF
|
||
|
||
- name: Run Python test
|
||
run: python test_script.py
|
||
|
||
# Параллельная матричная сборка
|
||
matrix-test:
|
||
runs-on: ubuntu-22.04
|
||
strategy:
|
||
matrix:
|
||
version: ['16', '18', '20']
|
||
include:
|
||
- version: '16'
|
||
name: 'Legacy'
|
||
- version: '18'
|
||
name: 'Current'
|
||
- version: '20'
|
||
name: 'Latest'
|
||
|
||
steps:
|
||
- name: Checkout code
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Setup Node.js ${{ matrix.version }}
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: ${{ matrix.version }}
|
||
|
||
- name: Test Node.js ${{ matrix.version }} (${{ matrix.name }})
|
||
run: |
|
||
echo "Testing Node.js ${{ matrix.version }} - ${{ matrix.name }}"
|
||
node --version
|
||
npm --version
|
||
|
||
# Тест с артефактами
|
||
artifact-test:
|
||
runs-on: ubuntu-22.04
|
||
steps:
|
||
- name: Checkout code
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Create test files
|
||
run: |
|
||
mkdir -p test-results
|
||
echo "Test run: $(date)" > test-results/test-log.txt
|
||
echo "System: $(uname -a)" >> test-results/test-log.txt
|
||
echo "User: $(whoami)" >> test-results/test-log.txt
|
||
|
||
# Создаём JSON отчёт
|
||
cat > test-results/report.json << EOF
|
||
{
|
||
"timestamp": "$(date -Iseconds)",
|
||
"status": "success",
|
||
"tests_run": 5,
|
||
"tests_passed": 5,
|
||
"tests_failed": 0
|
||
}
|
||
EOF
|
||
|
||
- name: Upload test results
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: test-results
|
||
path: test-results/
|
||
retention-days: 7 |