-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy path.gitlab-ci.yml
129 lines (117 loc) · 3.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
stages:
- generate_version
- build
- deploy
generate_version:
stage: generate_version
image: alpine
tags:
- build
- amd64
variables:
GIT_SUBMODULE_STRATEGY: none
artifacts:
reports:
dotenv: version.env
script:
- VERSION=${CI_COMMIT_TAG:-""}
- VERSION=${VERSION//"-"/"_"} # replace dashes with underscores in the version
- VERSION=${VERSION:-g${CI_COMMIT_SHORT_SHA}}
- echo "VERSION=$VERSION" > version.env
- cat version.env
.build_linux_template:
stage: build
image: $CI_DOCKER_REGISTRY/qemu-build:6
tags:
- build
- amd64
variables:
# Don't use parallel:matrix here,
# becuase needs:project doesn't support it
# https://docs.gitlab.com/ee/ci/yaml/#needsproject
PLATFORM: x86_64-linux-gnu
TARGET: "" # to be set in the job
artifacts:
paths:
- dist/qemu-*.tar.xz
- dist/archive_name_*
expire_in: 1 week
script:
- ./.github/workflows/scripts/configure-native.sh
- ninja -C build install
- find ./install/qemu/share/qemu -maxdepth 1 -mindepth 1 -not -name 'esp*.bin' -exec rm -rfv {} \;
- DIST_DIR=${PWD}/dist
- mkdir -p ${DIST_DIR}
- cd ./install
- export ARCHIVE_NAME=qemu-${TARGET}-${VERSION}-${PLATFORM}.tar.xz
- tar cJvf ${DIST_DIR}/${ARCHIVE_NAME} qemu
- echo $ARCHIVE_NAME >${DIST_DIR}/archive_name_${TARGET}_${PLATFORM}
# these build jobs names are used in needs:project in idf/qemu-tests
# don't rename it without updating the needs:project in idf/qemu-tests
build_linux_xtensa_softmmu:
extends: .build_linux_template
variables:
TARGET: xtensa-softmmu
build_linux_riscv32_softmmu:
extends: .build_linux_template
variables:
TARGET: riscv32-softmmu
build_linux_riscv32_user:
extends: .build_linux_template
variables:
TARGET: riscv32-linux-user
upload_to_http:
image: espressif/scp
stage: deploy
tags:
- deploy
- shiny
when: manual
allow_failure: true
variables:
# don't use "GIT_STRATEGY: none", because we need cleaning old artifacts in 'dist/' that came from previous pipelines
SSH_KEY: "$HTTP_UPLOAD_KEY" # used inside 'espressif/scp'
script:
# List of archives in dist/
- DIST_FILE_LIST=$(find dist -name archive_name_\* -exec cat {} \+ | xargs -n1 | sort -u | xargs)
- cd dist
# Create a checksum file
- export RELEASE_CHECKSUM_FILE="qemu-${VERSION}-checksum.sha256"
- |
for n in $DIST_FILE_LIST; do
sz=$(stat -c%s "${n}");
printf "# %s: %s bytes\n" "${n}" "${sz}" >> ${RELEASE_CHECKSUM_FILE};
sha256sum -b "${n}" >> ${RELEASE_CHECKSUM_FILE};
done
- DIST_FILE_LIST="${DIST_FILE_LIST} ${RELEASE_CHECKSUM_FILE}"
- scp ${DIST_FILE_LIST} ${HTTP_UPLOAD_DIR}
# Show info
- /bin/ls -l ${DIST_FILE_LIST}
- sha256sum ${DIST_FILE_LIST}
- cat "${RELEASE_CHECKSUM_FILE}"
- echo -e "\nArchives were published there:\n\n$(for n in ${DIST_FILE_LIST}; do echo "${HTTP_PUBLIC_DIR}/${n}"; done)\n"
.update_idf_tools:
allow_failure: true
variables:
TOOL_NAME: "qemu"
TOOL_MEMBERS: "qemu-riscv32 qemu-xtensa"
TOOL_VERSION: ${VERSION}
trigger:
project: idf/idf-tools-updater
strategy: depend
internal_update_idf_tools:
extends: .update_idf_tools
stage: deploy
needs: [ generate_version, upload_to_http ]
when: manual
variables:
TOOL_SHA256_URL: ${HTTP_PUBLIC_DIR}/qemu-${VERSION}-checksum.sha256
github_update_idf_tools:
extends: .update_idf_tools
stage: deploy
needs: [ generate_version ]
rules:
- if: $CI_COMMIT_TAG
when: manual
variables:
TOOL_SHA256_URL: ${GH_REPO_URL}/releases/download/${CI_COMMIT_TAG}/qemu-${VERSION}-checksum.sha256