1# .gitlab-ci.yml -- to test some source code build scenarios
2# Copyright (C) 2016-2020  Olaf Meeuwissen
3#
4# License: GPL-3.0+
5
6variables:
7  REGISTRY_HUB: "registry.gitlab.com/sane-project/ci-envs"
8  CONFIGURE_MINI: "--enable-silent-rules"
9  CONFIGURE_FULL: "--with-usb --with-usb-record-replay --with-avahi --enable-pnm-backend --with-libcurl --with-poppler-glib"
10
11stages:
12  - tarball
13  - compile
14  - snapshot
15  - release
16
17# This job creates the source tarball that is the *sole* input to our
18# compile stage.  The job is meant to be run on the stable release of
19# Debian GNU/Linux.
20
21make-dist:
22  image: $REGISTRY_HUB:debian-bullseye-mini
23  stage: tarball
24  script:
25  - git ls-files | xargs ./tools/style-check.sh
26  - ./autogen.sh
27  - ./tools/create-changelog.sh
28  - ./configure
29  - make dist
30  artifacts:
31    paths:
32    - sane-backends-*.tar.gz
33    expire_in: 1 day
34
35.compile_template: &compile_definition
36  stage: compile
37  script:
38  - mkdir build
39  - cd build
40  - tar xzf ../sane-backends-*.tar.gz --strip-components=1
41  - ./configure $CONFIGURE_OPTS
42  - make -j2 -k $MAKE_FLAGS
43
44debian-10-full:
45  image: $REGISTRY_HUB:debian-buster-full
46  variables:
47    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
48    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
49  <<: *compile_definition
50
51debian-11-mini:
52  image: $REGISTRY_HUB:debian-bullseye-mini
53  variables:
54    CONFIGURE_OPTS: "$CONFIGURE_MINI"
55    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
56  <<: *compile_definition
57
58# In addition to the regular compile check, the full Debian stable
59# environment is used to keep some of the HTML documentation that's
60# available from our website up-to-date.
61
62debian-11-full:
63  image: $REGISTRY_HUB:debian-bullseye-full
64  variables:
65    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
66    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
67  <<: *compile_definition
68  after_script:
69  - make -C build/doc html-pages
70  - rm -rf lists && mkdir lists && mv build/doc/*.html lists/
71  - cd build/doc && doxygen doxygen-sanei.conf && mv sanei-html ../../doc
72  artifacts:
73    paths:
74    - sane-backends-*.tar.gz
75    - lists
76    - doc/sanei-html
77    expire_in: 1 day
78
79fedora-36-clang:
80  image: $REGISTRY_HUB:fedora-36-clang
81  variables:
82    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
83    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
84  <<: *compile_definition
85
86alpine-3.15-musl:
87  image: $REGISTRY_HUB:alpine-3.15-musl
88  variables:
89    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
90    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
91  <<: *compile_definition
92  allow_failure: true
93
94ubuntu-22.04-lts:
95  image: $REGISTRY_HUB:ubuntu-jammy-dist
96  variables:
97    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
98    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
99  <<: *compile_definition
100
101# This snapshot stage job makes sure that the source tarball has all
102# it needs to rebuild itself, install everything built and cleans up
103# without leaving any droppings behind when uninstalling.  The build
104# result will be available as a snapshot for a limited time period.
105# People that prefer a source tarball to work with should use this
106# snapshot.
107# Some HTML documentation derived from this project's source is also
108# uploaded for use by our website so it uses the latest information.
109# It gets these artifacts from the full compile job on Debian stable,
110# hence the dependency.
111
112make-distcheck:
113  image: $REGISTRY_HUB:debian-bullseye-full
114  stage: snapshot
115  dependencies:
116  - debian-11-full
117  script:
118  - tar xzf sane-backends-*.tar.gz --strip-components=1
119  - rm sane-backends-*.tar.gz
120  - ./configure
121  - make distcheck
122  artifacts:
123    paths:
124    - sane-backends-*.tar.gz
125    - lists
126    - doc/sanei-html
127    expire_in: 90 days
128
129# For release tags only, this manual job handles putting all of the
130# releasables on the Project Releases page.  See the script for more
131# details.
132
133upload:
134  image: alpine
135  stage: release
136  before_script:
137    - apk --no-cache add curl git jq
138  script:
139    - ./tools/create-release.sh
140  only:
141    - tags
142  when: manual
143  variables:
144    GIT_DEPTH: "3"
145  allow_failure: false
146