1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00
trezor-firmware/.gitlab-ci.yml
2019-04-26 17:40:40 +02:00

173 lines
4.0 KiB
YAML

variables:
# Init submodules.
# See https://docs.gitlab.com/ee/ci/yaml/#git-submodule-strategy
GIT_SUBMODULE_STRATEGY: "recursive"
# Use shallow cloning to speed up git clone. This can fail, if retrying an older build on CI
# and the old commit is not in the shallow history any more.
# See https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
GIT_DEPTH: "50"
# run make paralel
MAKEFLAGS: "-j10"
stages:
- environment
- prebuild
- build
- test
environment:
stage: environment
image: docker:latest
variables:
CONTAINER_NAME: "$CI_REGISTRY/trezor/trezor-firmware/environment"
services:
- docker:dind
before_script:
- docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
when: manual
script:
- docker pull $CONTAINER_NAME:latest || true
- docker build --cache-from $CONTAINER_NAME:latest --tag $CONTAINER_NAME:$CI_COMMIT_SHA --tag $CONTAINER_NAME:latest .
- docker push $CONTAINER_NAME:$CI_COMMIT_SHA
- docker push $CONTAINER_NAME:latest
image: registry.corp.sldev.cz/trezor/trezor-firmware/environment
before_script:
- pipenv install
style:
stage: prebuild
script:
- pipenv run make style_check
- cd core && pipenv run make templates_check # TODO
common:
stage: prebuild
script:
- cd common
- pipenv run jsonlint defs/*.json
- pipenv run jsonlint defs/*/*.json
- pipenv run python tools/cointool.py check
- pipenv run python tools/support.py check --ignore-missing
- pipenv run python protob/check.py
- pipenv run python protob/graph.py protob/*.proto # TODO: artifacts?
build core firmware:
stage: build
script:
- cd core
- pipenv run make build_cross
- pipenv run make build_boardloader
- pipenv run make build_bootloader
- pipenv run make build_prodtest
- pipenv run make build_firmware
# - test "$TREZOR_MODEL" = "1" || pipenv run make sizecheck
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- core/build/firmware/firmware.bin
- core/build/bootloader/bootloader.bin
expire_in: 1 week
build core unix:
stage: build
script:
- cd core
- pipenv run make build_unix_noui
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
untracked: true
expire_in: 1 day
# TODO: matrix: gcc vs clang
build legacy firmware:
stage: build
script:
- cd legacy
- pipenv run script/cibuild
- pipenv run make -C bootloader
- pipenv run make -C demo
build legacy emu:
stage: build
variables:
HEADLESS: "1"
EMULATOR: "1"
DEBUG_LINK: "1"
script:
- cd legacy
- pipenv run script/cibuild
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
untracked: true
expire_in: 1 day
build crypto:
stage: build
script:
- cd crypto
- pipenv run make
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
untracked: true
expire_in: 1 day
test core unix unit:
stage: test
dependencies:
- build core unix
script:
- cd core
- pipenv run make test
test core unix device:
stage: test
dependencies:
- build core unix
script:
- cd core
- pipenv run make test_emu
test core unix monero:
stage: test
dependencies:
- build core unix
script:
- cd core
- pipenv run make test_emu_monero
# TODO: matrix: do we need to test gcc vs clang as well? or build is enough?
# TODO: aren't some tests from .travis.yml missing?
test legacy emu:
stage: test
dependencies:
- build legacy emu
variables:
EMULATOR: "1"
script:
- cd legacy
- pipenv run script/test
test crypto:
stage: test
dependencies:
- build crypto
script:
- cd crypto
- ./tests/aestst
- ./tests/test_check
- CK_TIMEOUT_MULTIPLIER=20 valgrind -q --error-exitcode=1 ./tests/test_check
- ./tests/test_openssl 1000
- ITERS=10 pipenv run pytest tests/ # TODO are ITERS=10 propagated?
test storage:
stage: test
dependencies: []
script:
- cd storage/tests
- pipenv run make build
- pipenv run make tests_all