đ Ajout du filtre objet dans l'API Rest (#1556) #2593
This file contains hidden or 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: đ€ CI | |
on: | |
workflow_call: | |
push: | |
branches: [ "main" ] | |
jobs: | |
backend_tests: | |
name: tests backend | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgis/postgis:15-3.3-alpine | |
env: | |
POSTGRES_USER: qfdmo | |
POSTGRES_PASSWORD: qfdmo # pragma: allowlist secret | |
POSTGRES_DB: qfdmo | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 1s | |
--health-timeout 1s | |
--health-retries 50 | |
ports: | |
- 6543:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
- name: Install GIS Packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install gdal-bin | |
- name: Install poetry | |
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4 | |
- uses: actions/cache@v4 | |
name: Define a cache for the virtual environment based on the dependencies lock file | |
with: | |
path: ./.venv | |
key: venv-dev-airflow-${{ hashFiles('poetry.lock') }} | |
- name: Install the project dependencies | |
run: poetry sync --with dev,airflow --no-root | |
- name: Run unit tests | |
run: poetry run pytest unit_tests | |
- name: Run integration tests | |
run: poetry run pytest integration_tests | |
- name: Run data tests | |
run: poetry run pytest dags_unit_tests | |
- name: Check code formatting | |
run: poetry run black --check --diff . | |
- uses: astral-sh/ruff-action@9828f49eb4cadf267b40eaa330295c412c68c1f9 # v3.2.2 | |
- name: Check for missing migrations | |
run: poetry run python manage.py makemigrations --check --no-input --settings=core.test_settings | |
env: | |
SECRET_KEY: votre_blanquette_est_bonne # pragma: allowlist secret | |
DATABASE_URL: "postgres://fakeusername:fakepassword@postgres:5432/database" # pragma: allowlist secret | |
frontend_tests: | |
name: tests frontend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".tool-versions" | |
cache: "npm" | |
- name: Build assets | |
run: | | |
npm ci | |
npm run build | |
- name: Check code formatting | |
run: npm run lint | |
- name: Run tests | |
run: npm run test | |
e2e: | |
name: tests de bout-en-bout | |
runs-on: ubuntu-latest | |
if: contains( github.event.pull_request.labels.*.name, 'frontend') || github.ref == 'refs/head/main' | |
strategy: | |
matrix: | |
shard: [1/5, 2/5, 3/5, 4/5, 5/5] | |
services: | |
postgres: | |
image: postgis/postgis:15-3.3-alpine | |
env: | |
POSTGRES_USER: qfdmo | |
POSTGRES_PASSWORD: qfdmo # pragma: allowlist secret | |
POSTGRES_DB: qfdmo | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 1s | |
--health-timeout 1s | |
--health-retries 50 | |
ports: | |
- 6543:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare environment | |
run: | | |
cp .env.template .env | |
echo LVAO_BASE_URL=http://localhost:8000 >> .env | |
echo ASSISTANT_BASE_URL=http://127.0.0.1:8000 >> .env | |
echo ASSISTANT_HOSTS=127.0.0.1 >> .env | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".tool-versions" | |
cache: "npm" | |
- name: Build assets | |
run: | | |
npm ci | |
npm run build | |
- uses: actions/setup-python@v5 | |
with: | |
cache: "pip" | |
- name: Install GIS Packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install gdal-bin | |
- name: Install poetry | |
uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 # v4 | |
- uses: actions/cache@v4 | |
name: Define a cache for the virtual environment based on the dependencies lock file | |
with: | |
path: ./.venv | |
key: venv-dev-${{ hashFiles('poetry.lock') }} | |
- name: Install the project dependencies | |
run: poetry sync --with dev --no-root | |
- name: Migrate database | |
run: | | |
poetry run python manage.py createcachetable | |
poetry run python manage.py migrate | |
- name: Populate database | |
run: | | |
poetry run python manage.py loaddata actions acteur_services acteur_types categories objets produits synonymes | |
- name: Run serveur | |
run: | | |
poetry run python manage.py runserver & | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test --reporter=list --update-snapshots --shard=${{ matrix.shard }} | |
# Address actions/missing-workflow-permissions rule in | |
# code scanning alerts | |
permissions: | |
contents: read |