salsa-ci.yml 5.2 KB
Newer Older
1
variables:
Agustin Henze's avatar
Agustin Henze committed
2 3 4
  DEBFULLNAME: "Salsa Pipeline"
  DEBEMAIL: "<salsa-pipeline@debian.org>"
  DEBIAN_FRONTEND: noninteractive
5
  WORKING_DIR: $CI_PROJECT_DIR/debian/output
6
  RELEASE: 'unstable'
Agustin Henze's avatar
Agustin Henze committed
7 8 9 10 11

stages:
  - build
  - test

12
.artifacts: &artifacts
13
    name: "$CI_JOB_NAME:$CI_COMMIT_REF_NAME"
14 15 16 17 18 19 20 21 22 23 24 25 26
    paths:
        - ${WORKING_DIR}/

.artifacts-long-expire: &artifacts-long-expire
  artifacts:
    expire_in: 180 day
    <<: *artifacts

.artifacts-default-expire: &artifacts-default-expire
  artifacts:
    <<: *artifacts

.build-definition: &build-definition
Agustin Henze's avatar
Agustin Henze committed
27
  stage: build
Agustin Henze's avatar
Agustin Henze committed
28
  image: registry.salsa.debian.org/salsa-ci-team/images/gbp
29 30
  services:
    - docker:dind
31 32 33 34 35 36
  cache:
    paths:
      - ${CCACHE_WORK_DIR}
  variables:
    CCACHE_TMP_DIR: ${CI_PROJECT_DIR}/../.ccache
    CCACHE_WORK_DIR: ${WORKING_DIR}/.ccache
Agustin Henze's avatar
Agustin Henze committed
37
  script:
38 39
    - |
      curl https://prittiau.debian.net/post -X POST --data "{\"project_id\":$CI_PROJECT_ID, \"pipeline_id\":$CI_PIPELINE_ID}" --header "Content-Type: application/json"
40 41
    - mkdir -p ${CCACHE_WORK_DIR}
    - mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
42
    - gbp pull --ignore-branch --pristine-tar --track-missing
43
    - gbp buildpackage --git-ignore-branch --git-export-dir=${WORKING_DIR} --git-builder="docker-build.sh registry.salsa.debian.org/salsa-ci-team/images/dockerbuilder:${RELEASE}"
44
    - mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
45

46
.build-package: &build-package
47 48
  <<: *build-definition
  <<: *artifacts-default-expire
Iñaki Malerba's avatar
Iñaki Malerba committed
49

50
.test-autopkgtest: &test-autopkgtest
Agustin Henze's avatar
Agustin Henze committed
51
  stage: test
52
  image: registry.salsa.debian.org/salsa-ci-team/images/autopkgtest
Agustin Henze's avatar
Agustin Henze committed
53
  script:
54
    - wget --progress=dot:giga https://salsa.debian.org/salsa-ci-team/autopkgtest-lxc/-/jobs/artifacts/master/raw/artifacts/lxc.tar?job=${RELEASE} -O lxc.tar
55 56 57 58 59 60 61 62 63
    - mkdir ${SCI_LXC_PATH} && tar xf lxc.tar -C ${SCI_LXC_PATH}
    - sed -i "s@salsa-ci-team/autopkgtest-lxc@${CI_PROJECT_PATH}@" ${SCI_LXC_PATH}/autopkgtest-${RELEASE}-amd64/config
    - |
        cat >/etc/lxc/lxc.conf <<EOT
        lxc.lxcpath=${SCI_LXC_PATH}
        EOT
    - umount -R /sys/fs/cgroup && mount -a
    - /etc/init.d/lxc-net start
    - /etc/init.d/lxc start
64
    - debci localtest $CI_PROJECT_DIR/debian/output/*.changes --suite ${RELEASE} || [ $? -eq 8 ]
65
  variables:
66
      GIT_STRATEGY: none
67
      SCI_LXC_PATH: ${CI_PROJECT_DIR}/lxc
Agustin Henze's avatar
Agustin Henze committed
68

Sven Hartge's avatar
Sven Hartge committed
69
.test-blhc: &test-blhc
70 71 72
  stage: test
  image: registry.salsa.debian.org/salsa-ci-team/images/blhc
  script:
73
    - blhc --debian --line-numbers --color ${WORKING_DIR}/*.build || [ $? -eq 1 ]
74 75 76
  variables:
      GIT_STRATEGY: none

77
.test-lintian: &test-lintian
Agustin Henze's avatar
Agustin Henze committed
78
  stage: test
79
  image: registry.salsa.debian.org/salsa-ci-team/images/lintian:${RELEASE}
Agustin Henze's avatar
Agustin Henze committed
80
  script:
81 82
    - lintian ${WORKING_DIR}/*.changes | tee lintian.output
    - cat lintian.output | /root/go/bin/lintian2junit > ${WORKING_DIR}/lintian.xml
83
  variables:
84
      GIT_STRATEGY: none
85 86 87
  artifacts:
    reports:
      junit: ${WORKING_DIR}/lintian.xml
Agustin Henze's avatar
Agustin Henze committed
88

89
.test-reprotest: &test-reprotest
Agustin Henze's avatar
Agustin Henze committed
90
  stage: test
Agustin Henze's avatar
Agustin Henze committed
91
  image: registry.salsa.debian.org/salsa-ci-team/images/reprotest
92
  artifacts:
93
    name: "$CI_JOB_NAME:$CI_COMMIT_REF_NAME"
94
    paths:
95
      - $WORKING_DIR
96
    when: always
97 98
  variables:
    REPROTEST_EXTRA_ARGS: '--no-diffoscope'
Agustin Henze's avatar
Agustin Henze committed
99
  script:
Agustin Henze's avatar
Agustin Henze committed
100
    - apt-get update
Agustin Henze's avatar
Agustin Henze committed
101
    - eatmydata apt-get build-dep -y .
102
    - eatmydata reprotest --min-cpus $(nproc --all) --store-dir ${WORKING_DIR}/reprotest ${REPROTEST_EXTRA_ARGS} . -- null |& tee "${WORKING_DIR}/reprotest.log"
Agustin Henze's avatar
Agustin Henze committed
103

104 105 106 107 108
.test-reprotest-diffoscope: &test-reprotest-diffoscope
  <<: *test-reprotest
  variables:
    REPROTEST_EXTRA_ARGS: ''

109
.test-piuparts: &test-piuparts
Agustin Henze's avatar
Agustin Henze committed
110
  stage: test
Agustin Henze's avatar
Agustin Henze committed
111
  image: registry.salsa.debian.org/salsa-ci-team/images/piuparts
Agustin Henze's avatar
Agustin Henze committed
112 113 114
  services:
    - docker:dind
  script:
115
    - CHROOT_PATH="/tmp/debian-chroot"
116
    - CONTAINER_ID=$(docker run --rm -d "registry.salsa.debian.org/salsa-ci-team/images/base:$RELEASE" sleep infinity)
Agustin Henze's avatar
Agustin Henze committed
117 118 119 120
    - docker exec ${CONTAINER_ID} bash -c "apt-get update && apt-get install eatmydata -y"
    - mkdir -p ${CHROOT_PATH}
    - docker export ${CONTAINER_ID} | tar -C ${CHROOT_PATH} -xf -
    - mknod -m 666 ${CHROOT_PATH}/dev/urandom c 1 9
121
    - mkdir -p /srv/local-apt-repository/ && cp -a ${WORKING_DIR}/*.deb /srv/local-apt-repository/ && /usr/lib/local-apt-repository/rebuild
122
    - mkdir -p ${CHROOT_PATH}/etc-target/apt/sources.list.d ${CHROOT_PATH}/etc-target/apt/preferences.d
123 124
    - cp -aTLv /etc/apt/sources.list.d  ${CHROOT_PATH}/etc-target/apt/sources.list.d
    - cp -aTLv /etc/apt/preferences.d  ${CHROOT_PATH}/etc-target/apt/preferences.d
125 126
    - cp -aTLv /srv/local-apt-repository ${CHROOT_PATH}/srv/local-apt-repository
    - cp -aTLv /var/lib/local-apt-repository/ ${CHROOT_PATH}/var/lib/local-apt-repository/
127
    - sed -i '1s/^/127.0.0.1 pipeline.salsa.debian.org localhost\n/' ${CHROOT_PATH}/etc/hosts
128
    - PIUPARTS_DISTRIBUTION_ARG=''
129
    - '[ "$RELEASE" = unstable -o "$RELEASE" = experimental -o "$RELEASE" = testing ] || PIUPARTS_DISTRIBUTION_ARG="--distribution $RELEASE/updates"'
130
    - '[ "${RELEASE/-backports/}" = "$RELEASE" ] || PIUPARTS_DISTRIBUTION_ARG="--distribution $RELEASE"'
131 132
    - |
        for PACKAGE in $(ls ${WORKING_DIR}/*.deb); do
133
            piuparts --scriptsdir /etc/piuparts/scripts --allow-database --warn-on-leftovers-after-purge --hard-link -e ${CHROOT_PATH} ${PIUPARTS_DISTRIBUTION_ARG} ${PACKAGE}
134
        done
135
  variables:
136
      GIT_STRATEGY: none