summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 8fb7766a5e52350dc1b10ea91a00ae57ffd71b3a (plain)
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
129
130
131
132
default:
  image: debian:unstable

variables:
  GIT_DEPTH: 0

stages:
  - deploy
  - bootstrap
  - build
  - upload
  - release

pre-commit:
  stage: .pre
  variables:
    XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
  before_script:
    - apt -qq update
    - apt -y -qq install git pre-commit
  script:
    - pre-commit run -a
  cache:
    key: $CI_JOB_NAME
    paths:
      - .cache/pre-commit

pages:
  stage: deploy
  script:
    - rm -rf public
    - cp -a web public
    - sed -i "s/@DATE@/$(date -I)/" public/*.html
  artifacts:
    paths:
      - public
    expire_in: 30 days
  rules:
    - if: $CI_COMMIT_BRANCH == "main"

bootstrap:
  stage: bootstrap
  before_script:
    - apt -qq update
    - apt -y -qq install autoconf automake autopoint gettext git libtool pkg-config wget
  script:
    - if test -d gnulib-src; then git -C gnulib-src pull; else git clone git://git.sv.gnu.org/gnulib gnulib-src; fi
    - rm -rf bootstrapped
    - mkdir bootstrapped
    - tar -cf - --exclude=bootstrapped . | tar -C bootstrapped -xf -
    - (cd bootstrapped && GNULIB_URL=../gnulib-src ./bootstrap --copy)
  cache:
    paths:
      - gnulib-src/
  artifacts:
    paths:
      - bootstrapped/

build-distcheck:
  stage: build
  before_script:
    - apt -qq update
    - apt -y -qq install build-essential bsdextrautils flex git groff libgdbm-dev libpipeline-dev pkg-config po4a zlib1g-dev
  script:
    - (cd bootstrapped && ./configure --enable-maintainer-mode)
    - make -C bootstrapped distcheck V=1 VERBOSE=1
  artifacts:
    paths:
      - "bootstrapped/*.tar.xz"

build-out-of-tree:
  stage: build
  before_script:
    - apt -qq update
    - apt -y -qq install build-essential bsdextrautils flex groff libgdbm-dev libpipeline-dev pkg-config po4a zlib1g-dev
  script:
    - mkdir -p bootstrapped/obj
    - (cd bootstrapped/obj && ../configure)
    - make -C bootstrapped/obj check V=1 VERBOSE=1

build-berkeley-db:
  stage: build
  before_script:
    - apt -qq update
    - apt -y -qq install build-essential bsdextrautils flex git groff libdb-dev libpipeline-dev pkg-config po4a zlib1g-dev
  script:
    - (cd bootstrapped && ./configure --with-db=db)
    - make -C bootstrapped check V=1 VERBOSE=1

build-ndbm:
  stage: build
  before_script:
    - apt -qq update
    # libgdbm-dev is needed here due to https://bugs.debian.org/1021123.
    - apt -y -qq install build-essential bsdextrautils flex git groff libgdbm-compat-dev libgdbm-dev libpipeline-dev pkg-config po4a zlib1g-dev
  script:
    - (cd bootstrapped && ./configure --with-db=ndbm)
    - make -C bootstrapped check V=1 VERBOSE=1

upload:
  stage: upload
  image: curlimages/curl:latest
  rules:
    - if: $CI_COMMIT_TAG
  script:
    - |
      curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "bootstrapped/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.xz" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.xz"

release:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  rules:
    - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /-pre/
  # Prepare description.  The maintainer will need to download the tarball,
  # sign it, and reupload the tarball and its signature to Savannah.
  script:
    - |
      echo "Releasing ${CI_PROJECT_NAME} ${CI_COMMIT_TAG}."
      (echo "Changes"
       echo "-------"
       echo
       echo "$(tail -n+4 bootstrapped/NEWS.md | sed "/^${CI_PROJECT_NAME} /,\$d")"
       echo
       echo "Download (GPG key 0x393587D97D86500B)"
       echo "-------------------------------------"
       echo
       echo " * https://download.savannah.nongnu.org/releases/${CI_PROJECT_NAME}/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.xz"
       printf %s " * https://download.savannah.nongnu.org/releases/${CI_PROJECT_NAME}/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.xz.asc"
       ) >description.md
  release:
    tag_name: $CI_COMMIT_TAG
    description: './description.md'