From a070039e6dce44e3f8d14e897d3cb2ed8d5c3faf Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 11:25:02 +0100 Subject: [PATCH 01/15] Dropdown of PR names for manual workflow wtf am i doing --- .github/workflows/preprod-publish.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 39c6271d68..5d8120179d 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -3,10 +3,11 @@ name: Build and Publish Preprod on: workflow_dispatch: inputs: - branch: - description: "Branch to deploy in preprod" + pr: + description: "PR to deploy in preprod" required: true - default: "main" + type: choice + options: ${{ fromJSON($(curl https://api.github.com/repos/${{ github.repository }}/pulls | jq '[.[] | ("#" + (.number|tostring) + " - " + .title)]')) }} preprod_env: description: "Preprod environment" required: true @@ -31,7 +32,7 @@ jobs: - name: Checkout code uses: actions/checkout@v5 with: - ref: ${{ github.event.inputs.branch }} + ref: $(curl https://api.github.com/repos/${github.repository}/pulls/ ${${{github.event.inputs.pr }}//@(*#| *)} | jq '.head.ref') - name: Docker metadata id: meta From 9cd5dca84cdb5154ead72185ebf976a775f357ec Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 11:59:46 +0100 Subject: [PATCH 02/15] Put PR number and get branch from there --- .github/workflows/preprod-publish.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 5d8120179d..b6565f061d 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -4,10 +4,8 @@ on: workflow_dispatch: inputs: pr: - description: "PR to deploy in preprod" + description: "Number of the PR to deploy in preprod" required: true - type: choice - options: ${{ fromJSON($(curl https://api.github.com/repos/${{ github.repository }}/pulls | jq '[.[] | ("#" + (.number|tostring) + " - " + .title)]')) }} preprod_env: description: "Preprod environment" required: true @@ -29,10 +27,14 @@ jobs: runs-on: ubuntu-latest steps: + - name: Branch name from input PR number + id: branch + run: echo "branch=$(curl https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v5 with: - ref: $(curl https://api.github.com/repos/${github.repository}/pulls/ ${${{github.event.inputs.pr }}//@(*#| *)} | jq '.head.ref') + ref: ${{ steps.branch.outputs.branch }} - name: Docker metadata id: meta @@ -45,7 +47,7 @@ jobs: type=sha,prefix={{branch}}- labels: | preprod.environment=${{ github.event.inputs.preprod_env }} - preprod.branch=${{ github.event.inputs.branch }} + preprod.branch=${{ steps.branch.outputs.branch }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.11.1 From eb6e4be70bac8e50aaa3ffc2d8aae22ae4a02335 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:26:09 +0100 Subject: [PATCH 03/15] manual revert --- .github/workflows/preprod-publish.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index b6565f061d..39c6271d68 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -3,9 +3,10 @@ name: Build and Publish Preprod on: workflow_dispatch: inputs: - pr: - description: "Number of the PR to deploy in preprod" + branch: + description: "Branch to deploy in preprod" required: true + default: "main" preprod_env: description: "Preprod environment" required: true @@ -27,14 +28,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Branch name from input PR number - id: branch - run: echo "branch=$(curl https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" - - name: Checkout code uses: actions/checkout@v5 with: - ref: ${{ steps.branch.outputs.branch }} + ref: ${{ github.event.inputs.branch }} - name: Docker metadata id: meta @@ -47,7 +44,7 @@ jobs: type=sha,prefix={{branch}}- labels: | preprod.environment=${{ github.event.inputs.preprod_env }} - preprod.branch=${{ steps.branch.outputs.branch }} + preprod.branch=${{ github.event.inputs.branch }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.11.1 From 54361191c0a700cf8184a330557d66088d62e776 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:40:57 +0100 Subject: [PATCH 04/15] Doing it again --- .github/workflows/preprod-publish.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 39c6271d68..1f65e9daf4 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -3,10 +3,9 @@ name: Build and Publish Preprod on: workflow_dispatch: inputs: - branch: - description: "Branch to deploy in preprod" + pr: + description: "PR to deploy in preprod" required: true - default: "main" preprod_env: description: "Preprod environment" required: true @@ -28,10 +27,14 @@ jobs: runs-on: ubuntu-latest steps: + - name: Branch name from input PR number + id: branch + run: echo "branch=$(curl https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.events.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v5 with: - ref: ${{ github.event.inputs.branch }} + ref: ${{ steps.branch.outputs.branch }} - name: Docker metadata id: meta @@ -44,7 +47,7 @@ jobs: type=sha,prefix={{branch}}- labels: | preprod.environment=${{ github.event.inputs.preprod_env }} - preprod.branch=${{ github.event.inputs.branch }} + preprod.pr=${{ github.event.inputs.pr }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.11.1 From 0c838ec5c97df80c42d80d82dcdc1767989eb29f Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:46:23 +0100 Subject: [PATCH 05/15] GH VARS --- .github/workflows/preprod-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 1f65e9daf4..2bc4953065 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -29,7 +29,7 @@ jobs: steps: - name: Branch name from input PR number id: branch - run: echo "branch=$(curl https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.events.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" + run: echo "branch=$(curl ${{ GITHUB_API_URL }}/repos/${{ GITHUB_REPOSITORY }}/pulls/${{ github.events.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v5 From 65aee857e0e4adca78182bd722c78b9bd6818ad4 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:50:06 +0100 Subject: [PATCH 06/15] fix ? --- .github/workflows/preprod-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 2bc4953065..e40564b60b 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -29,7 +29,7 @@ jobs: steps: - name: Branch name from input PR number id: branch - run: echo "branch=$(curl ${{ GITHUB_API_URL }}/repos/${{ GITHUB_REPOSITORY }}/pulls/${{ github.events.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" + run: echo "branch=$(curl ${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.events.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v5 From cb66be6b3968ddacf60cfc4b2b821051c6fbb203 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:55:33 +0100 Subject: [PATCH 07/15] is there any better way to test jobs?? --- .github/workflows/preprod-publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index e40564b60b..6c1a5a9a59 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -29,8 +29,12 @@ jobs: steps: - name: Branch name from input PR number id: branch - run: echo "branch=$(curl ${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.events.inputs.pr }} | jq '.head.ref')" >> "$GITHUB_OUTPUT" - + run: | + url=$(${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.events.inputs.pr }}); + echo url; + branch=$(curl $url | jq '.head.ref'); + echo "branch=$branch" >> "$GITHUB_OUTPUT"; + cat "$GITHUB_OUTPUT"; - name: Checkout code uses: actions/checkout@v5 with: From 6a2493d6ae8e6735d6b888bccddfa29fb519c461 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:57:53 +0100 Subject: [PATCH 08/15] fix fix --- .github/workflows/preprod-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 6c1a5a9a59..722ae7eb94 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -30,8 +30,8 @@ jobs: - name: Branch name from input PR number id: branch run: | - url=$(${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.events.inputs.pr }}); - echo url; + url=$(${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}); + echo $url; branch=$(curl $url | jq '.head.ref'); echo "branch=$branch" >> "$GITHUB_OUTPUT"; cat "$GITHUB_OUTPUT"; From ef1663f94f5a6d7c0e7b2911b8e4b8f667273a00 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:59:42 +0100 Subject: [PATCH 09/15] im dumb --- .github/workflows/preprod-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 722ae7eb94..3e1e383fd2 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -30,7 +30,7 @@ jobs: - name: Branch name from input PR number id: branch run: | - url=$(${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}); + url=${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}; echo $url; branch=$(curl $url | jq '.head.ref'); echo "branch=$branch" >> "$GITHUB_OUTPUT"; From 784f7e6bc2fd51d308a9cf0199e9e42e8c1a22de Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 13:26:34 +0100 Subject: [PATCH 10/15] praying... --- .github/workflows/preprod-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 3e1e383fd2..257eb6bc4e 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -32,7 +32,7 @@ jobs: run: | url=${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}; echo $url; - branch=$(curl $url | jq '.head.ref'); + branch=$(curl $url | jq -r '.head.ref'); echo "branch=$branch" >> "$GITHUB_OUTPUT"; cat "$GITHUB_OUTPUT"; - name: Checkout code From 88242a4fde2242c262cd4d64014312bb82715e48 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 13:33:29 +0100 Subject: [PATCH 11/15] done --- .github/workflows/preprod-publish.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 257eb6bc4e..8a3046d5a9 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -29,12 +29,7 @@ jobs: steps: - name: Branch name from input PR number id: branch - run: | - url=${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}; - echo $url; - branch=$(curl $url | jq -r '.head.ref'); - echo "branch=$branch" >> "$GITHUB_OUTPUT"; - cat "$GITHUB_OUTPUT"; + run: echo "branch=$(curl -f ${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }} | jq -r '.head.ref')" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v5 with: From 571ae0e215ccca30fe3ad8bdab79d432adffdb2c Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 15:01:52 +0100 Subject: [PATCH 12/15] fail if PR doesn't exist --- .github/workflows/preprod-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preprod-publish.yml b/.github/workflows/preprod-publish.yml index 8a3046d5a9..e64a48d864 100644 --- a/.github/workflows/preprod-publish.yml +++ b/.github/workflows/preprod-publish.yml @@ -29,7 +29,9 @@ jobs: steps: - name: Branch name from input PR number id: branch - run: echo "branch=$(curl -f ${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }} | jq -r '.head.ref')" >> "$GITHUB_OUTPUT" + run: | + branch=$(curl -fs ${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }} | jq -r '.head.ref') + echo "branch=${branch:?'PR #${{ github.event.inputs.pr }} does not exist'}" >> "$GITHUB_OUTPUT" - name: Checkout code uses: actions/checkout@v5 with: From 47f270b90a471d49e7e3bac418d89172e6a59967 Mon Sep 17 00:00:00 2001 From: Marc-Andrieu <146140470+Marc-Andrieu@users.noreply.github.com> Date: Sat, 8 Nov 2025 18:00:58 +0100 Subject: [PATCH 13/15] Change thing in app/ --- app/core/core_endpoints/endpoints_core.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/core/core_endpoints/endpoints_core.py b/app/core/core_endpoints/endpoints_core.py index d31b44a493..7aa3effd61 100644 --- a/app/core/core_endpoints/endpoints_core.py +++ b/app/core/core_endpoints/endpoints_core.py @@ -55,9 +55,7 @@ async def read_information( status_code=200, ) async def read_privacy(): - """ - Return Hyperion privacy - """ + """Return Hyperion privacy""" return FileResponse("assets/privacy.txt") From 549e6be079b5b89e2c954082f03a3f45b96c0f9a Mon Sep 17 00:00:00 2001 From: Warix <39554785+warix8@users.noreply.github.com> Date: Sat, 8 Nov 2025 18:19:08 +0100 Subject: [PATCH 14/15] Add test comment --- app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 837f3ba71a..377488e36b 100644 --- a/app/main.py +++ b/app/main.py @@ -2,7 +2,7 @@ from app.app import get_application from app.dependencies import get_settings - +# test # The application is started with the following function call: # We dissociate this step from the app.py file so that during tests we can initialize it with the mocked settings app = get_application(settings=get_settings()) From 276ebd34faab213887ee09d7c39d77e860e167e3 Mon Sep 17 00:00:00 2001 From: Warix <39554785+warix8@users.noreply.github.com> Date: Sat, 8 Nov 2025 20:20:38 +0100 Subject: [PATCH 15/15] test parallel testing --- .github/workflows/test.yml | 2 +- app/main.py | 2 +- requirements-dev.txt | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ca393c56ec..e5e080854f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -80,7 +80,7 @@ jobs: key: pytest_cache-${{ github.head_ref }} - name: Run unit tests with Postgresql - run: python -m pytest --cov + run: python -m pytest --cov -n auto - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5.5.1 diff --git a/app/main.py b/app/main.py index 377488e36b..837f3ba71a 100644 --- a/app/main.py +++ b/app/main.py @@ -2,7 +2,7 @@ from app.app import get_application from app.dependencies import get_settings -# test + # The application is started with the following function call: # We dissociate this step from the app.py file so that during tests we can initialize it with the mocked settings app = get_application(settings=get_settings()) diff --git a/requirements-dev.txt b/requirements-dev.txt index 552d20ede4..7fe0ec3c0c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,6 +8,7 @@ pytest-alembic==0.12.1 pytest-asyncio==0.26.0 pytest-cov==6.1.1 pytest-mock==3.14.1 +pytest-xdist==3.8.0 # to run tests in parallel pytest==8.3.5 ruff==0.11.8 types-aiofiles==24.1.0.20250516 @@ -15,4 +16,4 @@ types-Authlib==1.5.0.20250516 types-fpdf2==2.8.3.20250516 types-psutil==7.0.0.20250601 types-redis==4.6.0.20241004 -types-requests==2.32.0.20250515 +types-requests==2.32.0.20250515 \ No newline at end of file