forked from LedgerHQ/app-hive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
77 lines (71 loc) · 2.32 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
stages:
- tests:unit
- build
- tests:functional
- upload
- release
variables:
NANOS_APP: "nanos-$CI_COMMIT_TAG.hex"
NANOX_APP: "nanox-$CI_COMMIT_TAG.hex"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/binaries/$CI_COMMIT_TAG"
unit-tests:
stage: tests:unit
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
script:
- apt install lcov -y
- make
- cd unit-tests
- cmake -Bbuild -H. && make -C build && CTEST_OUTPUT_ON_FAILURE=1 make -C build test
- ./gen_coverage.sh
artifacts:
paths:
- unit-tests/coverage/
- bin/
build:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
stage: build
rules:
- if: $CI_COMMIT_TAG
parallel:
matrix:
- TARGET: [nanos, nanox]
script:
- mkdir -p out
- export SDK=${TARGET^^}_SDK
- BOLOS_SDK=${!SDK} make clean && BOLOS_SDK=${!SDK} make
- cp bin/app.hex out/${TARGET}-$CI_COMMIT_TAG.hex
artifacts:
paths:
- out/
functional-tests:
stage: tests:functional
image: hrozynskyi/dind-node:14
services:
- docker:dind
script:
- apk add --update python3 make g++ pkgconfig build-base
- docker run -d --name speculos --rm -v $(realpath .)/bin:/speculos/apps -p 5000:5000 -p 40000:40000 ghcr.io/ledgerhq/speculos:latest --display headless --apdu-port 40000 -s "salon stock memory business develop elegant chronic kite aspect nothing tone essay huge knock flip bar noise main cloth coin flavor only melody gain" apps/app.elf
- cd test
- npm ci
- npm test
- docker container stop speculos
upload:
stage: upload
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file out/${NANOX_APP} $PACKAGE_REGISTRY_URL/${NANOX_APP}
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file out/${NANOS_APP} $PACKAGE_REGISTRY_URL/${NANOS_APP}
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- |
release-cli create --name $CI_COMMIT_TAG --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"$NANOX_APP\",\"url\":\"$PACKAGE_REGISTRY_URL/$NANOX_APP\"}" \
--assets-link "{\"name\":\"$NANOS_APP\",\"url\":\"$PACKAGE_REGISTRY_URL/$NANOS_APP\"}"