dependencies.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. name: Dependency Updates
  2. on:
  3. schedule:
  4. # Run every Monday at 9:00 AM UTC
  5. - cron: '0 9 * * 1'
  6. workflow_dispatch:
  7. permissions:
  8. contents: write
  9. pull-requests: write
  10. jobs:
  11. update-dependencies:
  12. name: Update Dependencies
  13. runs-on: ubuntu-latest
  14. timeout-minutes: 15
  15. steps:
  16. - name: Checkout repository
  17. uses: actions/checkout@v6
  18. with:
  19. token: ${{ secrets.GITHUB_TOKEN }}
  20. - name: Set up Python
  21. uses: actions/setup-python@v5
  22. with:
  23. python-version: "3.11"
  24. cache: 'pip'
  25. - name: Install pip-tools
  26. run: |
  27. python -m pip install --upgrade pip
  28. pip install pip-tools
  29. - name: Install system dependencies
  30. run: |
  31. sudo apt-get update
  32. sudo apt-get install -y build-essential libssl-dev libicapapi-dev python3-dev libpq-dev
  33. - name: Update dependencies
  34. run: |
  35. # Backup current requirements
  36. cp requirements.txt requirements.txt.bak
  37. # Update requirements (simple upgrade)
  38. pip install --upgrade -r requirements.txt
  39. # Check if there are changes
  40. if ! diff -q requirements.txt requirements.txt.bak > /dev/null; then
  41. echo "dependencies_updated=true" >> $GITHUB_ENV
  42. else
  43. echo "dependencies_updated=false" >> $GITHUB_ENV
  44. fi
  45. - name: Test updated dependencies
  46. if: env.dependencies_updated == 'true'
  47. run: |
  48. # Install updated dependencies
  49. pip install -r requirements.txt
  50. # Run basic tests to ensure nothing is broken
  51. python -c "
  52. import sys
  53. import os
  54. sys.path.insert(0, os.getcwd())
  55. try:
  56. from app import app
  57. from database.database import get_engine, create_dynamic_tables
  58. except Exception as e:
  59. print(f'❌ Import error: {e}')
  60. sys.exit(1)
  61. "
  62. # Run linting
  63. pip install ruff
  64. ruff check . || echo "⚠️ Linting issues found"
  65. - name: Create Pull Request
  66. if: env.dependencies_updated == 'true'
  67. uses: peter-evans/create-pull-request@v5
  68. with:
  69. token: ${{ secrets.GITHUB_TOKEN }}
  70. commit-message: "chore: update dependencies"
  71. title: "chore: Update dependencies"
  72. body: |
  73. ## Dependency Updates
  74. This PR updates the project dependencies to their latest versions.
  75. ### Changes
  76. - Updated all dependencies in `requirements.txt`
  77. - Basic import tests passed
  78. - Linting checked
  79. ### Testing
  80. - [ ] Manual testing of key features
  81. - [ ] Performance impact evaluation
  82. - [ ] Security review of new versions
  83. ### Notes
  84. Please review the changes and test thoroughly before merging.
  85. ---
  86. *This PR was created automatically by the dependency update workflow.*
  87. branch: dependency-updates
  88. delete-branch: true
  89. labels: dependencies,automated