Skip to content

Add Cookie

Add Cookie #102

Workflow file for this run

name: Django CI/CD
on:
push:
branches: ["develop"]
paths:
- "backend/**"
pull_request:
branches: ["main"]
paths:
- "backend/**"
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'main')
strategy:
max-parallel: 4
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
env:
SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
cd backend
python manage.py test
docker:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
env:
SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/airbnb-backend:${{ github.sha }}
build-args: |
SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}