1141cc406Sopenharmony_ci# .gitlab-ci.yml -- to test some source code build scenarios
2141cc406Sopenharmony_ci# Copyright (C) 2016-2020  Olaf Meeuwissen
3141cc406Sopenharmony_ci#
4141cc406Sopenharmony_ci# License: GPL-3.0+
5141cc406Sopenharmony_ci
6141cc406Sopenharmony_civariables:
7141cc406Sopenharmony_ci  REGISTRY_HUB: "registry.gitlab.com/sane-project/ci-envs"
8141cc406Sopenharmony_ci  CONFIGURE_MINI: "--enable-silent-rules"
9141cc406Sopenharmony_ci  CONFIGURE_FULL: "--with-usb --with-usb-record-replay --with-avahi --enable-pnm-backend --with-libcurl --with-poppler-glib"
10141cc406Sopenharmony_ci
11141cc406Sopenharmony_cistages:
12141cc406Sopenharmony_ci  - tarball
13141cc406Sopenharmony_ci  - compile
14141cc406Sopenharmony_ci  - snapshot
15141cc406Sopenharmony_ci  - release
16141cc406Sopenharmony_ci
17141cc406Sopenharmony_ci# This job creates the source tarball that is the *sole* input to our
18141cc406Sopenharmony_ci# compile stage.  The job is meant to be run on the stable release of
19141cc406Sopenharmony_ci# Debian GNU/Linux.
20141cc406Sopenharmony_ci
21141cc406Sopenharmony_cimake-dist:
22141cc406Sopenharmony_ci  image: $REGISTRY_HUB:debian-bullseye-mini
23141cc406Sopenharmony_ci  stage: tarball
24141cc406Sopenharmony_ci  script:
25141cc406Sopenharmony_ci  - git ls-files | xargs ./tools/style-check.sh
26141cc406Sopenharmony_ci  - ./autogen.sh
27141cc406Sopenharmony_ci  - ./tools/create-changelog.sh
28141cc406Sopenharmony_ci  - ./configure
29141cc406Sopenharmony_ci  - make dist
30141cc406Sopenharmony_ci  artifacts:
31141cc406Sopenharmony_ci    paths:
32141cc406Sopenharmony_ci    - sane-backends-*.tar.gz
33141cc406Sopenharmony_ci    expire_in: 1 day
34141cc406Sopenharmony_ci
35141cc406Sopenharmony_ci.compile_template: &compile_definition
36141cc406Sopenharmony_ci  stage: compile
37141cc406Sopenharmony_ci  script:
38141cc406Sopenharmony_ci  - mkdir build
39141cc406Sopenharmony_ci  - cd build
40141cc406Sopenharmony_ci  - tar xzf ../sane-backends-*.tar.gz --strip-components=1
41141cc406Sopenharmony_ci  - ./configure $CONFIGURE_OPTS
42141cc406Sopenharmony_ci  - make -j2 -k $MAKE_FLAGS
43141cc406Sopenharmony_ci
44141cc406Sopenharmony_cidebian-10-full:
45141cc406Sopenharmony_ci  image: $REGISTRY_HUB:debian-buster-full
46141cc406Sopenharmony_ci  variables:
47141cc406Sopenharmony_ci    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
48141cc406Sopenharmony_ci    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
49141cc406Sopenharmony_ci  <<: *compile_definition
50141cc406Sopenharmony_ci
51141cc406Sopenharmony_cidebian-11-mini:
52141cc406Sopenharmony_ci  image: $REGISTRY_HUB:debian-bullseye-mini
53141cc406Sopenharmony_ci  variables:
54141cc406Sopenharmony_ci    CONFIGURE_OPTS: "$CONFIGURE_MINI"
55141cc406Sopenharmony_ci    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
56141cc406Sopenharmony_ci  <<: *compile_definition
57141cc406Sopenharmony_ci
58141cc406Sopenharmony_ci# In addition to the regular compile check, the full Debian stable
59141cc406Sopenharmony_ci# environment is used to keep some of the HTML documentation that's
60141cc406Sopenharmony_ci# available from our website up-to-date.
61141cc406Sopenharmony_ci
62141cc406Sopenharmony_cidebian-11-full:
63141cc406Sopenharmony_ci  image: $REGISTRY_HUB:debian-bullseye-full
64141cc406Sopenharmony_ci  variables:
65141cc406Sopenharmony_ci    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
66141cc406Sopenharmony_ci    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
67141cc406Sopenharmony_ci  <<: *compile_definition
68141cc406Sopenharmony_ci  after_script:
69141cc406Sopenharmony_ci  - make -C build/doc html-pages
70141cc406Sopenharmony_ci  - rm -rf lists && mkdir lists && mv build/doc/*.html lists/
71141cc406Sopenharmony_ci  - cd build/doc && doxygen doxygen-sanei.conf && mv sanei-html ../../doc
72141cc406Sopenharmony_ci  artifacts:
73141cc406Sopenharmony_ci    paths:
74141cc406Sopenharmony_ci    - sane-backends-*.tar.gz
75141cc406Sopenharmony_ci    - lists
76141cc406Sopenharmony_ci    - doc/sanei-html
77141cc406Sopenharmony_ci    expire_in: 1 day
78141cc406Sopenharmony_ci
79141cc406Sopenharmony_cifedora-36-clang:
80141cc406Sopenharmony_ci  image: $REGISTRY_HUB:fedora-36-clang
81141cc406Sopenharmony_ci  variables:
82141cc406Sopenharmony_ci    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
83141cc406Sopenharmony_ci    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
84141cc406Sopenharmony_ci  <<: *compile_definition
85141cc406Sopenharmony_ci
86141cc406Sopenharmony_cialpine-3.15-musl:
87141cc406Sopenharmony_ci  image: $REGISTRY_HUB:alpine-3.15-musl
88141cc406Sopenharmony_ci  variables:
89141cc406Sopenharmony_ci    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
90141cc406Sopenharmony_ci    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
91141cc406Sopenharmony_ci  <<: *compile_definition
92141cc406Sopenharmony_ci  allow_failure: true
93141cc406Sopenharmony_ci
94141cc406Sopenharmony_ciubuntu-22.04-lts:
95141cc406Sopenharmony_ci  image: $REGISTRY_HUB:ubuntu-jammy-dist
96141cc406Sopenharmony_ci  variables:
97141cc406Sopenharmony_ci    CONFIGURE_OPTS: "$CONFIGURE_MINI $CONFIGURE_FULL"
98141cc406Sopenharmony_ci    MAKE_FLAGS: "CFLAGS=-Werror CXXFLAGS=-Werror"
99141cc406Sopenharmony_ci  <<: *compile_definition
100141cc406Sopenharmony_ci
101141cc406Sopenharmony_ci# This snapshot stage job makes sure that the source tarball has all
102141cc406Sopenharmony_ci# it needs to rebuild itself, install everything built and cleans up
103141cc406Sopenharmony_ci# without leaving any droppings behind when uninstalling.  The build
104141cc406Sopenharmony_ci# result will be available as a snapshot for a limited time period.
105141cc406Sopenharmony_ci# People that prefer a source tarball to work with should use this
106141cc406Sopenharmony_ci# snapshot.
107141cc406Sopenharmony_ci# Some HTML documentation derived from this project's source is also
108141cc406Sopenharmony_ci# uploaded for use by our website so it uses the latest information.
109141cc406Sopenharmony_ci# It gets these artifacts from the full compile job on Debian stable,
110141cc406Sopenharmony_ci# hence the dependency.
111141cc406Sopenharmony_ci
112141cc406Sopenharmony_cimake-distcheck:
113141cc406Sopenharmony_ci  image: $REGISTRY_HUB:debian-bullseye-full
114141cc406Sopenharmony_ci  stage: snapshot
115141cc406Sopenharmony_ci  dependencies:
116141cc406Sopenharmony_ci  - debian-11-full
117141cc406Sopenharmony_ci  script:
118141cc406Sopenharmony_ci  - tar xzf sane-backends-*.tar.gz --strip-components=1
119141cc406Sopenharmony_ci  - rm sane-backends-*.tar.gz
120141cc406Sopenharmony_ci  - ./configure
121141cc406Sopenharmony_ci  - make distcheck
122141cc406Sopenharmony_ci  artifacts:
123141cc406Sopenharmony_ci    paths:
124141cc406Sopenharmony_ci    - sane-backends-*.tar.gz
125141cc406Sopenharmony_ci    - lists
126141cc406Sopenharmony_ci    - doc/sanei-html
127141cc406Sopenharmony_ci    expire_in: 90 days
128141cc406Sopenharmony_ci
129141cc406Sopenharmony_ci# For release tags only, this manual job handles putting all of the
130141cc406Sopenharmony_ci# releasables on the Project Releases page.  See the script for more
131141cc406Sopenharmony_ci# details.
132141cc406Sopenharmony_ci
133141cc406Sopenharmony_ciupload:
134141cc406Sopenharmony_ci  image: alpine
135141cc406Sopenharmony_ci  stage: release
136141cc406Sopenharmony_ci  before_script:
137141cc406Sopenharmony_ci    - apk --no-cache add curl git jq
138141cc406Sopenharmony_ci  script:
139141cc406Sopenharmony_ci    - ./tools/create-release.sh
140141cc406Sopenharmony_ci  only:
141141cc406Sopenharmony_ci    - tags
142141cc406Sopenharmony_ci  when: manual
143141cc406Sopenharmony_ci  variables:
144141cc406Sopenharmony_ci    GIT_DEPTH: "3"
145141cc406Sopenharmony_ci  allow_failure: false
146