Sauvegarde des dossiers en base de données #21
Workflow file for this run
This file contains 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: Django CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
tests: | |
environment: test | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.12] | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_DB: gsl | |
POSTGRES_USER: gsl_team | |
POSTGRES_PASSWORD: gsl_pass | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
DATABASE_URL: "postgres://${{ vars.DATABASE_USER }}:${{ vars.DATABASE_PASSWORD }}@${{ vars.DATABASE_HOST }}:${{ vars.DATABASE_PORT }}/${{ vars.DATABASE_NAME }}" | |
SECRET_KEY: ${{ vars.SECRET_KEY }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check variables | |
run: | | |
echo "db URL : $DATABASE_URL" | |
echo "secret key : $SECRET_KEY" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Check linting | |
run: | | |
ruff check | |
ruff format --check | |
- name: Check migrations | |
run: python manage.py makemigrations --check --dry-run | |
- name: Run Tests | |
run: | | |
python -m pytest |