summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 884b5efab882d7aa37b9ceaf5a942590e07068eb (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
default:
  image: debian:unstable

variables:
  GIT_DEPTH: 0

stages:
  - 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

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)
  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

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'