From 46b10b1243b86c73bd8c67450d671cd8e9ce8036 Mon Sep 17 00:00:00 2001 From: LittleSam129 <1qwe432@gmail.com> Date: Mon, 10 Aug 2026 15:38:35 +0300 Subject: [PATCH] Add the GitLab CI pipeline Three stages, all fast: the gate, then the core tests, then style. Only the calculation environment is installed, no pyadi-iio or libiio, so the pipeline needs no hardware. Laboratory experiments stay out of it: they run for minutes, need inputs from data/raw that are not in the repository, and some need a PlutoSDR attached. Those remain manual. The style job is allow_failure for now. Lab001-Lab041 use a distinctive layout with one argument per line, and normalising it would mean touching 50 files whose results are already recorded. The restriction lifts once we agree on the rules. Test results are published as a JUnit report so failures show up in the merge request rather than only in the job log. Both jobs verified locally: gate passes, 125 tests pass in 0.26 s. Registering a runner on git.arconlab.ru is the one part that has to be done on the server side. Co-Authored-By: Claude Opus 5 --- .gitlab-ci.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..cb3ebb8 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,60 @@ +# Непрерывная проверка SDR Rover Link. +# +# Здесь выполняются только быстрые проверки: они должны укладываться в +# секунды. Лабораторные эксперименты сюда не помещаются — они длятся +# минутами, требуют исходных данных из data/raw и в части случаев +# подключённого PlutoSDR. Их запуск остаётся ручным. +# +# Оборудование конвейеру не нужно: устанавливается только расчётное +# окружение, без pyadi-iio и libiio. + +stages: + - gate + - test + - lint + +default: + image: python:3.13 + before_script: + - python --version + - python -m pip install --quiet --upgrade pip + - python -m pip install --quiet -r requirements.txt + cache: + key: "python-$CI_COMMIT_REF_SLUG" + paths: + - .cache/pip + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + PYTHONIOENCODING: "utf-8" + +# Дешёвый шлюз: синтаксис всех файлов, импорт protocol и функциональные +# проверки тех лабораторных, которым не нужны данные эксперимента. +# Выполняется первым, потому что ловит самые грубые поломки за секунду. +быстрый-шлюз: + stage: gate + script: + - python tools/quick_gate.py + +# Быстрые проверки ядра протокола. +тесты-ядра: + stage: test + script: + - python -m pytest tests/ -q --junitxml=report.xml + artifacts: + when: always + reports: + junit: report.xml + expire_in: 1 week + +# Проверка стиля. Пока не блокирует конвейер: в лабораторных Lab001–Lab041 +# принято своеобразное оформление с переносами аргументов, и приводить их +# к единому стилю сейчас означало бы тронуть 50 файлов с зафиксированными +# результатами. Ограничение снимается, когда договоримся о правилах. +стиль: + stage: lint + allow_failure: true + before_script: + - python -m pip install --quiet ruff + script: + - ruff check protocol/ tests/ tools/