-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
128 lines (117 loc) · 3.61 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
stages:
- containers
- builds
- sanity_checks
.multilib: &multilib |
dpkg_architecture=$(which dpkg-architecture 2>/dev/null || true)
rpm=$(which rpm 2>/dev/null || true)
if test -x "$dpkg_architecture"; then
multilib=$(dpkg-architecture -q DEB_TARGET_MULTIARCH);
elif test -x "$rpm"; then
multilib=$(rpm --eval '%{_lib}');
fi
.native-environment: &native-environment |
export VIRT_PREFIX="$HOME/build/libvirt"
export PATH="$VIRT_PREFIX/bin:$PATH"
export C_INCLUDE_PATH="$VIRT_PREFIX/include"
export LD_LIBRARY_PATH="$VIRT_PREFIX/$multilib"
export PKG_CONFIG_PATH="$VIRT_PREFIX/$multilib/pkgconfig"
export XDG_DATA_DIRS="$VIRT_PREFIX/share:/usr/share:/usr/local/share"
export GI_TYPELIB_PATH="$VIRT_PREFIX/$multilib/girepository-1.0"
export OSINFO_SYSTEM_DIR="$VIRT_PREFIX/share/osinfo"
export MAKEFLAGS="-j $(getconf _NPROCESSORS_ONLN)"
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="$CCACHE_BASEDIR/ccache"
export CCACHE_MAXSIZE="50M"
export PATH="$CCACHE_WRAPPERSDIR:$PATH"
.native_build_job:
extends:
- .gitlab_native_build_job
cache:
paths:
- ccache
key: "$CI_JOB_NAME"
script:
- *multilib
- *native-environment
- HERE=$PWD
- cd /tmp
- git clone https://gitlab.com/libosinfo/osinfo-db-tools.git
- cd osinfo-db-tools
- mkdir build
- cd build
- meson .. . --prefix=$VIRT_PREFIX
- $NINJA install
- cd $HERE
- mkdir build
- cd build
- $MAKE -f ../Makefile VPATH=..
- $MAKE -f ../Makefile VPATH=.. install OSINFO_DB_TARGET="--system"
- $MAKE -f ../Makefile VPATH=.. check
- if test -x /usr/bin/rpmbuild && test "$RPM" != "skip";
then
rpmbuild --nodeps --define "_without_mingw 1" --define "_sourcedir $PWD" -ba osinfo-db.spec;
fi
urlcheck:
image: python:latest
stage: sanity_checks
needs: []
before_script:
- apt-get update
- apt-get -y install gettext
- pip install pytest-xdist lxml requests
script:
- make -j$(nproc) data
# Overcommit 'nproc' because much of the time we'll
# be waiting on network I/O, and not CPU bound
- pytest -v -n $(expr $(nproc) '*' 4) tests/test_urls.py
rules:
- if: '$OSINFO_CI_CHECK_URLS'
when: on_success
- when: never
# Going against our usual naming convention for jobs using prebuilt containers
# here as we'll be consuming the job artifacts via a direct URL which includes
# the GitLab job name, so let's go with a more convenient name
publish:
extends:
- .gitlab_native_build_job
needs:
- job: x86_64-debian-12-container
optional: true
script:
- apt update && apt install -y osinfo-db-tools
- make V=1 ARCHIVE=osinfo-db-latest.tar.xz
artifacts:
expire_in: 1 day
paths:
- osinfo-db-latest.tar.xz
variables:
TARGET_BASE_IMAGE: docker.io/library/debian:12-slim
NAME: debian-12
.web:
image: docker.io/library/python:3.9-alpine
stage: builds
before_script:
- apk add git gpg gpg-agent
script:
- ./scripts/osinfo-db-web.py
artifacts:
paths:
- public/
# This job creates artifacts which can be browsed without making live
web:
extends: .web
rules:
# Only run if it is a merge request, or a forced pipeline
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $RUN_PIPELINE == "1"'
when: on_success
- when: never
# This job creates artifacts and publishes them to the live site
pages:
extends: .web
rules:
# We can publish the website from pushes to the main branch only
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
when: on_success
- when: never
include: '/ci/gitlab.yml'