54 lines
1.1 KiB
YAML
54 lines
1.1 KiB
YAML
name: Django CI Pipeline
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release
|
|
- testing-pipeline
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check if Python is installed
|
|
run: |
|
|
python3 -c "print('Python is installed')"
|
|
|
|
- name: Install python3-venv
|
|
id: install
|
|
run: |
|
|
apt-get update && apt-get install python3-virtualenv -y
|
|
|
|
- name: Create virtual environment
|
|
run: |
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
# https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
|
|
if: steps.install.outcome == 'success'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
|
|
- name: Run makemigrations
|
|
run: |
|
|
source venv/bin/activate
|
|
python manage.py makemigrations
|
|
|
|
- name: Run migrate
|
|
run: |
|
|
source venv/bin/activate
|
|
python manage.py migrate
|
|
|
|
- name: Run tests
|
|
run: |
|
|
source venv/bin/activate
|
|
python manage.py test
|
|
|