-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
59 lines (54 loc) · 1.99 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
59 lines (54 loc) · 1.99 KB
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
# Use a GCC-Cmake image, based on Debian distro.
image: rikorose/gcc-cmake
stages:
- build
- upload
- release
variables:
GIT_SUBMODULE_STRATEGY: recursive
PACKAGE_VERSION: "${CI_COMMIT_TAG}"
PROJECT_NAME: "yanpit"
LINUX_X86_64_BINARY: "${PROJECT_NAME}-x86_64"
BASE_PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages"
PACKAGE_REGISTRY_URL: "${BASE_PACKAGE_REGISTRY_URL}/generic/${PROJECT_NAME}/${PACKAGE_VERSION}"
PACKAGE_REGISTRY_URL_LATEST: "${BASE_PACKAGE_REGISTRY_URL}/generic/${PROJECT_NAME}/latest"
Build (x86_64):
stage: build
rules:
- if: $CI_COMMIT_TAG
before_script:
- HOMEPWD=$(pwd)
- apt update && apt -y install libnl-3-dev libnl-genl-3-dev libprotobuf-dev protobuf-compiler
script:
- cd $HOMEPWD
- echo -e "Preparing to build all targets for x86_64 architecture."
- mkdir -p build/x86_64
- cd build/x86_64
- cmake ../..
- echo -e "Building yanp-it..."
- make yanpit
- echo -e "All targets were successfully compiled to x86_64."
- cd $HOMEPWD
artifacts:
paths:
- build/x86_64
Upload files into Packages:
stage: upload
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file build/x86_64/cmd/yanpit/yanpit ${PACKAGE_REGISTRY_URL}/${LINUX_X86_64_BINARY}
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file build/x86_64/cmd/yanpit/yanpit ${PACKAGE_REGISTRY_URL_LATEST}/${LINUX_X86_64_BINARY}
Release files into Packages:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "Processing to the release job..."
- |
release-cli create --name "Release $CI_COMMIT_TAG" --description "Release files and assets for the version ${CI_COMMIT_TAG}" \
--tag-name "$CI_COMMIT_TAG" --ref "$CI_COMMIT_TAG" \
--assets-link "{\"name\":\"${LINUX_X86_64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_X86_64_BINARY}\"}"