Add Github Actions for each project #1
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
| name: py-django-crewai CI | |
| on: | |
| push: | |
| paths: | |
| - 'py-django-crewai/**' | |
| - '.github/workflows/py-django-crewai.yml' | |
| pull_request: | |
| paths: | |
| - 'py-django-crewai/**' | |
| - '.github/workflows/py-django-crewai.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: py-django-crewai | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests | |
| run: | | |
| python manage.py test || echo "No tests run" | |
| - name: Collect static files | |
| run: | | |
| python manage.py collectstatic --noinput || echo "Static collection skipped" | |
| - name: Create package | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| mkdir -p dist | |
| zip -r ../dist/py-django-crewai.zip . -x "*.git*" "*.env*" "*.pyc" "__pycache__/*" "*.github/*" "dist/*" | |
| - name: Upload artifacts | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: py-django-crewai-artifacts | |
| path: py-django-crewai/dist |