Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.18 KiB
stages:
  - check
  - build
  - deploy

variables:
  GIT_SUBMODULE_STRATEGY: recursive
  GIT_DEPTH: 0

default:
  # built via:
  #     docker load < $(nix-build nix/docker-image.nix)
  image: registry.gitlab.com/flow3r-badge/flow3r-build:238576xsg79mjr2bkqg106qisvd3b5q9

clang-tidy:
  stage: check
  script:
    - "bash tools/clang-tidy.sh"
    - "python3 tools/codequal-report.py clang-tidy warnings.txt > cqual.json"
  artifacts:
    when: always
    reports:
      codequality: cqual.json

format:
  stage: check
  script:
    - "git clean -fdx"
    - "bash tools/format.sh"
    - "[ -z \"$(git status --porcelain)\" ] || (echo 'Differences found, please run tools/format.sh.' && git diff HEAD && exit 1)"

build:
  stage: build
  script:
    - idf.py -g c23 build size
  artifacts:
    expose_as: 'firmware'
    paths: ['build/flow3r.bin']
    expire_in: 5 hours

build_recovery:
  stage: build
  script:
    - cd recovery
    - idf.py build size
  artifacts:
    expose_as: 'Recovery'
    paths: ['recovery/build/flow3r-recovery.bin', 'recovery/build/partition_table/partition-table.bin', 'recovery/build/bootloader/bootloader.bin']
    expire_in: 5 hours

simulate:
  stage: build
  script:
    - python3 sim/run.py --screenshot
  artifacts:
    expose_as: 'Simulator Screenshot'
    paths: ['flow3r.png']
    expire_in: 5 hours

pages:
  stage: deploy
  rules:
    - if: $CI_COMMIT_BRANCH == "main"
  script:
    - git tag | xargs git tag -d
    - git checkout origin/main
    - git checkout -b dev
    - git branch --all
    - git branch --all | sed -e 's/..//' | grep '^remotes/origin/release/' | while read b; do git checkout -b "v${b#remotes/origin/release/}" "$b"; done
    - git checkout dev