name: Django CI on: [push, pull_request] jobs: migrations: runs-on: self-hosted env: DJANGO_DEBUG: False steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install production dependencies run: pip install -r backend/requirements/prod.txt - name: Check for pending migrations run: cd backend/project && python manage.py makemigrations --check --dry-run linting: runs-on: self-hosted needs: migrations steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install linting dependencies run: pip install -r backend/requirements/dev.txt - name: Lint with ruff run: cd backend && ruff check . testing: runs-on: self-hosted needs: linting env: DJANGO_DEBUG: False steps: - uses: actions/checkout@v3 - name: Set up Python 3.x uses: actions/setup-python@v4 with: python-version: '3.x' - name: Install test dependencies run: pip install -r backend/requirements/test.txt - name: run: cd backend/project && python manage.py test build_and_push: runs-on: self-hosted needs: testing steps: - uses: actions/checkout@v3 - name: Login to Docker Hub uses: docker/login-action@v2 with: registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - name: Build Docker image run: docker build -t skillhub/backend backend/ - name: Push Docker image run: docker push skillhub/backend