-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
102 lines (89 loc) · 2.65 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
stages:
- containers
- builds
- sanity_checks
.git_build_vars: &git_build_vars |
export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
export SCRATCH_DIR="$PWD/scratch"
export VROOT="$SCRATCH_DIR/vroot"
export LIBDIR="$VROOT/lib"
export LD_LIBRARY_PATH="$LIBDIR"
export PATH="$VROOT/bin:$PATH"
export PKG_CONFIG_PATH="$LIBDIR/pkgconfig"
.native_git_build_job:
extends:
- .gitlab_native_build_job
script:
- *git_build_vars
- pushd "$PWD"
- mkdir -p "$SCRATCH_DIR"
- cd "$SCRATCH_DIR"
- git clone --depth 1 https://gitlab.com/libvirt/libvirt.git
- cd libvirt
- meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR"
- ninja -C build install
- popd
- go build
- go test
- go test -tags libvirt_without_qemu
- go test -tags libvirt_without_lxc
.native_build_job:
extends:
- .gitlab_native_build_job
script:
- go build -x
- go test
- go build -x -tags libvirt_without_qemu
- go test -tags libvirt_without_qemu
- go build -x -tags libvirt_without_lxc
- go test -tags libvirt_without_lxc
include: '/ci/gitlab.yml'
api_coverage_job:
extends:
- .gitlab_native_build_job
stage: sanity_checks
script:
- *git_build_vars
- go test -tags api
allow_failure: true
needs:
- job: x86_64-almalinux-9-git
artifacts: true
variables:
NAME: almalinux-9
TARGET_BASE_IMAGE: docker.io/library/almalinux:9
.go_build: &go_build
stage: builds
script:
- go build -v -tags libvirt_dlopen
- go build -v -tags "libvirt_dlopen libvirt_without_qemu"
- go build -v -tags "libvirt_dlopen libvirt_without_lxc"
- apt-get update
- apt-get install -y libvirt0
- go test -timeout 10m -v -tags libvirt_dlopen
- go test -timeout 10m -v -tags "libvirt_dlopen libvirt_without_qemu"
- go test -timeout 10m -v -tags "libvirt_dlopen libvirt_without_lxc"
rules:
# upstream: pushes to a branch
- if: '$CI_PROJECT_NAMESPACE == $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push"'
when: on_success
# forks: pushes to a branch
- if: '$CI_PROJECT_NAMESPACE != $RUN_UPSTREAM_NAMESPACE && $CI_PIPELINE_SOURCE == "push" && $RUN_PIPELINE'
when: on_success
# upstream+forks: other web/api/scheduled pipelines
- if: '$CI_PIPELINE_SOURCE =~ /(web|api|schedule|merge_request_event)/'
when: on_success
# upstream+forks: that's all folks
- when: never
# first version declared in go.mod
go_1_11:
<<: *go_build
image: golang:1.11
# very fussy about +go:build tags having a blank line
go_1_16:
<<: *go_build
image: golang:1.16
# a quite new version
go_1_20:
<<: *go_build
image: golang:1.20