diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 0a14737c33e289c9e0dcbb7cbc6b5ac97e8993ad..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Rapport de bug -about: Pour tout problème dans l'application -title: '' -labels: ':bug: bug' -assignees: '' - ---- - -## Le problème - -Une description claire et précise du problème. - -**Comment reproduire le bug** - -Étapes pour arriver au problème: -1. [ ] Aller sur '...' -2. [ ] Cliquer sur '....' -3. [ ] Naviguer vers '....' -4. [ ] Voir erreur - -**Comportement attendu** -Une description claire et précise du comportement attendu - -**Captures d'écrans** -Si possible, ajoutez des captures d'écran pour expliquer le problème - -**Votre configuration (informations à compléter):** - - Système d'exploitation: [e.g. Windows 11, Fedora 35] - - Navigateur web: [e.g. firefox, chrome, edge] - - Version du navigateur web : [e.g. 108.0.1 (64-bit)] - -Si vous avez tester sur plusieurs navigateurs, dites-le nous - -**Contexte supplémentaire** -Rajoutez tout ce que vous pensez utile à la compréhension/résolution du problème diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md deleted file mode 100644 index 851755591b6d8e7eafaf813b60538e6a2d3c0f58..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/feature.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Nouvelle fonctionnalité -about: Pour toute fonctionnalité -title: '' -labels: ':feather: feature' -assignees: '' - ---- - -# Checklist - -* [ ] Aller sur '...' -* [ ] Cliquer sur '....' -* [ ] Naviguer vers '....' -* [ ] Voir nouvelle information - -# Pourquoi -Une description claire du but de la fonctionnalité - - -**Captures d'écrans/maquettes** -Si possible, ajoutez des captures d'écran ou maquettes - -**Contexte supplémentaire** -Rajoutez tout ce que vous pensez utile à la compréhension/résolution diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml deleted file mode 100644 index 6af54de889123cdf16236e561d1d50ca6c48c4e9..0000000000000000000000000000000000000000 --- a/.github/workflows/api.yml +++ /dev/null @@ -1,167 +0,0 @@ -name: API -on: - workflow_call: - secrets: - CODECOV_TOKEN: - description: 'le token pour pouvoir pousser la couverture de code' - required: true - DOCKER_USERNAME: - description: 'le user docker' - required: true - DOCKER_TOKEN: - description: 'le token docker' - required: true -jobs: - type: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Build - run: make build/api - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Lint - run: make lint/api - unit-test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Unit tests - run: make test/api-unit - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: api-unit, api - integration-test: - runs-on: ubuntu-latest - services: - postgres: - image: postgis/postgis:15-3.3 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: camino_tests - PGUSER: postgres - PGPASSWORD: password - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Npm install - run: make install - - name: Integration tests - run: make test/api-integration - env: - PGHOST: localhost - PGPORT: 5432 - PGUSER: postgres - PGPASSWORD: password - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: api-integration, api - check-queries: - runs-on: ubuntu-latest - services: - postgres: - image: postgis/postgis:15-3.3 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: camino - PGUSER: postgres - PGPASSWORD: password - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Npm install - run: make install - - uses: cardinalby/export-env-action@v2 - with: - envFile: '.env-example' - expand: 'true' - - name: Migrate database and check queries - run: | - make db/migrate - make db/check-queries - if [ ! -z "$(git status --porcelain)" ]; then - echo "Lancer 'make db/check-queries' sur sa machine et commiter les changements" - echo "BEGIN Git diff" - git diff - echo "END Git diff" - exit 1; - fi - env: - PGHOST: localhost - PGPORT: 5432 - PGUSER: postgres - PGPASSWORD: password - PGDATABASE: camino - build: - needs: [unit-test, integration-test, lint, type, check-queries] - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build Docker image - run: docker build -t caminofr/camino-api:${GITHUB_SHA} -f Dockerfile.api . - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Push Docker image to the Docker Hub - if: github.ref == 'refs/heads/master' - run: docker push caminofr/camino-api:${GITHUB_SHA} diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml deleted file mode 100644 index caff2a6d2da30ae77fc5b0ee24315daa792c1be2..0000000000000000000000000000000000000000 --- a/.github/workflows/cd.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: CD -on: - workflow_call: - inputs: - # Ne peut être que dev, preprod ou prod - deploy_environment: - required: true - type: string - git_sha: - required: true - type: string - secrets: - CD_TOKEN_DEV: - description: 'le token pour déployer en dev' - required: true - CD_TOKEN_PREPROD: - description: 'le token pour déployer en preprod' - required: true - CD_TOKEN_PROD: - description: 'le token pour déployer en prod' - required: true - workflow_dispatch: - inputs: - deploy_environment: - description: 'Environnement de déploiement' - required: true - default: 'dev' - type: choice - options: - - dev - - preprod - - prod - git_sha: - description: 'Sha git à déployer' - type: string - required: true -env: - CD_TOKEN_DEV: ${{ secrets.CD_TOKEN_DEV }} - CD_TOKEN_PREPROD: ${{ secrets.CD_TOKEN_PREPROD }} - CD_TOKEN_PROD: ${{ secrets.CD_TOKEN_PROD }} -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Déploiement - run: INPUT_ENV=${{inputs.deploy_environment}} INPUT_SHA=${{inputs.git_sha}} make deploy/ci diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 62b6f6e960fc468a97cce0bd7975f7f56de206ab..0000000000000000000000000000000000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CI -on: - push: - branches-ignore: - - preprod - - prod -concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} -jobs: - deadcode: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Detect dead code - run: make lint/detect-dead-code - ui: - uses: ./.github/workflows/ui.yml - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} - api: - uses: ./.github/workflows/api.yml - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} - common: - uses: ./.github/workflows/common.yml - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - graphql: - uses: ./.github/workflows/graphql.yml - doc: - uses: ./.github/workflows/doc.yml - secrets: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} - deploy: - needs: [ui, api, common, doc, graphql] - if: github.ref == 'refs/heads/master' - uses: ./.github/workflows/cd.yml - secrets: - CD_TOKEN_DEV: ${{ secrets.CD_TOKEN_DEV }} - CD_TOKEN_PREPROD: ${{ secrets.CD_TOKEN_PREPROD }} - CD_TOKEN_PROD: ${{ secrets.CD_TOKEN_PROD }} - with: - deploy_environment: dev - git_sha: ${{ github.sha }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 20a151268dea5ef772a06445d65b02c79a86412d..0000000000000000000000000000000000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,71 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: 'CodeQL' - -on: - push: - branches: [master] - pull_request: - # The branches below must be a subset of the branches above - branches: [master] - schedule: - - cron: '33 4 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: ['javascript'] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml deleted file mode 100644 index f5039aad62155443bf8847284b8f27242a195afd..0000000000000000000000000000000000000000 --- a/.github/workflows/common.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Common -on: - workflow_call: - secrets: - CODECOV_TOKEN: - description: 'le token pour pouvoir pousser la couverture de code' - required: true -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Lint - run: make lint/common - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Unit tests - run: make test/common - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: common - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Npm install - run: make install - - name: Build - run: make build/common diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index fa76f8a875f7bc8e474e6cd19f581e70c4c5c3bf..0000000000000000000000000000000000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Deploy -on: - push: - branches: - - prod - - preprod -jobs: - release-github: - if: github.ref == 'refs/heads/prod' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }} - run: npx semantic-release - deploy-prod: - if: github.ref == 'refs/heads/prod' - needs: release-github - uses: ./.github/workflows/cd.yml - secrets: - CD_TOKEN_DEV: ${{ secrets.CD_TOKEN_DEV }} - CD_TOKEN_PREPROD: ${{ secrets.CD_TOKEN_PREPROD }} - CD_TOKEN_PROD: ${{ secrets.CD_TOKEN_PROD }} - with: - deploy_environment: prod - git_sha: ${{ github.sha }} - deploy-preprod: - if: github.ref == 'refs/heads/preprod' - uses: ./.github/workflows/cd.yml - secrets: - CD_TOKEN_DEV: ${{ secrets.CD_TOKEN_DEV }} - CD_TOKEN_PREPROD: ${{ secrets.CD_TOKEN_PREPROD }} - CD_TOKEN_PROD: ${{ secrets.CD_TOKEN_PROD }} - with: - deploy_environment: preprod - git_sha: ${{ github.sha }} diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml deleted file mode 100644 index 5f500e4640f884b875e16b3c6218144e211055d4..0000000000000000000000000000000000000000 --- a/.github/workflows/doc.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Documentation -on: - workflow_call: - secrets: - DOCKER_USERNAME: - description: 'le user docker' - required: true - DOCKER_TOKEN: - description: 'le token docker' - required: true -jobs: - doc: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build Docker image - run: docker build -f Dockerfile.docs -t caminofr/camino-docs:${GITHUB_SHA} . - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Push Docker image to the Docker Hub - if: github.ref == 'refs/heads/master' - run: docker push caminofr/camino-docs:${GITHUB_SHA} diff --git a/.github/workflows/gitguardian.yml b/.github/workflows/gitguardian.yml deleted file mode 100644 index ec94e5e5832e3704fc53c9452e125b40c977d6ae..0000000000000000000000000000000000000000 --- a/.github/workflows/gitguardian.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: GitGuardian scan - -on: - push: - branches-ignore: - - preprod - - prod - - master - -jobs: - scanning: - name: GitGuardian scan - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # fetch all history so multiple commits can be scanned - - name: GitGuardian scan - uses: GitGuardian/gg-shield-action@master - env: - GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }} - GITHUB_PUSH_BASE_SHA: ${{ github.event.base }} - GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }} - GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }} diff --git a/.github/workflows/graphql.yml b/.github/workflows/graphql.yml deleted file mode 100644 index 9a6f1eb07beec8f0654e910e85782a16c634406b..0000000000000000000000000000000000000000 --- a/.github/workflows/graphql.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Graphql -on: - workflow_call: -jobs: - test: - name: check-schema - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@master - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Graphql inspector - run : make graphql/check diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml deleted file mode 100644 index d5b3c5359b4d2382d1b00b33a25ac44b0e7935c1..0000000000000000000000000000000000000000 --- a/.github/workflows/ui.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: UI -on: - workflow_call: - secrets: - CODECOV_TOKEN: - description: 'le token pour pouvoir pousser la couverture de code' - required: true - DOCKER_USERNAME: - description: 'le user docker' - required: true - DOCKER_TOKEN: - description: 'le token docker' - required: true -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install - run: make install - - name: Lint - run: make lint/ui - - test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Test units - run: | - make install - make test/ui - - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - flags: ui - test-storybook: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: '20.15.1' - cache: 'npm' - - name: Install dependencies - run: make install - - name: Install Playwright - run: npx playwright@1.47.0 install --with-deps chromium - - name: Build Storybook - run: make storybook/build - - name: Serve Storybook and run tests - run: make storybook/test - build: - needs: [test, test-storybook, lint] - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build Docker image - run: docker build . --build-arg GIT_SHA=${GITHUB_SHA} -f Dockerfile.ui -t caminofr/camino-ui:${GITHUB_SHA} - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Push Docker image to the Docker Hub - if: github.ref == 'refs/heads/master' - run: docker push caminofr/camino-ui:${GITHUB_SHA} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..ad5b967399f0aaf6394822753e16bd14b1d15983 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,28 @@ +default: + tags: [global, shared] + interruptible: true + +stages: + - prepare + - test + - build + - deploy + +build-ci-image: + stage: prepare + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: .gitlab/build-ci-image.sh + artifacts: + reports: + dotenv: out.env + retry: + max: 2 + +include: + - local: .gitlab/global.yml + - local: .gitlab/deploy.yml + - local: .gitlab/ci/*.yml + rules: + - if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "prod" && $CI_COMMIT_BRANCH != "preprod" diff --git a/.gitlab/build-ci-image.sh b/.gitlab/build-ci-image.sh new file mode 100755 index 0000000000000000000000000000000000000000..9fc8a7dc957eaf2beef785a7a51fed5237d6c348 --- /dev/null +++ b/.gitlab/build-ci-image.sh @@ -0,0 +1,13 @@ +#/bin/bash +set -eufo pipefail +set -x + +CAMINO_BUILDER_VERSION=$(sha256sum package-lock.json package.json packages/api/package.json packages/ui/package.json packages/common/package.json Dockerfile.ci Makefile | sha256sum | cut -d ' ' -f 1) +wget -O result.json https://gitlab-forge.din.developpement-durable.gouv.fr/api/graphql --header 'Content-Type: application/json' --post-data '{"query":"query getContainerRepositoryTags {containerRepository(id: \"gid://gitlab/ContainerRepository/3781\") { tags(name: \"'"${CAMINO_BUILDER_VERSION}"'\") {nodes {name}}}}","variables":null,"operationName":"getContainerRepositoryTags"}' +if cat result.json | grep "${CAMINO_BUILDER_VERSION}" > /dev/null ; then + echo "Image tag found, skipping build and publish" +else + echo "Image tag does not exists" + /kaniko/executor --context "$CI_PROJECT_DIR" --cache=true --dockerfile "$CI_PROJECT_DIR/Dockerfile.ci" --destination "${CI_REGISTRY_IMAGE}/camino-builder:${CAMINO_BUILDER_VERSION}" +fi +echo "CAMINO_BUILDER_VERSION=${CAMINO_BUILDER_VERSION}" > out.env diff --git a/.gitlab/ci/api.yml b/.gitlab/ci/api.yml new file mode 100644 index 0000000000000000000000000000000000000000..843aa336bcbda7d988e0d10011f43fb731ec9c65 --- /dev/null +++ b/.gitlab/ci/api.yml @@ -0,0 +1,65 @@ +api/lint: + extends: .prepare-node-run + stage: test + script: make lint/api +api/test/unit: + extends: .prepare-node-run + stage: test + script: make test/api-unit +api/test/integration: + extends: .prepare-node-run + variables: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: camino_tests + PGUSER: postgres + PGPASSWORD: password + PGPORT: 5432 + PGHOST: postgres + services: + - name: postgis/postgis:16-3.4 + alias: postgres + stage: test + script: make test/api-integration +api/type: + extends: .prepare-node-run + stage: test + script: make build/api +api/check-queries: + extends: .prepare-node-run + variables: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: camino + PGDATABASE: camino + PGUSER: postgres + PGPASSWORD: password + PGPORT: 5432 + PGHOST: postgres + services: + - name: postgis/postgis:16-3.4 + alias: postgres + stage: test + script: + - set -a + - source .env-example + - ./.gitlab/wait-for-it.sh -h ${PGHOST} -p ${PGPORT} -t 30 -- make db/migrate + - make db/check-queries + - | + if [ ! -z "$(git status --porcelain)" ]; then + echo "Lancer 'make db/check-queries' sur sa machine et commiter les changements" + echo "BEGIN Git diff" + git diff + echo "END Git diff" + exit 1; + fi +api/build-and-push-image: + stage: build + needs: ['api/test/unit', 'api/type', 'api/lint', 'api/test/integration', 'api/check-queries'] + extends: + - .rule-build-and-push + - .prepare-docker-push + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: /kaniko/executor --context "$CI_PROJECT_DIR" --build-arg GIT_SHA=${CI_COMMIT_SHA} --dockerfile "$CI_PROJECT_DIR/Dockerfile.api" --destination "caminofr/camino-api:${CI_COMMIT_SHA}" ${KANIKO_POST_PARAM} diff --git a/.gitlab/ci/common.yml b/.gitlab/ci/common.yml new file mode 100644 index 0000000000000000000000000000000000000000..43ce597fe8a0679c4dcfc5967abad3d3f4223724 --- /dev/null +++ b/.gitlab/ci/common.yml @@ -0,0 +1,12 @@ +common/lint: + extends: .prepare-node-run + stage: test + script: make lint/common +common/test: + extends: .prepare-node-run + stage: test + script: make test/common +common/type: + extends: .prepare-node-run + stage: test + script: make build/common diff --git a/.gitlab/ci/doc.yml b/.gitlab/ci/doc.yml new file mode 100644 index 0000000000000000000000000000000000000000..64a91b98041982546434a9e943d82c068415931c --- /dev/null +++ b/.gitlab/ci/doc.yml @@ -0,0 +1,10 @@ +doc/build-image: + stage: build + needs: [] + extends: + - .rule-build-and-push + - .prepare-docker-push + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: /kaniko/executor --context "$CI_PROJECT_DIR" --build-arg GIT_SHA=${CI_COMMIT_SHA} --dockerfile "$CI_PROJECT_DIR/Dockerfile.docs" --destination "caminofr/camino-docs:${CI_COMMIT_SHA}" ${KANIKO_POST_PARAM} diff --git a/.gitlab/ci/global-jobs.yml b/.gitlab/ci/global-jobs.yml new file mode 100644 index 0000000000000000000000000000000000000000..85d841891c83129d8f69b6c5616ccc07146e4d9b --- /dev/null +++ b/.gitlab/ci/global-jobs.yml @@ -0,0 +1,11 @@ +lint_graphql_inspector: + stage: test + needs: [] + image: node:20.15.1 + script: + - make graphql/check + +lint_detect_deadcode: + extends: .prepare-node-run + stage: test + script: make lint/detect-dead-code diff --git a/.gitlab/ci/ui.yml b/.gitlab/ci/ui.yml new file mode 100644 index 0000000000000000000000000000000000000000..41874e9ee1a345385dd7f93170ec47601543b930 --- /dev/null +++ b/.gitlab/ci/ui.yml @@ -0,0 +1,24 @@ +ui/lint: + extends: .prepare-node-run + stage: test + script: make lint/ui +ui/test: + extends: .prepare-node-run + stage: test + script: make test/ui +ui/test-storybook: + extends: .prepare-node-run + stage: test + script: + - make storybook/build + - make storybook/test +ui/build-and-push-image: + stage: build + needs: ['ui/test', 'ui/lint', 'ui/test-storybook'] + extends: + - .rule-build-and-push + - .prepare-docker-push + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + script: /kaniko/executor --context "$CI_PROJECT_DIR" --build-arg GIT_SHA=${CI_COMMIT_SHA} --dockerfile "$CI_PROJECT_DIR/Dockerfile.ui" --destination "caminofr/camino-ui:${CI_COMMIT_SHA}" ${KANIKO_POST_PARAM} diff --git a/.gitlab/deploy.yml b/.gitlab/deploy.yml new file mode 100644 index 0000000000000000000000000000000000000000..fe6254414ca4c7a97cf90cd7abefee250b4a334b --- /dev/null +++ b/.gitlab/deploy.yml @@ -0,0 +1,20 @@ +release-gitlab: + extends: .prepare-node-run + stage: deploy + script: npx semantic-release + rules: + - if: $CI_COMMIT_BRANCH == "prod" +deploy: + extends: .prepare-node-run + stage: deploy + script: INPUT_ENV=${INPUT_ENV} INPUT_SHA=${CI_COMMIT_SHA} make deploy/ci + rules: + - if: $CI_COMMIT_BRANCH == "preprod" + variables: + INPUT_ENV: preprod + - if: $CI_COMMIT_BRANCH == "prod" + variables: + INPUT_ENV: prod + - if: $CI_COMMIT_BRANCH == "master" + variables: + INPUT_ENV: dev diff --git a/.gitlab/global.yml b/.gitlab/global.yml new file mode 100644 index 0000000000000000000000000000000000000000..84c5c6478445bc5229baf8aea8f9caa77fdf15b1 --- /dev/null +++ b/.gitlab/global.yml @@ -0,0 +1,30 @@ +.rule-build-and-push: + rules: + - if: $CI_COMMIT_BRANCH == "master" + variables: + KANIKO_POST_PARAM: "" + - if: $CI_COMMIT_BRANCH != "master" + variables: + KANIKO_POST_PARAM: "--no-push" + +.prepare-docker-push: + before_script: |- + echo '{ + "auths": { + "https://index.docker.io/v1/": { + "auth": "'${DOCKER_CREDENTIALS}'" + } + } + }' > /kaniko/.docker/config.json + +.prepare-node-run: + image: ${CI_REGISTRY_IMAGE}/camino-builder:${CAMINO_BUILDER_VERSION} + before_script: + - ln -s /app/node_modules ${CI_PROJECT_DIR}/node_modules + - ln -s /app/packages/ui/node_modules ${CI_PROJECT_DIR}/packages/ui/node_modules + - ln -s /app/packages/api/node_modules ${CI_PROJECT_DIR}/packages/api/node_modules + - ln -s /app/packages/common/node_modules ${CI_PROJECT_DIR}/packages/common/node_modules + - rm ${CI_PROJECT_DIR}/node_modules/camino-ui ${CI_PROJECT_DIR}/node_modules/camino-common ${CI_PROJECT_DIR}/node_modules/camino-api + - ln -s ${CI_PROJECT_DIR}/packages/ui/ ${CI_PROJECT_DIR}/node_modules/camino-ui + - ln -s ${CI_PROJECT_DIR}/packages/common/ ${CI_PROJECT_DIR}/node_modules/camino-common + - ln -s ${CI_PROJECT_DIR}/packages/api/ ${CI_PROJECT_DIR}/node_modules/camino-api diff --git a/.gitlab/wait-for-it.sh b/.gitlab/wait-for-it.sh new file mode 100755 index 0000000000000000000000000000000000000000..eca6c3b9c8c61aa6ce889c185c700ad094988cc2 --- /dev/null +++ b/.gitlab/wait-for-it.sh @@ -0,0 +1,161 @@ +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +cmdname=$(basename $0) + +echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } + +usage() +{ + cat << USAGE >&2 +Usage: + $cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() +{ + if [[ $TIMEOUT -gt 0 ]]; then + echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" + else + echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" + fi + start_ts=$(date +%s) + while : + do + (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 + result=$? + if [[ $result -eq 0 ]]; then + end_ts=$(date +%s) + echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" + break + fi + sleep 1 + done + return $result +} + +wait_for_wrapper() +{ + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $QUIET -eq 1 ]]; then + timeout $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & + else + timeout $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & + fi + PID=$! + trap "kill -INT -$PID" INT + wait $PID + RESULT=$? + if [[ $RESULT -ne 0 ]]; then + echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" + fi + return $RESULT +} + +# process arguments +while [[ $# -gt 0 ]] +do + case "$1" in + *:* ) + hostport=(${1//:/ }) + HOST=${hostport[0]} + PORT=${hostport[1]} + shift 1 + ;; + --child) + CHILD=1 + shift 1 + ;; + -q | --quiet) + QUIET=1 + shift 1 + ;; + -s | --strict) + STRICT=1 + shift 1 + ;; + -h) + HOST="$2" + if [[ $HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + HOST="${1#*=}" + shift 1 + ;; + -p) + PORT="$2" + if [[ $PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + PORT="${1#*=}" + shift 1 + ;; + -t) + TIMEOUT="$2" + if [[ $TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + CLI="$@" + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$HOST" == "" || "$PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +TIMEOUT=${TIMEOUT:-15} +STRICT=${STRICT:-0} +CHILD=${CHILD:-0} +QUIET=${QUIET:-0} + +if [[ $CHILD -gt 0 ]]; then + wait_for + RESULT=$? + exit $RESULT +else + if [[ $TIMEOUT -gt 0 ]]; then + wait_for_wrapper + RESULT=$? + else + wait_for + RESULT=$? + fi +fi + +if [[ $CLI != "" ]]; then + if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then + echoerr "$cmdname: strict mode, refusing to execute subprocess" + exit $RESULT + fi + exec $CLI +else + exit $RESULT +fi diff --git a/Dockerfile.ci b/Dockerfile.ci new file mode 100644 index 0000000000000000000000000000000000000000..b1e875054100bb2fb48046f4aebf30cb9953e9ae --- /dev/null +++ b/Dockerfile.ci @@ -0,0 +1,17 @@ +# Debian est obligatoire à cause de playwright qui n'est pas compatible avec alpine. +FROM node:20.15.1-bookworm +WORKDIR /app +RUN apt-get update && \ + apt-get install -y make curl git && \ + apt-get clean && \ + apt-get autoclean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +COPY package*.json /app/ +COPY packages/common/package.json /app/packages/common/package.json +COPY packages/ui/package.json /app/packages/ui/package.json +COPY packages/api/package.json /app/packages/api/package.json +COPY Makefile /app/Makefile + +RUN CI=true make install +RUN mkdir /app/packages/api/node_modules /app/packages/ui/node_modules /app/packages/common/node_modules || true +RUN npx playwright@1.47.0 install --with-deps chromium diff --git a/Dockerfile.docs b/Dockerfile.docs index 7d14ca79eb3c651453fa382ad34b9e5cb2c0b6dd..dc94f38e72f6e5e05816cfbb49b8eb025ebe531a 100644 --- a/Dockerfile.docs +++ b/Dockerfile.docs @@ -4,7 +4,7 @@ RUN apk add -U make python3 py3-pip curl RUN python3 -m pip config set global.break-system-packages true COPY . /project/ WORKDIR /project -RUN make install +RUN CI=true make install RUN make docs/build FROM nginx:1.27.0 diff --git a/Makefile b/Makefile index d0a310940dc0e2c5901c254346448bb7411530d8..ecd2dca8e79e3ffba5ce5bbbc4f14c2058f00d67 100644 --- a/Makefile +++ b/Makefile @@ -108,8 +108,7 @@ lint: lint/ui lint/api lint/common install: ifdef CI -# On a enlevé --ignore-scripts car pg-formatter fait un truc très étrange en postinstall, il curl une version de pg-format en perl et le met à côté de lui pour s'en servir - HUSKY=0 npm ci + HUSKY=0 npm ci --ignore-scripts else npm ci endif @@ -185,7 +184,7 @@ ifndef GIT_SHA @exit 1 endif @echo 'on déploie sur ${DEPLOY_URL} la version ${GIT_SHA}' - @curl --fail-with-body http://${DEPLOY_URL}:3030/update/${GIT_SHA} -H 'authorization: ${CD_TOKEN}' + @curl --insecure --fail-with-body -I https://cd.${DEPLOY_URL}/update/${GIT_SHA} -H 'authorization: ${CD_TOKEN}' deploy/dev: $(MAKE) DEPLOY_URL=dev.camino.beta.gouv.fr _deploy diff --git a/README.md b/README.md index 711a3c446623eb8ca32708ae3878c8fd34956824..2af18d0db1042f45505691283faa590e6859391a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,7 @@ # Camino -[](https://github.com/MTES-MCT/camino/actions/workflows/ui-ci.yml) [](https://github.com/MTES-MCT/camino/actions/workflows/api-ci.yml) [![codecov][codecov-img]][codecov] -[codecov-img]: https://codecov.io/gh/MTES-MCT/camino/branch/master/graph/badge.svg -[codecov]: https://codecov.io/gh/MTES-MCT/camino - - -> Interface web de [Camino](https://camino.beta.gouv.fr), le cadastre minier numérique. +[](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/commits/master)  @@ -21,7 +16,7 @@ ## Configuration -- Cloner ce repo : `git clone https://github.com/MTES-MCT/camino.git`. +- Cloner ce repo : `git clone https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino.git`. - Renommer le fichier `.env-example` en `.env` et le compléter. ### Installation @@ -40,7 +35,7 @@ npm run dev -w packages/api ``` ```bash -# lance un serveur de développement de l'interface +# lance un serveur de développement de l'interface # accessible à localhost:3000 npm run dev -w packages/ui ``` diff --git a/contributing.md b/contributing.md index 590dad59110d6b030160f1edc491e4009def71ea..1f3f2a3f7a1b216462459e03339e99e0f3e7a090 100644 --- a/contributing.md +++ b/contributing.md @@ -2,25 +2,10 @@ ## Git setup -From the browser, go to the project repo on [Github](https://github.com): `https://github.com/MTES-MCT/camino` +From the browser, go to the project repo on [gitlab](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino): `https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino` Click on the `fork` button to create your own fork of the project. -Then, from the terminal: - -```bash -# Clone your fork locally. This add a remote named 'origin' pointing to your fork. -git clone git@github.com:<your-user-name>/camino.git - -# Go to the project directory -cd camino - -# Define the main repo as a remote named 'upstream'. -git remote add upstream https://github.com/MTES-MCT/camino.git - -# Now you have two remotes: 'origin' (your fork) and 'upstream' (main repo). -``` - --- ## Git workflow @@ -71,8 +56,8 @@ git push origin <my-fixes> ### 5. Make a merge request -Go to [github.com/MTES-MCT/camino](https://github.com/MTES-MCT/camino/). -Make a new merge request from your `<my-fixes>` branch against the `master` branch from the main repo. See [Github Doc](http://docs.github.com/ce/github-basics/add-merge-request.html) for more details. +Go to [gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/). +Make a new merge request from your `<my-fixes>` branch against the `master` branch from the main repo. See [Github Doc](https://docs.gitlab.com/ee/user/project/merge_requests/) for more details. **For the next fix, start over at 1.** diff --git a/docs-sources/docs/01-utilisation/01-graphql.md b/docs-sources/docs/01-utilisation/01-graphql.md index d164c23a8b168921916ea30f300f7097c2d7fd4c..4de599d061598247c3439d00dcfbb83490a00afe 100644 --- a/docs-sources/docs/01-utilisation/01-graphql.md +++ b/docs-sources/docs/01-utilisation/01-graphql.md @@ -16,21 +16,21 @@ La documentation de cette API est consultable dans l'onglets `Docs` (en haut à _GraphiQL_ est une application qui permet de consulter la documentation et de tester une API GraphQL dans un navigateur. Concernant l'API Camino, cette application est accessible à l'url racine de l'API: [api.camino.beta.gouv.fr/](https://api.camino.beta.gouv.fr/). -Des exemples de requêtes se trouvent dans [ce dossier](https://github.com/MTES-MCT/camino/blob/master/packages/api/tests/queries/). +Des exemples de requêtes se trouvent dans [ce dossier](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/packages/api/tests/queries/). ### Requêtes simples Par exemple, pour obtenir la liste des substances: -- copier une requête dans le champs principal de l'interface de _GraphiQL_: [substances.graphql](https://github.com/MTES-MCT/camino/blob/master/packages/api/tests/queries/substances.graphql) +- copier une requête dans le champs principal de l'interface de _GraphiQL_: [substances.graphql](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/packages/api/tests/queries/substances.graphql) - valider en cliquant sur le bouton `▶`. ### Requêtes avec des variables Certaines requêtes nécessitent le passage de variables. Par exemple, pour obtenir la liste des titres: -- copier la requête dans le champs principal de l'interface de _GraphiQL_: [titres.graphql](https://github.com/MTES-MCT/camino/blob/master/packages/api/tests/queries/titres.graphql) -- copier les variables dans le champs `query variables` (en bas à gauche de l'écran): [titres-variables.json](https://github.com/MTES-MCT/camino/blob/master/packages/api/tests/queries/titres-variables.json) +- copier la requête dans le champs principal de l'interface de _GraphiQL_: [titres.graphql](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/packages/api/tests/queries/titres.graphql) +- copier les variables dans le champs `query variables` (en bas à gauche de l'écran): [titres-variables.json](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/packages/api/tests/queries/titres-variables.json) - valider en cliquant sur le bouton `▶`. ### Requêtes nécessitant une authentification diff --git a/docs-sources/docs/02-developpement/01-introduction.md b/docs-sources/docs/02-developpement/01-introduction.md index 866c9c9ef3384193617f5c2e1f2f072b89efebfa..ceeeedd5f1df9979121efdfb5e07accbdb144f98 100644 --- a/docs-sources/docs/02-developpement/01-introduction.md +++ b/docs-sources/docs/02-developpement/01-introduction.md @@ -1,6 +1,6 @@ # Développement de l'API de Camino -> [github.com/MTES-MCT/camino](https://github.com/MTES-MCT/camino) +> [gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino) ## Technologies @@ -26,7 +26,7 @@ ### Configuration et imports des données -- Cloner ce repo : `git clone https://github.com/MTES-MCT/camino.git`. +- Cloner ce repo : `git clone https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino.git`. - Renommer le fichier `.env-example` en `.env` et le compléter. - Créer une base de données PostgreSQL correspondant au fichier `.env`. @@ -99,5 +99,4 @@ npm run start -w packages/api ## Contribution -Voir [contributing.md](https://github.com/MTES-MCT/camino/blob/master/contributing.md) (en anglais) pour plus d'infos. - +Voir [contributing.md](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/contributing.md) (en anglais) pour plus d'infos. diff --git a/docs-sources/docs/04-deploiement/01-introduction.md b/docs-sources/docs/04-deploiement/01-introduction.md index e0041b26e70c6e2fd6631e5378b54d9ef4ae82d6..885942649bdc530a85bc0d2b6b0e76c68d6b46ba 100644 --- a/docs-sources/docs/04-deploiement/01-introduction.md +++ b/docs-sources/docs/04-deploiement/01-introduction.md @@ -4,20 +4,18 @@ > Merger une pull-request -Tout push sur la branche [master](https://github.com/MTES-MCT/camino/tree/master) déclenche la [CI](https://github.com/MTES-MCT/camino/actions/workflows/ci.yml?query=branch%3Amaster), qui, en cas de succès, déclenche le déploiement. +Tout push sur la branche [master](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/tree/master) déclenche la [CI](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/actions/workflows/ci.yml?query=branch%3Amaster), qui, en cas de succès, déclenche le déploiement. ## PREPROD https://preprod.camino.beta.gouv.fr > Faire pointer la branche **preprod** sur le commit à livrer en preprod -Tout push sur la branche [preprod](https://github.com/MTES-MCT/camino/tree/preprod) déclenche la [CD](https://github.com/MTES-MCT/camino/actions/workflows/deploy.yml?query=branch%3Apreprod). +Tout push sur la branche [preprod](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/tree/preprod) déclenche la [CD](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/actions/workflows/deploy.yml?query=branch%3Apreprod). ## PROD https://camino.beta.gouv.fr > Faire pointer la branche **prod** sur le commit à livrer en prod -Tout push sur la branche [prod](https://github.com/MTES-MCT/camino/tree/prod) déclenche la [CD](https://github.com/MTES-MCT/camino/actions/workflows/deploy.yml?query=branch%3Aprod). -Avant de déployer, une [release github](https://github.com/MTES-MCT/camino/releases) est faite, qui contiendra toutes les features/bugfixes embarqués dans cette livraison depuis la version précédente - - +Tout push sur la branche [prod](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/tree/prod) déclenche la [CD](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/pipelines?page=1&scope=branches&ref=prod). +Avant de déployer, une [release gitlab](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/releases) est faite, qui contiendra toutes les features/bugfixes embarqués dans cette livraison depuis la version précédente diff --git a/infra/README.md b/infra/README.md index 81a95a8334844670d86a90f64400aef79c3260ba..424ef8a24c3aeb34cc20e80652758d7aaac5b753 100644 --- a/infra/README.md +++ b/infra/README.md @@ -9,5 +9,5 @@ Le script va créer les utilisateurs qui auront les droits de gérer la machine, ATTENTION, le script va planter, il faudra: - vous connecter en ssh avec votre login pour pouvoir changer votre mot de passe - relancer ansible normalement (make dev|preprod|prod) -- déployer la bonne version de camino (via github actions) +- déployer la bonne version de camino (via gitlab ci ou directement sur la machine) - aller sur la machine, et lancer le processus de restauration des backups --> `./srv/scripts/restore-last-backup` diff --git a/knip.ts b/knip.ts index f4e5432d9c9c1d4409221ce7084bd927811d4958..e56d9b77dfd3f2eb5b2986511d515b4719964dc0 100644 --- a/knip.ts +++ b/knip.ts @@ -10,10 +10,10 @@ const config = { // TODO 2023-12-28 knip voit pas les override dependencies "vue", "@types/react", + "semantic-release", "@semantic-release/commit-analyzer", "@semantic-release/github", "@semantic-release/release-notes-generator", - "playwright", "lint-staged" ], }, diff --git a/package-lock.json b/package-lock.json index ef0589c13dcac953156f172314d26794d7ebda0c..c8101848b7db8ee6628e6778b0c1595cadad54b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,11 +14,11 @@ "packages/ui" ], "devDependencies": { + "@semantic-release/gitlab": "^13.2.1", "@types/react": "file:stub/types__react", "husky": "^9.1.6", "lint-staged": "^15.2.10", "semantic-release": "^24.1.1", - "semantic-release-mattermost": "^1.2.2", "typescript": "^5.6.2", "vue": "^3.5.4" }, @@ -6056,6 +6056,39 @@ "semantic-release": ">=20.1.0" } }, + "node_modules/@semantic-release/gitlab": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/@semantic-release/gitlab/-/gitlab-13.2.1.tgz", + "integrity": "sha512-uvajKL3RbvouunvF6rWCEWmvYFW5tCq8irXvb2tW40cdI5rK22q9Uma1m/PxPtUTjggqfap86G0gst1hgeFuow==", + "dev": true, + "dependencies": { + "@semantic-release/error": "^4.0.0", + "aggregate-error": "^5.0.0", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "escape-string-regexp": "^5.0.0", + "formdata-node": "^6.0.3", + "fs-extra": "^11.0.0", + "globby": "^14.0.0", + "got": "^14.0.0", + "hpagent": "^1.0.0", + "lodash-es": "^4.17.21", + "parse-url": "^9.0.0", + "url-join": "^4.0.0" + }, + "engines": { + "node": ">=20.8.1" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/gitlab/node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "dev": true + }, "node_modules/@semantic-release/npm": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-12.0.1.tgz", @@ -6971,6 +7004,18 @@ "@swc/counter": "^0.1.3" } }, + "node_modules/@szmarczak/http-timer": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", + "integrity": "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==", + "dev": true, + "dependencies": { + "defer-to-connect": "^2.0.1" + }, + "engines": { + "node": ">=14.16" + } + }, "node_modules/@testing-library/dom": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", @@ -7505,6 +7550,12 @@ "node": ">= 6.x" } }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz", + "integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==", + "dev": true + }, "node_modules/@types/http-errors": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", @@ -7616,6 +7667,12 @@ "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", "dev": true }, + "node_modules/@types/parse-path": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/@types/parse-path/-/parse-path-7.0.3.tgz", + "integrity": "sha512-LriObC2+KYZD3FzCrgWGv/qufdUy4eXrxcLgQMfYXgPbLIecKIsVBaQgUPmxSSLcjmYbDTQbMgr6qr6l/eb7Bg==", + "dev": true + }, "node_modules/@types/pbf": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz", @@ -9855,6 +9912,61 @@ "node": ">=8" } }, + "node_modules/cacheable-lookup": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", + "integrity": "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/cacheable-request": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-12.0.1.tgz", + "integrity": "sha512-Yo9wGIQUaAfIbk+qY0X4cDQgCosecfBe3V9NSyeY4qPC2SAkbCS4Xj79VP8WOzitpJUZKc/wsRCYF5ariDIwkg==", + "dev": true, + "dependencies": { + "@types/http-cache-semantics": "^4.0.4", + "get-stream": "^9.0.1", + "http-cache-semantics": "^4.1.1", + "keyv": "^4.5.4", + "mimic-response": "^4.0.0", + "normalize-url": "^8.0.1", + "responselike": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", + "integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==", + "dev": true, + "dependencies": { + "@sec-ant/readable-stream": "^0.4.1", + "is-stream": "^4.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cacheable-request/node_modules/is-stream": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz", + "integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/caching-transform": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", @@ -11263,6 +11375,33 @@ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/dedent": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", @@ -11371,6 +11510,15 @@ "node": ">=8" } }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -13302,6 +13450,24 @@ "node": ">= 6" } }, + "node_modules/form-data-encoder": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz", + "integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/formdata-node": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-6.0.3.tgz", + "integrity": "sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, "node_modules/formidable": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", @@ -13750,6 +13916,43 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/got": { + "version": "14.4.2", + "resolved": "https://registry.npmjs.org/got/-/got-14.4.2.tgz", + "integrity": "sha512-+Te/qEZ6hr7i+f0FNgXx/6WQteSM/QqueGvxeYQQFm0GDfoxLVJ/oiwUKYMTeioColWUTdewZ06hmrBjw6F7tw==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^7.0.0", + "@szmarczak/http-timer": "^5.0.1", + "cacheable-lookup": "^7.0.0", + "cacheable-request": "^12.0.1", + "decompress-response": "^6.0.0", + "form-data-encoder": "^4.0.2", + "http2-wrapper": "^2.2.1", + "lowercase-keys": "^3.0.0", + "p-cancelable": "^4.0.1", + "responselike": "^3.0.0", + "type-fest": "^4.19.0" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/got/node_modules/@sindresorhus/is": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.0.1.tgz", + "integrity": "sha512-QWLl2P+rsCJeofkDNIT3WFmb6NrRud1SUYW8dIhXK/46XFV8Q/g7Bsvib0Askb0reRLe+WYPeeE+l5cH7SlkuQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -14048,6 +14251,15 @@ "node": "^18.17.0 || >=20.5.0" } }, + "node_modules/hpagent": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/html-encoding-sniffer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", @@ -14111,6 +14323,12 @@ "entities": "^4.4.0" } }, + "node_modules/http-cache-semantics": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "dev": true + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -14139,6 +14357,19 @@ "node": ">= 14" } }, + "node_modules/http2-wrapper": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-2.2.1.tgz", + "integrity": "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==", + "dev": true, + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.2.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, "node_modules/https-proxy-agent": { "version": "7.0.5", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", @@ -18109,6 +18340,18 @@ "get-func-name": "^2.0.1" } }, + "node_modules/lowercase-keys": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-3.0.0.tgz", + "integrity": "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lru-cache": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", @@ -18389,6 +18632,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mimic-response": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-4.0.0.tgz", + "integrity": "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/min-indent": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", @@ -21893,6 +22148,15 @@ "node": ">=0.10.0" } }, + "node_modules/p-cancelable": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-4.0.1.tgz", + "integrity": "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, "node_modules/p-each-series": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", @@ -22089,6 +22353,28 @@ "node": ">=0.10.0" } }, + "node_modules/parse-path": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/parse-path/-/parse-path-7.0.0.tgz", + "integrity": "sha512-Euf9GG8WT9CdqwuWJGdf3RkUcTBArppHABkO7Lm8IzRQp0e2r/kkFnmhu4TSK30Wcu5rVAZLmfPKSBBi9tWFog==", + "dev": true, + "dependencies": { + "protocols": "^2.0.0" + } + }, + "node_modules/parse-url": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/parse-url/-/parse-url-9.2.0.tgz", + "integrity": "sha512-bCgsFI+GeGWPAvAiUv63ZorMeif3/U0zaXABGJbOWt5OH2KCaPHF6S+0ok4aqM9RuIPGyZdx9tR9l13PsW4AYQ==", + "dev": true, + "dependencies": { + "@types/parse-path": "^7.0.0", + "parse-path": "^7.0.0" + }, + "engines": { + "node": ">=14.13.0" + } + }, "node_modules/parse5": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz", @@ -23690,6 +23976,12 @@ "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", "dev": true }, + "node_modules/protocols": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/protocols/-/protocols-2.0.1.tgz", + "integrity": "sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==", + "dev": true + }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -23924,6 +24216,18 @@ "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", "dev": true }, + "node_modules/quick-lru": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/quickselect": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz", @@ -24341,6 +24645,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", + "dev": true + }, "node_modules/resolve-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", @@ -24392,6 +24702,21 @@ "node": ">=10" } }, + "node_modules/responselike": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-3.0.0.tgz", + "integrity": "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg==", + "dev": true, + "dependencies": { + "lowercase-keys": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/restore-cursor": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", @@ -24778,15 +25103,6 @@ "node": ">=20.8.1" } }, - "node_modules/semantic-release-mattermost": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/semantic-release-mattermost/-/semantic-release-mattermost-1.2.2.tgz", - "integrity": "sha512-Hx3tCkpo4R6/wTNQu4gLHsWDqeEZ/6od953x5qJQilqDo5VLsx40Cb9tpOoF/82Qf4rnQ7EBIP9Hcft0k6WUWg==", - "dev": true, - "dependencies": { - "axios": "^1.6.8" - } - }, "node_modules/semantic-release/node_modules/@sindresorhus/merge-streams": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", diff --git a/package.json b/package.json index 8d987ba78951d0aa64cac679eddbb9f8121bbe05..4da060bea92ea78ed40f4d9385d37032017e4da8 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,13 @@ "private": true, "repository": { "type": "git", - "url": "git+https://github.com/MTES-MCT/camino.git" + "url": "git+https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino.git" }, "license": "AGPL-3.0-or-later", "bugs": { - "url": "https://github.com/MTES-MCT/camino/issues" + "url": "https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/issues" }, - "homepage": "https://github.com/MTES-MCT/camino#readme", + "homepage": "https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino#readme", "scripts": { "prepare": "husky", "test": "npm run test --workspaces", @@ -49,11 +49,11 @@ ] }, "devDependencies": { + "@semantic-release/gitlab": "^13.2.1", "@types/react": "file:stub/types__react", "husky": "^9.1.6", "lint-staged": "^15.2.10", "semantic-release": "^24.1.1", - "semantic-release-mattermost": "^1.2.2", "typescript": "^5.6.2", "vue": "^3.5.4" }, @@ -64,8 +64,7 @@ "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", - "@semantic-release/github", - "semantic-release-mattermost" + "@semantic-release/gitlab" ] } } diff --git a/packages/common/src/static/geoSystemes.ts b/packages/common/src/static/geoSystemes.ts index b5ab7f4a05dc5116ab7ae9140dc2b70248519fbc..8241bc9ab865ab6911aef06d15b943e6290e9682 100644 --- a/packages/common/src/static/geoSystemes.ts +++ b/packages/common/src/static/geoSystemes.ts @@ -42,7 +42,7 @@ export interface GeoSysteme<T = GeoSystemeId> { export const geoSystemeIdValidator = z.enum(IDS) export type GeoSystemeId = z.infer<typeof geoSystemeIdValidator> -// TODO 2024-01-18 issue https://github.com/MTES-MCT/camino/issues/919 --> pour les degrès, on affiche la notation DMS également +// TODO 2024-01-18 issue https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/issues/919 --> pour les degrès, on affiche la notation DMS également export const GeoSystemes = { '2154': { diff --git a/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/sections.test.ts b/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/sections.test.ts index 7c8cb5978eeb88db6b6dc895c53389621127327c..628afb11b41abd8d9e2997c09fe24b38aef09160 100644 --- a/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/sections.test.ts +++ b/packages/common/src/static/titresTypes_demarchesTypes_etapesTypes/sections.test.ts @@ -1,5 +1,5 @@ import { isNumberElement } from '../../sections' -import { getSections, getSectionsWithValue, sectionValidator } from './sections' +import { getElementWithValue, getSections, getSectionsWithValue, sectionValidator } from './sections' import { test, expect, describe } from 'vitest' const activitesSectionsProd = require('./activites.sections.json') // eslint-disable-line @@ -156,6 +156,55 @@ test('sectionValidator prod', () => { ) }) +describe('getElementWithValue', () => { + const sectionWithValue = getSectionsWithValue( + [ + { + id: 'section', + elements: [ + { id: 'element1', type: 'checkboxes', options: [{ id: 'option1', nom: 'nomOption1' }], optionnel: false }, + { + id: 'element2', + type: 'checkboxes', + options: [ + { id: '1', nom: 'one' }, + { id: '2', nom: 'two' }, + ], + optionnel: false, + }, + { id: 'element3', type: 'checkboxes', options: [{ id: '1', nom: 'one' }], optionnel: false }, + ], + }, + ], + { section: { element1: null, element2: ['1'] } } + ) + test('peut récupérer un élement avec sa value', () => { + expect(getElementWithValue(sectionWithValue, 'section', 'element2')).toMatchInlineSnapshot(` + { + "id": "element2", + "optionnel": false, + "options": [ + { + "id": "1", + "nom": "one", + }, + { + "id": "2", + "nom": "two", + }, + ], + "type": "checkboxes", + "value": [ + "1", + ], + } + `) + }) + + test('ne récupére rien si inexistant', () => { + expect(getElementWithValue(sectionWithValue, 'section', 'elementInexistant')).toStrictEqual(null) + }) +}) describe('getSectionsWithValue', () => { test('les éléments checkboxes sont initialisés avec un tableau vide', () => { expect( diff --git a/packages/common/vitest.config.ts b/packages/common/vitest.config.ts index 80d09af957ef63c2f2eb26ea7ed31f3c1f9ee4be..ca880cb79cffde50b364c7435f80444c405cc582 100644 --- a/packages/common/vitest.config.ts +++ b/packages/common/vitest.config.ts @@ -10,10 +10,10 @@ export default defineConfig({ thresholds: { // the endgame is to put thresholds at 100 and never touch it again :) autoUpdate: true, - branches: 91.81, - functions: 83.85, - lines: 96.81, - statements: 96.81, + branches: 91.85, + functions: 84.25, + lines: 96.87, + statements: 96.87, perFile: false, }, }, diff --git a/packages/ui/src/components/_common/geosysteme-typeahead.tsx b/packages/ui/src/components/_common/geosysteme-typeahead.tsx index 1a445c40f247be2a3511fe73271dc80e52b27f4f..a9b78145ccc56bc21a6098acca69e2e07844df1d 100644 --- a/packages/ui/src/components/_common/geosysteme-typeahead.tsx +++ b/packages/ui/src/components/_common/geosysteme-typeahead.tsx @@ -4,7 +4,7 @@ import { GeoSysteme, GeoSystemes, GeoSystemeId, sortedGeoSystemes } from 'camino import { capitalize } from 'camino-common/src/strings' import { isNotNullNorUndefined } from 'camino-common/src/typescript-tools' -// https://github.com/MTES-MCT/camino/issues/917 +// https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/issues/917 const mainGeoSystemeIds = ['4326', '2154', '5490', '2972', '2975', '4471', '4467'] as const satisfies readonly GeoSystemeId[] // TODO 2024-02-26, attention, vue rajoute tous les champs qui sont dans GeoSystemeTypeahead.props et les met à undefined, donc le typage n'est pas tout à fait correct par rapport à la réalité :( diff --git a/packages/ui/src/components/page/footer.stories_snapshots_AvecNewsletter.html b/packages/ui/src/components/page/footer.stories_snapshots_AvecNewsletter.html index 390dc0e2ff4e57cc507870d64e2b629d13584763..3b1de1c1edaabf3234b6ad75e3c9e7c1a6b30309 100644 --- a/packages/ui/src/components/page/footer.stories_snapshots_AvecNewsletter.html +++ b/packages/ui/src/components/page/footer.stories_snapshots_AvecNewsletter.html @@ -76,10 +76,10 @@ <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://camino.gitbook.io/guide-dutilisation/a-propos/accessibilite" target="_blank" rel="noopener noreferrer" title="Page de l’accessibilité - lien externe">Accessibilité : non conforme</a></li> <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://camino.gitbook.io/guide-dutilisation/a-propos/mentions-legales" target="_blank" rel="noopener noreferrer" title="Page des mentions légales- lien externe">Mentions légales</a></li> <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://camino.gitbook.io/guide-dutilisation/a-propos/cgu" target="_blank" rel="noopener noreferrer" title="Page des conditions générales des conditions d’utilisation - lien externe">CGU</a></li> - <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://github.com/MTES-MCT/camino/commit/310c30f5b4d779cd4bc17316f4b026292bb95c10" target="_blank" rel="noopener noreferrer" title="Page Github de la version de l’application - lien externe">Version 310c30f</a></li> + <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/commit/310c30f5b4d779cd4bc17316f4b026292bb95c10" target="_blank" rel="noopener noreferrer" title="Page Github de la version de l’application - lien externe">Version 310c30f</a></li> </ul> <div class="fr-footer__bottom-copy"> - <p>Sauf mention contraire, tous les contenus de ce site sont sous <a href="https://github.com/MTES-MCT/camino/blob/master/license.md" target="_blank" rel="noopener noreferrer" title="Page de la licence utilisée par Camino - lien externe">licence GNU AGPLv3</a></p> + <p>Sauf mention contraire, tous les contenus de ce site sont sous <a href="https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/license.md" target="_blank" rel="noopener noreferrer" title="Page de la licence utilisée par Camino - lien externe">licence GNU AGPLv3</a></p> </div> </div> </div> diff --git a/packages/ui/src/components/page/footer.stories_snapshots_SansNewsletter.html b/packages/ui/src/components/page/footer.stories_snapshots_SansNewsletter.html index fd04909b9f13fedc2f97005d258b22ed92e87c3b..d1092624b264711c749213531679c135916b327f 100644 --- a/packages/ui/src/components/page/footer.stories_snapshots_SansNewsletter.html +++ b/packages/ui/src/components/page/footer.stories_snapshots_SansNewsletter.html @@ -47,10 +47,10 @@ <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://camino.gitbook.io/guide-dutilisation/a-propos/accessibilite" target="_blank" rel="noopener noreferrer" title="Page de l’accessibilité - lien externe">Accessibilité : non conforme</a></li> <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://camino.gitbook.io/guide-dutilisation/a-propos/mentions-legales" target="_blank" rel="noopener noreferrer" title="Page des mentions légales- lien externe">Mentions légales</a></li> <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://camino.gitbook.io/guide-dutilisation/a-propos/cgu" target="_blank" rel="noopener noreferrer" title="Page des conditions générales des conditions d’utilisation - lien externe">CGU</a></li> - <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://github.com/MTES-MCT/camino/commit/310c30f5b4d779cd4bc17316f4b026292bb95c10" target="_blank" rel="noopener noreferrer" title="Page Github de la version de l’application - lien externe">Version 310c30f</a></li> + <li class="fr-footer__bottom-item"><a class="fr-footer__bottom-link" href="https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/commit/310c30f5b4d779cd4bc17316f4b026292bb95c10" target="_blank" rel="noopener noreferrer" title="Page Github de la version de l’application - lien externe">Version 310c30f</a></li> </ul> <div class="fr-footer__bottom-copy"> - <p>Sauf mention contraire, tous les contenus de ce site sont sous <a href="https://github.com/MTES-MCT/camino/blob/master/license.md" target="_blank" rel="noopener noreferrer" title="Page de la licence utilisée par Camino - lien externe">licence GNU AGPLv3</a></p> + <p>Sauf mention contraire, tous les contenus de ce site sont sous <a href="https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/license.md" target="_blank" rel="noopener noreferrer" title="Page de la licence utilisée par Camino - lien externe">licence GNU AGPLv3</a></p> </div> </div> </div> diff --git a/packages/ui/src/components/page/footer.tsx b/packages/ui/src/components/page/footer.tsx index 923c97b005c05efcb670012bb8165bb6b39d833f..b2ab850c63268d9e61722e92a35ae40bcaa3aeba 100644 --- a/packages/ui/src/components/page/footer.tsx +++ b/packages/ui/src/components/page/footer.tsx @@ -147,7 +147,7 @@ export const Footer: FunctionalComponent<Props> = (props: Props) => ( <li class="fr-footer__bottom-item"> <a class="fr-footer__bottom-link" - href={'https://github.com/MTES-MCT/camino/commit/' + props.version} + href={'https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/-/commit/' + props.version} target="_blank" rel="noopener noreferrer" title="Page Github de la version de l’application - lien externe" @@ -159,7 +159,12 @@ export const Footer: FunctionalComponent<Props> = (props: Props) => ( <div class="fr-footer__bottom-copy"> <p> Sauf mention contraire, tous les contenus de ce site sont sous{' '} - <a href="https://github.com/MTES-MCT/camino/blob/master/license.md" target="_blank" rel="noopener noreferrer" title="Page de la licence utilisée par Camino - lien externe"> + <a + href="https://gitlab-forge.din.developpement-durable.gouv.fr/pub/pnm-public/camino/blob/master/license.md" + target="_blank" + rel="noopener noreferrer" + title="Page de la licence utilisée par Camino - lien externe" + > licence GNU AGPLv3 </a> </p>