[Git][openmairie/opencimetiere-documentation][5.3] ci: mise en place du nouveau système de génération de la documentation pour...

0 views
Skip to first unread message

openMairie Admin (@openmairie-admin)

unread,
Mar 4, 2026, 6:02:37 PM (7 days ago) Mar 4
to openmairie-o...@googlegroups.com

openMairie Admin pushed to branch 5.3 at openMairie / opencimetiere-documentation

Commits:

  • 64076a7d
    by openMairie Admin at 2026-03-04T23:02:29+00:00
    ci: mise en place du nouveau système de génération de la documentation pour les merge request et mise à jour des dépendances

4 changed files:

Changes:

  • .gitlab-ci.yml
    1
    -image: python:latest
    
    1
    +# Éviter les pipelines dupliqués quand on pousse dans une MR
    
    2
    +# Voir https://docs.gitlab.com/ci/yaml/workflow/#switch-between-branch-pipelines-and-merge-request-pipelines
    
    3
    +workflow:
    
    4
    +  rules:
    
    5
    +    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    
    6
    +    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
    
    7
    +      when: never
    
    8
    +    - if: $CI_COMMIT_BRANCH
    
    9
    +
    
    10
    +# -----------------------------------------------------------------------------
    
    2 11
     
    
    3 12
     test:
    
    4
    -  before_script:
    
    5
    -    - python -V
    
    6
    -    - pip install virtualenv
    
    7
    -    - virtualenv venv
    
    8
    -    - source venv/bin/activate
    
    9
    -    - pip install -q -r requirements.txt
    
    10
    -  script:
    
    11
    -    - sphinx-build -nW -b html -d _build/doctrees source _build/html
    
    13
    +  stage: test
    
    14
    +  interruptible: true
    
    15
    +  rules:
    
    16
    +    - when: always
    
    17
    +  needs: []
    
    18
    +
    
    19
    +  # Utiliser la même version que spécifiée dans .readthedocs.yaml
    
    20
    +  image: python:3.14-slim
    
    21
    +
    
    22
    +  cache: # Pip's cache doesn't store the python packages
    
    23
    +    paths: # https://pip.pypa.io/en/stable/topics/caching/
    
    24
    +      - .cache/pip
    
    25
    +  variables:
    
    26
    +    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" # Change pip's cache directory to be inside the project directory since we can only cache local items.
    
    12 27
     
    
    13
    -pages:
    
    14
    -  stage: build
    
    15
    -  cache:
    
    16
    -    key: gitlab-pages
    
    17
    -    paths: [public]
    
    18 28
       before_script:
    
    19 29
         - python -V
    
    20 30
         - pip install virtualenv
    
    21 31
         - virtualenv venv
    
    22 32
         - source venv/bin/activate
    
    23 33
         - pip install -q -r requirements.txt
    
    24
    -    - mkdir -p public/previews
    
    25
    -    - rm -rf public/previews/$CI_COMMIT_REF_SLUG
    
    26 34
       script:
    
    27
    -    - sphinx-build -b html source public/previews/$CI_COMMIT_REF_SLUG
    
    28
    -    - cd public/previews/
    
    29
    -    - echo "<html><body><h1>$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME</h1><p>Official build documentation is on readthedocs.org, this page is only here for dev purpose :</p><ul>" > ../index.html
    
    30
    -    - find -type d -mindepth 1 -maxdepth 1 -exec echo "<li><a href='previews/{}'>{}</a></li>" \; >> ../index.html
    
    31
    -    - echo "</ul></body></html>" >> ../index.html
    
    32
    -  environment:
    
    33
    -    name: pages/$CI_COMMIT_BRANCH
    
    34
    -    action: start
    
    35
    -    url: $CI_PAGES_URL/$CURRENT_CONTENT_PATH
    
    36
    -    on_stop: pages-clean-preview
    
    37
    -  resource_group: one-gitlab-pages-for-all-branches
    
    35
    +    - sphinx-build -nW -b html -d _build/doctrees source public/
    
    36
    +  after_script:
    
    37
    +    - echo "PAGES_JOB_ID=$CI_JOB_ID" >> job.env
    
    38
    +
    
    38 39
       artifacts:
    
    39 40
         paths:
    
    40
    -      - public
    
    41
    +      - public/
    
    42
    +    reports:
    
    43
    +      dotenv: job.env
    
    41 44
     
    
    42
    -pages-clean-preview:
    
    43
    -  stage: build
    
    44
    -  cache:
    
    45
    -    key: gitlab-pages
    
    46
    -    paths: [public]
    
    47
    -  variables:
    
    48
    -    GIT_STRATEGY: none
    
    49
    -    FOLDER_TO_DELETE: previews/$CI_COMMIT_REF_SLUG
    
    50
    -  script:
    
    51
    -    - rm -rf public/$FOLDER_TO_DELETE
    
    52
    -  environment:
    
    53
    -    name: pages/$CI_COMMIT_BRANCH
    
    54
    -    action: stop
    
    45
    +
    
    46
    +danger-review:
    
    47
    +  stage: test
    
    55 48
       rules:
    
    56
    -    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
    
    57
    -      when: manual
    
    58
    -      allow_failure: true
    49
    +    - if: ($CI_PIPELINE_SOURCE == 'merge_request_event' && $DANGER_GITLAB_API_TOKEN != null)
    
    50
    +  needs:
    
    51
    +    - job: test
    
    52
    +      artifacts: true # pour récupérer le fichier job.env
    
    53
    +
    
    54
    +  image: node
    
    55
    +  before_script:
    
    56
    +    - npx --package danger@^13.0.5 --call='danger --version'
    
    57
    +  script:
    
    58
    +    - npx --package danger@^13.0.5 --call='danger ci --failOnErrors'

  • .readthedocs.yaml
    ... ... @@ -6,9 +6,9 @@ version: 2
    6 6
     
    
    7 7
     # Set the OS, Python version and other tools you might need
    
    8 8
     build:
    
    9
    -  os: ubuntu-22.04
    
    9
    +  os: ubuntu-24.04
    
    10 10
       tools:
    
    11
    -    python: "3.11"
    
    11
    +    python: "3.14" # utiliser la même versoin que dans .gitlab-ci.yml
    
    12 12
         # You can also specify other tool versions:
    
    13 13
         # nodejs: "20"
    
    14 14
         # rust: "1.70"
    
    ... ... @@ -33,4 +33,3 @@ formats:
    33 33
     python:
    
    34 34
       install:
    
    35 35
         - requirements: requirements.txt
    36
    -

  • dangerfile.ts
    1
    +import { danger, warn, message, fail } from "danger";
    
    2
    +const fs = require("fs");
    
    3
    +
    
    4
    +// Documentation mise à jour
    
    5
    +const documentationChanges = [...danger.git.modified_files, ...danger.git.created_files]
    
    6
    +    .filter((path) => (path.startsWith("source/")));
    
    7
    +
    
    8
    +if (process.env.PAGES_JOB_ID) {
    
    9
    +    // Afficher les pages modifiées dans la documentation
    
    10
    +    const baseUrl = `${process.env.CI_SERVER_PROTOCOL}://${process.env.CI_PROJECT_ROOT_NAMESPACE}.${process.env.CI_PAGES_DOMAIN}/-/${process.env.CI_PROJECT_PATH.replace(new RegExp(`^${process.env.CI_PROJECT_ROOT_NAMESPACE}/`), '')}/-/jobs/${process.env.PAGES_JOB_ID}/artifacts/public`
    
    11
    +
    
    12
    +    function urlFromFilePath(path) {
    
    13
    +        return baseUrl + '/' + path.replace('source/', '').replace('.rst', '.html').toLowerCase();
    
    14
    +    }
    
    15
    +
    
    16
    +    message(`[Prévisualisation de la documentation](${baseUrl}/index.html). Pages modifiées : ` + documentationChanges.sort().map(path => `\n - [\`${path}\`](${urlFromFilePath(path)})`).join());
    
    17
    +}

  • requirements.txt
    1
    -Sphinx
    
    2
    -sphinx_rtd_theme
    1
    +Sphinx>=9
    
    2
    +sphinx_rtd_theme
    \ No newline at end of file


View it on GitLab.
You're receiving this email because of your account on gitlab.com. Manage all notifications · Help Notification message regarding https://gitlab.com/openmairie/opencimetiere-documentation/-/commit/64076a7d404a33fe1f72014edc21a62410a88cd3 at 1772665352

Reply all
Reply to author
Forward
0 new messages