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 <noreply@anthropic.com>
This commit is contained in:
LittleSam129
2026-08-10 15:38:35 +03:00
parent 0ae04ae4a8
commit 46b10b1243

60
.gitlab-ci.yml Normal file
View File

@@ -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
# Проверка стиля. Пока не блокирует конвейер: в лабораторных Lab001Lab041
# принято своеобразное оформление с переносами аргументов, и приводить их
# к единому стилю сейчас означало бы тронуть 50 файлов с зафиксированными
# результатами. Ограничение снимается, когда договоримся о правилах.
стиль:
stage: lint
allow_failure: true
before_script:
- python -m pip install --quiet ruff
script:
- ruff check protocol/ tests/ tools/