Commit 9d8bcb68 authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

feat: add frontend jobs to the GitLab CI and bring portal-gui to a passing...

feat: add frontend jobs to the GitLab CI and bring portal-gui to a passing lint, typecheck and format baseline
parent 3c61ec8f
Loading
Loading
Loading
Loading
Loading
+67 −20
Changes for .gitlab-ci.yml: 67 added lines, 20 removed lines.
Original line number Diff line number Diff line
default:
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
      when: never
    - if: $CI_COMMIT_BRANCH

variables:
  UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"

.backend:
  image: python:3.12-slim
  needs: []
  cache:
    paths:
      - .cache/uv
@@ -9,39 +20,55 @@ default:
    - export UV_SYSTEM_CERTS=1
    - uv sync --locked --extra dev
    - . .venv/bin/activate
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "develop"
    - changes:
        - src/**/*
        - tests/**/*
        - pyproject.toml
        - uv.lock
        - .gitlab-ci.yml

stages:
  - type
  - architecture
  - lint
  - format
  - test

variables:
  UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"
.frontend:
  image: node:22-slim
  needs: []
  cache:
    key:
      files:
        - portal-gui/package-lock.json
    paths:
      - portal-gui/.npm/
  before_script:
    - cd "$CI_PROJECT_DIR/portal-gui"
    - npm ci --cache .npm --prefer-offline --no-audit --no-fund
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "develop"
    - changes:
        - portal-gui/**/*
        - .gitlab-ci.yml

type:
  stage: type
backend:type:
  extends: .backend
  script:
    - mypy src/ tests/

architecture:
  stage: architecture
backend:architecture:
  extends: .backend
  script:
    - lint-imports

lint:
  stage: lint
backend:lint:
  extends: .backend
  script:
    - ruff check src/ tests/

format:
  stage: format
backend:format:
  extends: .backend
  script:
    - ruff format --check src/ tests/

test:
  stage: test
backend:test:
  extends: .backend
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
@@ -50,3 +77,23 @@ test:
  script:
    - pytest --cov=src/portal_service --cov-branch --cov-report=term-missing
  coverage: '/TOTAL.+ ([0-9]{1,3}(?:\.[0-9]+)?%)/'

gui:typecheck:
  extends: .frontend
  script:
    - npm run typecheck

gui:lint:
  extends: .frontend
  script:
    - npm run lint

gui:format:
  extends: .frontend
  script:
    - npm run format:check

gui:build:
  extends: .frontend
  script:
    - npm run build
+0 −1
Changes for deployment/Chart.yaml: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -12,4 +12,3 @@ keywords:
home: https://labs.etsi.org/rep/oop/code/dev-portal
maintainers:
  - name: OOP Team
+0 −1
Changes for deployment/values.yaml: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -21,4 +21,3 @@ resources:
  requests:
    cpu: 100m
    memory: 256Mi

portal-gui/.eslintrc.cjs

deleted100644 → 0
+0 −20
Changes for portal-gui/.eslintrc.cjs: 0 added lines, 20 removed lines.
Original line number Diff line number Diff line
module.exports = {
  extends: [
    'eslint:recommended',
    'plugin:react/recommended',
    'plugin:react-hooks/recommended',
    'prettier',
  ],
  parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
  },
  settings: {
    react: {
      version: 'detect',
    },
  },
  rules: {
    'react/react-in-jsx-scope': 'off',
  },
};
+1 −2
Changes for portal-gui/README.md: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -53,12 +53,11 @@ OEG_SERVICE_URL=http://my-oeg:32263/oeg/1.0.0 npm run dev

**npm fails to isntall dnd-kit packages**
In case the dnd packages are missing from package.json, the npm install will fail (Vite error: “Failed to resolve import”). To overcome this, the next command should be executed before the `npm run dev`:

```bash
npm install @dnd-kit/core @dnd-kit/modifiers @dnd-kit/sortable @dnd-kit/utilities
```



---

## Docker
Loading