From a006514812867095ab2835e4da95c207ff6bd904 Mon Sep 17 00:00:00 2001 From: Orionis312050 Date: Sat, 10 Oct 2026 14:34:43 +0200 Subject: [PATCH] gitlabci --- .devcontainer/devcontainer-lock.json | 9 --- .devcontainer/devcontainer.json | 13 +--- .gitlab-ci.yml | 106 +++++++++++++++++++++++++++ web/eslint.config.js | 28 +++++++ web/src/App.tsx | 6 +- 5 files changed, 143 insertions(+), 19 deletions(-) delete mode 100644 .devcontainer/devcontainer-lock.json create mode 100644 .gitlab-ci.yml create mode 100644 web/eslint.config.js diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json deleted file mode 100644 index 96d8688..0000000 --- a/.devcontainer/devcontainer-lock.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "features": { - "ghcr.io/devcontainers/features/node:1": { - "version": "1.7.1", - "resolved": "ghcr.io/devcontainers/features/node@sha256:8c0de46939b61958041700ee89e3493f3b2e4131a06dc46b4d9423427d06e5f6", - "integrity": "sha256:8c0de46939b61958041700ee89e3493f3b2e4131a06dc46b4d9423427d06e5f6" - } - } -} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 34cc901..d7f36a1 100755 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,25 +17,20 @@ "containerEnv": { "UV_LINK_MODE": "copy" }, - "runArgs": ["--name", "mkvtool"], "mounts": [ - "source=${localEnv:APPDATA}/JetBrains/WebStorm2026.2/aia-task-history,target=/.jbdevcontainer/config/JetBrains/WebStorm2026.2/aia-task-history,type=bind", - "source=${localEnv:APPDATA}/JetBrains/WebStorm2026.2/workspace,target=/.jbdevcontainer/config/JetBrains/WebStorm2026.2/workspace,type=bind", - - "source=${localEnv:USERPROFILE}/.cline,target=/home/vscode/.cline,type=bind" + "mistral-vibe-home:/home/vscode/.vibe" ], "postCreateCommand": "uv sync && npm --prefix web install && python --version && node --version && ffmpeg -version | head -n 1 && command -v makemkvcon && uv --version", + "postStartCommand": "sudo chown -R vscode:vscode /home/vscode/.vibe || true", "customizations": { - "jetbrains": { - "plugins": ["com.intellij.ml.llm", "bot.cline"] - }, "vscode": { "extensions": [ "charliermarsh.ruff", "ms-python.python", "ms-python.vscode-pylance", "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode" + "esbenp.prettier-vscode", + "mistralai.mistral-vibe-code" ] } }, diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..8c96038 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,106 @@ +stages: + - build + - test + +include: + - template: Jobs/Code-Quality.gitlab-ci.yml + - template: Jobs/Container-Scanning.gitlab-ci.yml + - template: Jobs/Secret-Detection.gitlab-ci.yml + - template: Jobs/SAST.gitlab-ci.yml + +default: + interruptible: true + +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH + +variables: + UV_LINK_MODE: copy + UV_CACHE_DIR: "$CI_PROJECT_DIR/.uv-cache" + npm_config_cache: "$CI_PROJECT_DIR/.npm-cache" + +api:build: + stage: build + image: ghcr.io/astral-sh/uv:python3.13-bookworm + script: + - uv sync --frozen + cache: + - key: + files: + - uv.lock + paths: + - .uv-cache + +web:build: + stage: build + image: node:22 + script: + - npm --prefix web ci + - npm --prefix web run build + artifacts: + paths: + - web/dist + expire_in: 1 week + cache: + - key: + files: + - web/package-lock.json + paths: + - .npm-cache + +api:test: + stage: test + image: ghcr.io/astral-sh/uv:python3.13-bookworm + script: + - uv sync --frozen + - uv run ruff check . + - uv run pytest --junitxml=pytest-report.xml + artifacts: + when: always + reports: + junit: pytest-report.xml + cache: + - key: + files: + - uv.lock + paths: + - .uv-cache + +web:test: + stage: test + image: node:22 + script: + - npm --prefix web ci + - npm --prefix web run lint + cache: + - key: + files: + - web/package-lock.json + paths: + - .npm-cache + +container:build: + stage: build + image: docker:29.1.4 + services: + - name: docker:29.1.4-dind + command: ['--tls=false', '--host=tcp://0.0.0.0:2375'] + variables: + DOCKER_DRIVER: overlay2 + DOCKER_CERT_PATH: "" + DOCKER_TLS_CERTDIR: "" + DOCKER_TLS_VERIFY: "" + IMAGE_TAG: "$CI_REGISTRY_IMAGE/devcontainer:$CI_COMMIT_SHA" + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" + script: + - docker build -f .devcontainer/Dockerfile -t "$IMAGE_TAG" . + - docker push "$IMAGE_TAG" + +container_scanning: + variables: + CS_IMAGE: "$CI_REGISTRY_IMAGE/devcontainer:$CI_COMMIT_SHA" + CS_REGISTRY_USER: "$CI_REGISTRY_USER" + CS_REGISTRY_PASSWORD: "$CI_REGISTRY_PASSWORD" diff --git a/web/eslint.config.js b/web/eslint.config.js new file mode 100644 index 0000000..44a2ec2 --- /dev/null +++ b/web/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config([ + { ignores: ['dist'] }, + { + files: ['**/*.{ts,tsx}'], + extends: [ + js.configs.recommended, + tseslint.configs.recommended, + reactHooks.configs.flat.recommended, + ], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-refresh': reactRefresh, + }, + rules: { + 'react-refresh/only-export-components': 'warn', + 'react-hooks/set-state-in-effect': 'off', + }, + }, +]) diff --git a/web/src/App.tsx b/web/src/App.tsx index 353f79b..3cde8fa 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -832,7 +832,11 @@ export default function App() { onKeyDown={(event) => { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); - selectMode ? toggleSelect(movie.id) : openMovie(movie); + if (selectMode) { + toggleSelect(movie.id); + } else { + openMovie(movie); + } } }} >