forked from michahoiting/rv-link
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
93 lines (86 loc) · 2.62 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
variables:
NUCLEI_SDK: git@gito:software/library/nuclei-sdk.git
SDK_BRANCH: develop
IMAGE: rego.corp.nucleisys.com/software/sdkbuild
IMAGE_TAG: "2024.06"
default:
tags:
- env::docker
- net::outside
image: $IMAGE:$IMAGE_TAG
before_script:
- free -g
- uname -a
- lscpu
stages:
- build
prepare_sdk:
timeout: 4h
interruptible: true
stage: build
script:
- apt update
- command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
# important: need to avoid git ssh asking yes/no when clone
# https://serverfault.com/questions/469052/ssh-failing-from-script-working-on-command-line-git
- ssh-keyscan gito > ~/.ssh/known_hosts
- git clone -b $SDK_BRANCH --depth 3 $NUCLEI_SDK nuclei_sdk
- pushd nuclei_sdk
- echo "Nuclei SDK commit hash $(git describe --always --tags)"
- popd
artifacts:
when: always
name: "nsdk-job${CI_JOB_ID}"
paths:
- nuclei_sdk
expire_in: 1 day
.build_job_template: &build_job_template_default
timeout: 4h
interruptible: true
stage: build
needs: ["prepare_sdk"]
variables:
SOC: "gd32vf103"
BOARD: "gd32vf103c_dlink"
script:
- export NUCLEI_SDK_ROOT=$(readlink -f nuclei_sdk)
- pushd $NUCLEI_SDK_ROOT
- export NUCLEI_SDK_COMMIT_HASH=$(git describe --always --tags)
- popd
- echo "Build DLink Firmware for ${BOARD}"
- make SOC=${SOC} BOARD=${BOARD} clean
- make SOC=${SOC} BOARD=${BOARD} V=1
- make SOC=${SOC} BOARD=${BOARD} dasm
- make SOC=${SOC} BOARD=${BOARD} bin
- export DLINK_BUILD_INFO=dlink.build
- echo "Store build information in ${DLINK_BUILD_INFO}"
- echo "Build timestamp $(date --utc +%s), pipeline id ${CI_PIPELINE_ID}, job id ${CI_JOB_ID}" > ${DLINK_BUILD_INFO}
- echo "Build via make SOC=${SOC} BOARD=${BOARD} clean dasm bin" >> ${DLINK_BUILD_INFO}
- echo "Nuclei SDK Commit ${NUCLEI_SDK_COMMIT_HASH}" >> ${DLINK_BUILD_INFO}
- echo "Nuclei DLink Commit ${CI_COMMIT_SHA::8}" >> ${DLINK_BUILD_INFO}
- cat ${DLINK_BUILD_INFO}
artifacts:
when: always
name: "dlink_firmware-${BOARD}-job${CI_JOB_ID}-${CI_COMMIT_SHA::8}"
paths:
- dlink.hex
- dlink.bin
- dlink.map
- dlink.elf
- dlink.build
- dlink.dump
expire_in: 15 day
build:gd32v-rvstar:
<<: *build_job_template_default
variables:
SOC: "gd32vf103"
BOARD: "gd32vf103v_rvstar"
build:gd32c-dlink:
<<: *build_job_template_default
variables:
SOC: "gd32vf103"
BOARD: "gd32vf103c_dlink"