IdHub/.gitea/workflows/ci-pipeline.yaml

53 lines
1.2 KiB
YAML
Raw Normal View History

name: Django CI Pipeline
on:
push:
branches:
- main
- release
- testing-pipeline
jobs:
build:
2024-01-09 08:58:00 +00:00
runs-on: ubuntu-22.04
steps:
2024-01-04 20:20:32 +00:00
- uses: actions/checkout@v4
2024-01-12 08:49:08 +00:00
- name: Install python3-venv
id: install
2024-01-12 08:49:08 +00:00
run: |
apt-get update
2024-01-12 09:22:18 +00:00
apt-get install python3 python3-venv python3-pip -y
- name: Check Python version
run: |
python3 --version
2024-01-12 08:49:08 +00:00
- name: Create virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
2024-01-12 09:25:00 +00:00
echo "Virtual environment created successfully"
# https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context
if: steps.install.outcome == 'success'
- name: Install dependencies
run: |
2024-01-12 09:25:00 +00:00
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
- name: Set random secret key
run: |
source venv/bin/activate
SECRET_KEY=$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')
2024-01-14 16:26:04 +00:00
echo "${SECRET_KEY}"
- name: Run tests
run: |
source venv/bin/activate
python manage.py test