forked from milkv-duo/duo-buildroot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
72 lines (64 loc) · 3.4 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
image: ubuntu:22.04
variables:
TZ: US/Pacific
OPENLCH_PROJECT_ID: "6"
OPENLCH_PROJECT_TOKEN: ${TOKEN}
stages:
- build
build_milkv_duo_image:
stage: build
only:
- tags
before_script:
- apt-get update -qq
- ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
- DEBIAN_FRONTEND=noninteractive apt-get install -y -qq pkg-config build-essential ninja-build automake autoconf libtool wget curl git gcc libssl-dev bc slib squashfs-tools android-sdk-libsparse-utils jq python3-distutils scons parallel tree python3-dev python3-pip device-tree-compiler ssh cpio fakeroot libncurses5 flex bison libncurses5-dev genext2fs rsync unzip dosfstools mtools tcl openssh-client cmake expect libconfuse2
- |
if [ "$(dpkg -s libssl1.1 | grep 'Status:')" != "Status: install ok installed" ]; then
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
fi
- DEBIAN_FRONTEND=noninteractive apt-get install -y -qq xz-utils
script:
# Fetch the latest successful pipeline ID from the main branch
- >
PIPELINE_ID=$(curl --header "PRIVATE-TOKEN: $OPENLCH_PROJECT_TOKEN"
"https://gitlab.kscale.ai/api/v4/projects/$OPENLCH_PROJECT_ID/pipelines?ref=main&status=success&order_by=id&sort=desc&per_page=1"
| jq '.[0].id')
# Function to download artifacts for a specific job
- |
download_artifacts() {
local job_name=$1
local job_id=$(curl --header "PRIVATE-TOKEN: $OPENLCH_PROJECT_TOKEN" "https://gitlab.kscale.ai/api/v4/projects/$OPENLCH_PROJECT_ID/pipelines/$PIPELINE_ID/jobs?scope[]=success" | jq --arg name "$job_name" '.[] | select(.name == $name) | .id')
curl --header "PRIVATE-TOKEN: $OPENLCH_PROJECT_TOKEN" "https://gitlab.kscale.ai/api/v4/projects/$OPENLCH_PROJECT_ID/jobs/$job_id/artifacts" --output ${job_name}_artifacts.zip
unzip -o ${job_name}_artifacts.zip -d ${job_name}_artifacts
rm ${job_name}_artifacts.zip
}
# Download artifacts for each job
- download_artifacts "build-cviwrapper"
- download_artifacts "build-servo"
- download_artifacts "build-efuse"
- download_artifacts "build-kos"
# Copy alpine rootfs
- wget http://kscale.ai/milkv/alpine.tar.gz
- mkdir -p device/common/br_overlay/root/
- tar -xvf alpine.tar.gz -C device/common/br_overlay/root/
# Copy artifacts to buildroot overlay
- cp build-cviwrapper_artifacts/kos-zbot/firmware/cviwrapper/libcviwrapper.so device/common/br_overlay/lib/
- cp build-servo_artifacts/kos-zbot/firmware/feetech/libfeetech.so device/common/br_overlay/lib/
- echo "$CI_COMMIT_TAG" > device/common/br_overlay/etc/0OS-version
- cp build-kos_artifacts/kos-zbot/target/riscv64gc-unknown-linux-musl/release/* device/common/br_overlay/usr/local/bin/ || true
- cp build-efuse_artifacts/kos-zbot/firmware/efuse/efuse_read_serial device/common/br_overlay/usr/local/bin/
- bash ./build.sh milkv-duos-sd
- cp $CI_PROJECT_DIR/out/*.img $CI_PROJECT_DIR/
- cd $CI_PROJECT_DIR && tar -cvf milkv-duos-sd-${CI_COMMIT_TAG}.tar *.img && xz -z milkv-duos-sd-${CI_COMMIT_TAG}.tar
- echo "path=$(ls $CI_PROJECT_DIR/*.tar.xz)" >> build.env
- sha256sum *.tar.xz >> milk-v.hash
artifacts:
paths:
- $CI_PROJECT_DIR/*.tar.xz
- $CI_PROJECT_DIR/milk-v.hash
reports:
dotenv: build.env
tags:
- linux-x64