ADAPT-Chase's picture
Add files using upload-large-folder tool
fd357f4 verified
name: DTO CI/CD Pipeline
on:
push:
branches: [ main, develop ]
paths:
- '**.py'
- '**.yaml'
- '**.yml'
- '**.md'
- '**.sh'
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
validate:
name: Validate DTO Configuration
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyyaml jsonschema
- name: Validate manifest schema
run: |
python validate-ci.py
- name: Run syntax checks
run: |
# Validate YAML files
find . -name "*.yaml" -o -name "*.yml" | xargs -I {} sh -c 'echo "Validating {}" && python -c "import yaml; yaml.safe_load(open(\"{}\"))" && echo "✓ {}"'
# Validate Python syntax
find . -name "*.py" | xargs -I {} sh -c 'echo "Validating {}" && python -m py_compile {} && echo "✓ {}"'
test:
name: Run DTO Tests
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install test dependencies
run: |
pip install pytest pytest-cov
- name: Run unit tests
run: |
# Create simple test runner
cat > test_runner.py << 'EOF'
import unittest
import os
import sys
# Add current directory to path
sys.path.insert(0, os.path.dirname(__file__))
# Basic test suite
class TestDTOFramework(unittest.TestCase):
def test_manifest_exists(self):
"""Test that manifest file exists"""
self.assertTrue(os.path.exists('dto_manifest.yaml'))
def test_scripts_executable(self):
"""Test that scripts are executable"""
for script in ['generate.py', 'validate-ci.py']:
if os.path.exists(script):
self.assertTrue(os.access(script, os.X_OK))
if __name__ == '__main__':
unittest.main()
EOF
python test_runner.py -v
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run security scan
uses: actions/checkov@v3
with:
directory: .
check: ["CKV_GHA_1", "CKV_GHA_2", "CKV_GHA_3"]
- name: Secret scanning
uses: actions/check-secrets@v1
documentation:
name: Documentation Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build documentation
run: |
# Validate markdown files
find docs/ -name "*.md" | xargs -I {} sh -c 'echo "Validating {}" && markdownlint {} || true'
# Generate documentation index
echo "# DTO Framework Documentation" > DOCUMENTATION.md
echo "\n## Available Documents" >> DOCUMENTATION.md
find docs/ -name "*.md" | sed 's|^|- |' >> DOCUMENTATION.md
deploy:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: [validate, test, security]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to staging
run: |
echo "Deploying DTO framework to staging environment"
# Add deployment logic here
# This would typically use ansible, terraform, or custom deployment scripts
- name: Notify deployment
run: |
echo "DTO framework deployed successfully to staging"
# Add notification logic (Slack, Teams, etc.)
release:
name: Create Release
runs-on: ubuntu-latest
needs: deploy
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v$(date +%Y%m%d.%H%M%S)
name: DTO Framework Release $(date +%Y-%m-%d)
body: |
Automated release of Data Transfer Operations Framework
Changes:
- CI/CD pipeline enhancements
- Xet integration updates
- Documentation improvements
draft: false
prerelease: false
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: dto-framework
path: |
*.py
*.yaml
*.md
scripts/
integrations/
# Environment configurations
env:
PYTHONPATH: .
DTO_ENV: ci