# #
########################################
-.templates_sha: &template_sha d32ac1f30faad4fdef24af8a7724fb8c084c3dda # see https://docs.gitlab.com/ee/ci/yaml/#includefile
+.templates_sha: &template_sha ca99d9418390fb5faaa7f2407b94c733d7ec6a37 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
include:
# Alpine container builder template
stage: prep
before_script:
- apk add python3 git
- - pip3 install --user jinja2 PyYAML
+ - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script:
- - python3 ./.gitlab-ci/generate-gitlab-ci.py
+ - ci-fairy generate-template
- git diff --exit-code && exit 0 || true
- echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- exit 1
stage: container_clean
image: golang:alpine
before_script:
- - apk add python3
- - pip3 install --user python-gitlab
+ - apk add python3 git
+ - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
script:
- - LATEST_TAG=$(echo $DISTRO_CONTAINER_IMAGE | cut -f2 -d:)
# Go to your Profile, Settings, Access Tokens
# Create a personal token with 'api' scope, copy the value.
# Go to Settings, CI/CD, Variables
# Define a variable of type File named AUTHFILE. Content is that token
# value.
- - python3 .gitlab-ci/gitlab-container-delete $CI_SERVER_URL $CI_PROJECT_PATH
+ - ci-fairy -v --authfile $AUTHFILE delete-image
--repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
- --authfile $AUTHFILE --exclude-tag "$LATEST_TAG"
+ --exclude-tag $FDO_DISTRIBUTION_TAG
dependencies: []
allow_failure: true
only:
--- /dev/null
+{# You're looking at the template here, so you can ignore the below
+ warning. This is the right file to edit #}
+########################################
+# #
+# THIS FILE IS GENERATED, DO NOT EDIT #
+# #
+########################################
+
+.templates_sha: &template_sha ca99d9418390fb5faaa7f2407b94c733d7ec6a37 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
+
+include:
+ {% for distribution in distributions|map(attribute='name')|unique()|sort() %}
+ # {{ distribution.capitalize() }} container builder template
+ - project: 'freedesktop/ci-templates'
+ ref: *template_sha
+ file: '/templates/{{distribution}}.yml'
+ {% endfor %}
+
+stages:
+ - prep # rebuild the container images if there is a change
+ - build # for actually building and testing things in a container
+ - VM # for running the test suite in a VM
+ - autotools # distribution builds with autotools
+ - meson # distribution builds with meson
+ - tarballs # tarball builds
+ - container_clean # clean up unused container images
+
+variables:
+ # The upstrem repository we will check for images
+ FDO_UPSTREAM_REPO: libevdev/libevdev
+ LIBEVDEV_SKIP_ROOT_TESTS: 1
+ GIT_DEPTH: 1
+ MESON_BUILDDIR: 'build dir'
+
+.default_artifacts:
+ artifacts:
+ paths:
+ - _build/test/test-suite.log
+ - $MESON_BUILDDIR/meson-logs/
+ expire_in: 1 week
+ when: on_failure
+ reports:
+ junit: $MESON_BUILDDIR/junit-*.xml
+
+.autotools_build:
+ extends:
+ - .default_artifacts
+ script:
+ - mkdir _build
+ - pushd _build > /dev/null
+ - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
+ - make
+ - make check
+ - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
+ - popd > /dev/null
+
+.meson_build:
+ extends:
+ - .default_artifacts
+ script:
+ - .gitlab-ci/meson-build.sh
+
+{# Generate templates for every distribution/version combination we want, any
+ job can then just extends: .name:version and the images will sort
+ themselves out. #}
+{% for distro in distributions %}
+{% for version in distro.versions %}
+.{{distro.name}}:{{version}}:
+ extends: .fdo.distribution-image@{{distro.name}}
+ variables:
+ FDO_DISTRIBUTION_TAG: '{{distro.tag}}'
+ FDO_DISTRIBUTION_VERSION: '{{version}}'
+
+{% endfor %}
+{% endfor %}
+
+
+#################################################################
+# #
+# prep stage #
+# #
+#################################################################
+
+# Re-generate the CI script and make sure it's the one currently checked in
+# If this job fails, re-generate the gitlab-ci.yml script, see
+# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
+#
+check-ci-script:
+ image: golang:alpine
+ stage: prep
+ before_script:
+ - apk add python3 git
+ - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
+ script:
+ - ci-fairy generate-template
+ - git diff --exit-code && exit 0 || true
+ - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
+ - exit 1
+
+check-commit:
+ image: golang:alpine
+ stage: prep
+ before_script:
+ - apk add python3 git
+ script:
+ - pip3 install GitPython
+ - pip3 install pytest
+ - |
+ pytest --junitxml=results.xml \
+ --tb=line \
+ --assert=plain \
+ ./.gitlab-ci/check-commit.py
+ except:
+ - master@libevdev/libevdev
+ variables:
+ GIT_DEPTH: 100
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - results.xml
+ reports:
+ junit: results.xml
+
+{% for distro in distributions %}
+.{{ distro.name }}.packages:
+ variables:
+ FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}'
+
+{% endfor %}
+
+{% for distro in distributions %}
+{% if distro.want_qemu %}
+{% for version in distro.versions %}
+# Pulls in the qemu container from upstream or rebuilds it if missing
+.{{ distro.name }}:{{ version }}@qemu-prep:
+ extends:
+ - .{{ distro.name }}:{{ version }}
+ - .{{ distro.name}}.packages
+ - .fdo.qemu-build@fedora
+ stage: prep
+ tags:
+ - kvm
+ variables:
+ GIT_STRATEGY: none
+ FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }}
+ allow_failure: true
+
+# Always rebuilds the container
+.{{ distro.name }}:{{ version }}@qemu-forced-rebuild:
+ extends:
+ - .{{ distro.name }}:{{ version }}@qemu-prep
+ variables:
+ FDO_FORCE_REBUILD: 1
+ only:
+ - schedules
+
+{% endfor %}
+{% endif %}
+{% endfor %}
+
+# This is the actual job
+fedora:31@qemu-prep:
+ extends: .fedora:31@qemu-prep
+
+fedora:31@qemu-forced-rebuild:
+ extends: .fedora:31@qemu-forced-rebuild
+
+{% for distro in distributions %}
+{% for version in distro.versions %}
+
+# Pulls in the container from upstream or rebuilds it if missing
+{{ distro.name }}:{{ version }}@container-prep:
+ extends:
+ - .{{ distro.name }}:{{ version }}
+ - .{{ distro.name}}.packages
+ - .fdo.container-build@{{ distro.name }}
+ stage: prep
+ variables:
+ GIT_STRATEGY: none
+
+# Always rebuilds the container
+{{ distro.name }}:{{ version }}@container-forced-rebuild:
+ extends:
+ - {{ distro.name }}:{{ version }}@container-prep
+ only:
+ - schedules
+ variables:
+ FDO_FORCE_REBUILD: 1
+
+{% endfor %}
+{% endfor %}
+
+#################################################################
+# #
+# container clean stage #
+# run during the clean stage #
+# #
+#################################################################
+
+#
+# This stage will look for the container images we currently have in
+# the registry and will remove any that are not tagged with the provided
+# $container_image:$tag
+.container-clean:
+ stage: container_clean
+ image: golang:alpine
+ before_script:
+ - apk add python3 git
+ - pip3 install git+http://gitlab.freedesktop.org/freedesktop/ci-templates
+ script:
+ # Go to your Profile, Settings, Access Tokens
+ # Create a personal token with 'api' scope, copy the value.
+ # Go to Settings, CI/CD, Variables
+ # Define a variable of type File named AUTHFILE. Content is that token
+ # value.
+ - ci-fairy -v --authfile $AUTHFILE delete-image
+ --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
+ --exclude-tag $FDO_DISTRIBUTION_TAG
+ dependencies: []
+ allow_failure: true
+ only:
+ - schedules
+
+{% for distro in distributions %}
+{% for version in distro.versions %}
+### {{ distro.name }} {{ version }}
+{{ distro.name }}:{{ version }}@container-clean:
+ extends:
+ - .{{ distro.name }}:{{ version }}
+ - .container-clean
+ needs: ["{{distro.name}}:{{version}}@container-prep"]
+
+{% endfor %}
+{% endfor %}
+
+#################################################################
+# #
+# build stage #
+# #
+#################################################################
+
+.autotools-build@template:
+ extends:
+ - .autotools_build
+ stage: build
+ dependencies: []
+ variables:
+ MAKE_ARGS: "distcheck"
+
+.meson-build@template:
+ extends:
+ - .meson_build
+ stage: build
+ dependencies: []
+ variables:
+ NINJA_ARGS: "dist"
+
+{% for distro in distributions %}
+{% for version in distro.versions %}
+
+{{ distro.name }}:{{ version }}@autotools-build:
+ extends:
+ - .{{ distro.name }}:{{ version }}
+ - .autotools-build@template
+ stage: autotools
+ {# Where we have extra_variables defined, add them to the list #}
+ {% if distro.build is defined and distro.build.extra_variables is defined %}
+ variables:
+ {% for key, value in distro.build.extra_variables.items() %}
+ {{ key }}: {{ value }}
+ {% endfor %}
+ {% endif %}
+ needs: ['{{ distro.name }}:{{ version }}@container-prep']
+
+{% if not distro.build is defined or distro.build.meson|default(True) %}
+{{ distro.name }}:{{ version }}@meson-build:
+ extends:
+ - .{{ distro.name }}:{{ version }}
+ - .meson-build@template
+ stage: meson
+ {# Where we have extra_variables defined, add them to the list #}
+ {% if distro.build is defined and distro.build.extra_variables is defined %}
+ variables:
+ {% for key, value in distro.build.extra_variables.items() %}
+ {{ key }}: {{ value }}
+ {% endfor %}
+ {% endif %}
+ needs: ['{{ distro.name }}:{{ version }}@container-prep']
+{% endif %}
+
+{% endfor %}
+{% endfor %}
+
+# Build argument tests
+#
+# We only run the build option combinations on one image
+# because they're supposed to fail equally on all
+.fedora-custom-build@autotools-template:
+ extends:
+ - .fedora:31
+ - .autotools-build@template
+ stage: build
+ needs: ['fedora:31@container-prep']
+
+no-valgrind:autotools:
+ extends: .fedora-custom-build@autotools-template
+ before_script:
+ - dnf remove -y valgrind
+
+no-check:autotools:
+ extends: .fedora-custom-build@autotools-template
+ before_script:
+ - dnf remove -y check check-devel
+
+no-doxygen:autotools:
+ extends: .fedora-custom-build@autotools-template
+ before_script:
+ - dnf remove -y doxygen
+ variables:
+ MAKE_ARGS: '' # disable distcheck, requires doxygen
+
+# doxygen is required for distcheck
+no-doxygen-check-valgrind:autotools:
+ extends: .fedora-custom-build@autotools-template
+ before_script:
+ - dnf remove -y doxygen valgrind check check-devel
+ variables:
+ MAKE_ARGS: '' # disable distcheck, requires doxygen
+
+no-nm:autotools:
+ extends: .fedora-custom-build@autotools-template
+ before_script:
+ - mv /usr/bin/nm /usr/bin/nm.moved
+
+enable-gcov:autotools:
+ extends: .fedora-custom-build@autotools-template
+ variables:
+ CONFIGURE_FLAGS: "--enable-gcov"
+
+.fedora-custom-build@meson-template:
+ extends:
+ - .fedora:31
+ - .meson-build@template
+ stage: build
+ needs: ['fedora:31@container-prep']
+
+no-valgrind:meson:
+ extends: .fedora-custom-build@meson-template
+ before_script:
+ - dnf remove -y valgrind
+
+no-check:meson:
+ extends: .fedora-custom-build@meson-template
+ before_script:
+ - dnf remove -y check check-devel
+ variables:
+ MESON_ARGS: -Dtests=disabled
+ SKIP_MESON_TEST: 1
+
+# doxygen is required for dist
+no-doxygen:meson:
+ extends: .fedora-custom-build@meson-template
+ before_script:
+ - dnf remove -y doxygen
+ variables:
+ MESON_ARGS: -Ddocumentation=disabled
+ NINJA_ARGS: ''
+
+# doxygen is required for dist
+no-doxygen-check-valgrind:meson:
+ extends: .fedora-custom-build@meson-template
+ before_script:
+ - dnf remove -y doxygen valgrind check check-devel
+ variables:
+ MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
+ NINJA_ARGS: ''
+ SKIP_MESON_TEST: 1
+
+enable-gcov:meson:
+ extends: .fedora-custom-build@meson-template
+ variables:
+ MESON_ARGS: '-Dcoverity=true'
+
+scan-build:meson:
+ extends: .fedora-custom-build@meson-template
+ variables:
+ NINJA_ARGS: 'scan-build'
+ SKIP_MESON_TEST: 1
+
+static-build:meson:
+ extends: .fedora-custom-build@meson-template
+ script:
+ - meson "$MESON_BUILDDIR" --default-library=static --prefix=$PWD/prefix-meson/
+ - ninja -C "$MESON_BUILDDIR" install
+ - ls -l $PWD/prefix-meson/lib64/libevdev.a
+
+soname:
+ extends:
+ - .fedora:31
+ stage: build
+ script:
+ - ./autogen.sh --prefix=$PWD/prefix-autotools/
+ - make install
+ - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
+ - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
+ - ninja -C "$MESON_BUILDDIR" install
+ - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
+ needs: ['fedora:31@container-prep']
+
+#################################################################
+# #
+# VM stage #
+# #
+#################################################################
+
+.check_tainted: &check_tainted |
+ # make sure the kernel is not tainted
+ if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
+ then
+ echo tainted kernel ;
+ exit 1 ;
+ fi
+
+.qemu@fedora:31:
+ extends:
+ - .fedora:31
+ stage: VM
+ image: $CI_REGISTRY_IMAGE/$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
+ tags:
+ - kvm
+ variables:
+ MESON_BUILDDIR: build_dir
+ script:
+ # start our vm, no args required
+ - /app/start_vm.sh
+
+ - *check_tainted
+
+ - "scp -P 5555 -r $PWD localhost:"
+ - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
+ - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
+ - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
+ - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
+ - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
+ - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
+ - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
+ # no matter the results of the tests, we want to fetch the logs
+ - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
+
+ - *check_tainted
+
+ - ssh localhost -p 5555 halt || true
+ - sleep 2
+ - pkill qemu || true
+
+ - if [[ ! -e .success ]] ;
+ then
+ exit 1 ;
+ fi
+ artifacts:
+ name: "qemu-meson-logs-$CI_JOB_NAME"
+ when: always
+ expire_in: 1 week
+ paths:
+ - $MESON_BUILDDIR/meson-logs
+ - console.out
+ reports:
+ junit: $MESON_BUILDDIR/junit-*.xml
+
+ retry:
+ max: 2
+ when: script_failure
+ needs: ['fedora:31@qemu-prep']
+
+qemu:meson:
+ extends: .qemu@fedora:31
+
+qemu:meson:valgrind:
+ extends: .qemu@fedora:31
+ variables:
+ MESON_TEST_ARGS: '--setup=valgrind'
+
+meson-from-tarball:
+ extends:
+ - .fedora:31
+ stage: tarballs
+ script:
+ - export INSTALLDIR="$PWD/_inst"
+ - mkdir _build
+ - pushd _build > /dev/null
+ - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
+ - make
+ - make distcheck
+ - popd > /dev/null
+ - mkdir -p _tarball_dir
+ - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
+ - pushd _tarball_dir/libevdev-*/ > /dev/null
+ - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
+ - ninja -C "$MESON_BUILDDIR" test
+ - ninja -C "$MESON_BUILDDIR" install
+ - popd > /dev/null
+ - ls -lR $INSTALLDIR
+ needs: ['fedora:31@container-prep']
+
+autotools-from-tarball:
+ extends:
+ - .fedora:31
+ stage: tarballs
+ script:
+ - export INSTALLDIR="$PWD/_inst"
+ - meson "$MESON_BUILDDIR"
+ - ninja -C "$MESON_BUILDDIR" dist
+ - mkdir -p _tarball_dir
+ - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
+ - pushd _tarball_dir/libevdev-*/ > /dev/null
+ - mkdir _build
+ - pushd _build > /dev/null
+ - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
+ - make
+ - make install
+ - make distcheck
+ - popd > /dev/null
+ - popd > /dev/null
+ - ls -lR $INSTALLDIR
+ needs: ['fedora:31@container-prep']
--- /dev/null
+# This file contains the configuration for the gitlab ci.
+# See the .gitlab-ci/generate-gitlab-ci.py file for more info
+#
+
+# We're happy to rebuild all containers when one changes.
+.default_tag: &default_tag '2020-03-17.0'
+
+distributions:
+ - name: fedora
+ tag: *default_tag
+ versions:
+ - '30'
+ - '31'
+ packages:
+ - git
+ - gcc
+ - gcc-c++
+ - meson
+ - automake
+ - autoconf
+ - libtool
+ - make
+ - pkgconfig
+ - python3
+ - check-devel
+ - valgrind
+ - binutils
+ - doxygen
+ - xz
+ - clang-analyzer
+ want_qemu: true
+ - name: ubuntu
+ tag: *default_tag
+ versions:
+ - '19.10'
+ - '19.04'
+ packages:
+ - git
+ - gcc
+ - g++
+ - meson
+ - automake
+ - autoconf
+ - libtool
+ - make
+ - pkg-config
+ - python3
+ - check
+ - valgrind
+ - binutils
+ - doxygen
+ - xz-utils
+ - name: debian
+ tag: *default_tag
+ versions:
+ - 'stable'
+ - 'sid'
+ packages:
+ - git
+ - gcc
+ - g++
+ - meson
+ - automake
+ - autoconf
+ - libtool
+ - make
+ - pkg-config
+ - python3
+ - check
+ - valgrind
+ - binutils
+ - doxygen
+ - xz-utils
+ - name: centos
+ tag: *default_tag
+ versions:
+ - '7'
+ - '8'
+ packages:
+ - git
+ - gcc
+ - gcc-c++
+ - automake
+ - autoconf
+ - libtool
+ - make
+ - pkgconfig
+ - python3
+ - check-devel
+ - valgrind
+ - binutils
+ - xz
+ build:
+ meson: False
+ extra_variables:
+ # note: the variable value includes the comment because we want that in the gitlab-ci file
+ MAKE_ARGS: "'' # disable distcheck, requires doxygen"
+ - name: arch
+ tag: *default_tag
+ versions:
+ - 'rolling'
+ packages:
+ - git
+ - gcc
+ - meson
+ - automake
+ - autoconf
+ - libtool
+ - make
+ - pkgconfig
+ - python3
+ - check
+ - valgrind
+ - binutils
+ - doxygen
+ - name: alpine
+ tag: *default_tag
+ versions:
+ - 'latest'
+ packages:
+ - git
+ - gcc
+ - g++
+ - meson
+ - automake
+ - autoconf
+ - libtool
+ - make
+ - pkgconfig
+ - python3
+ - check-dev
+ - valgrind
+ - binutils
+ - doxygen
+ - xz
+ - linux-headers
+++ /dev/null
-#!/usr/bin/env python3
-
-# This file generates the .gitlab-ci.yml file that defines the pipeline.
-
-import argparse
-import jinja2
-import os
-import sys
-import yaml
-
-from pathlib import Path
-
-# The various sources for templating
-SOURCE_DIR = Path('.gitlab-ci')
-CONFIG_FILE = 'gitlab-ci-config.yaml'
-TEMPLATE_FILE = 'gitlab-ci.tmpl'
-
-BASE_DIR = Path('.')
-OUTPUT_FILE = '.gitlab-ci.yml'
-
-
-def generate_template():
- with open(SOURCE_DIR / CONFIG_FILE) as fd:
- config = yaml.safe_load(fd)
-
- env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.fspath(SOURCE_DIR)),
- trim_blocks=True, lstrip_blocks=True)
-
- template = env.get_template(TEMPLATE_FILE)
- with open(BASE_DIR / OUTPUT_FILE, 'w') as fd:
- template.stream(config).dump(fd)
-
-
-if __name__ == '__main__':
- description = ('''
- This script generates the .gitlab-ci.yml file.
-
- It must be run from the git repository root directory and will overwrite
- the existing .gitlab-ci.yml file.
- ''')
- parser = argparse.ArgumentParser(description=description)
- parser.parse_args()
-
- if not SOURCE_DIR.exists():
- print('Error: run me from the top-level tree')
- sys.exit(1)
- generate_template()
+++ /dev/null
-# This file contains the configuration for the gitlab ci.
-# See the .gitlab-ci/generate-gitlab-ci.py file for more info
-#
-
-# We're happy to rebuild all containers when one changes.
-.default_tag: &default_tag '2020-03-17.0'
-
-distributions:
- - name: fedora
- tag: *default_tag
- versions:
- - '30'
- - '31'
- packages:
- - git
- - gcc
- - gcc-c++
- - meson
- - automake
- - autoconf
- - libtool
- - make
- - pkgconfig
- - python3
- - check-devel
- - valgrind
- - binutils
- - doxygen
- - xz
- - clang-analyzer
- want_qemu: true
- - name: ubuntu
- tag: *default_tag
- versions:
- - '19.10'
- - '19.04'
- packages:
- - git
- - gcc
- - g++
- - meson
- - automake
- - autoconf
- - libtool
- - make
- - pkg-config
- - python3
- - check
- - valgrind
- - binutils
- - doxygen
- - xz-utils
- - name: debian
- tag: *default_tag
- versions:
- - 'stable'
- - 'sid'
- packages:
- - git
- - gcc
- - g++
- - meson
- - automake
- - autoconf
- - libtool
- - make
- - pkg-config
- - python3
- - check
- - valgrind
- - binutils
- - doxygen
- - xz-utils
- - name: centos
- tag: *default_tag
- versions:
- - '7'
- - '8'
- packages:
- - git
- - gcc
- - gcc-c++
- - automake
- - autoconf
- - libtool
- - make
- - pkgconfig
- - python3
- - check-devel
- - valgrind
- - binutils
- - xz
- build:
- meson: False
- extra_variables:
- # note: the variable value includes the comment because we want that in the gitlab-ci file
- MAKE_ARGS: "'' # disable distcheck, requires doxygen"
- - name: arch
- tag: *default_tag
- versions:
- - 'rolling'
- packages:
- - git
- - gcc
- - meson
- - automake
- - autoconf
- - libtool
- - make
- - pkgconfig
- - python3
- - check
- - valgrind
- - binutils
- - doxygen
- - name: alpine
- tag: *default_tag
- versions:
- - 'latest'
- packages:
- - git
- - gcc
- - g++
- - meson
- - automake
- - autoconf
- - libtool
- - make
- - pkgconfig
- - python3
- - check-dev
- - valgrind
- - binutils
- - doxygen
- - xz
- - linux-headers
+++ /dev/null
-{# You're looking at the template here, so you can ignore the below
- warning. This is the right file to edit #}
-########################################
-# #
-# THIS FILE IS GENERATED, DO NOT EDIT #
-# #
-########################################
-
-.templates_sha: &template_sha d32ac1f30faad4fdef24af8a7724fb8c084c3dda # see https://docs.gitlab.com/ee/ci/yaml/#includefile
-
-include:
- {% for distribution in distributions|map(attribute='name')|unique()|sort() %}
- # {{ distribution.capitalize() }} container builder template
- - project: 'freedesktop/ci-templates'
- ref: *template_sha
- file: '/templates/{{distribution}}.yml'
- {% endfor %}
-
-stages:
- - prep # rebuild the container images if there is a change
- - build # for actually building and testing things in a container
- - VM # for running the test suite in a VM
- - autotools # distribution builds with autotools
- - meson # distribution builds with meson
- - tarballs # tarball builds
- - container_clean # clean up unused container images
-
-variables:
- # The upstrem repository we will check for images
- FDO_UPSTREAM_REPO: libevdev/libevdev
- LIBEVDEV_SKIP_ROOT_TESTS: 1
- GIT_DEPTH: 1
- MESON_BUILDDIR: 'build dir'
-
-.default_artifacts:
- artifacts:
- paths:
- - _build/test/test-suite.log
- - $MESON_BUILDDIR/meson-logs/
- expire_in: 1 week
- when: on_failure
- reports:
- junit: $MESON_BUILDDIR/junit-*.xml
-
-.autotools_build:
- extends:
- - .default_artifacts
- script:
- - mkdir _build
- - pushd _build > /dev/null
- - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
- - make
- - make check
- - if ! [[ -z "$MAKE_ARGS" ]]; then make $MAKE_ARGS; fi
- - popd > /dev/null
-
-.meson_build:
- extends:
- - .default_artifacts
- script:
- - .gitlab-ci/meson-build.sh
-
-{# Generate templates for every distribution/version combination we want, any
- job can then just extends: .name:version and the images will sort
- themselves out. #}
-{% for distro in distributions %}
-{% for version in distro.versions %}
-.{{distro.name}}:{{version}}:
- extends: .fdo.distribution-image@{{distro.name}}
- variables:
- FDO_DISTRIBUTION_TAG: '{{distro.tag}}'
- FDO_DISTRIBUTION_VERSION: '{{version}}'
-
-{% endfor %}
-{% endfor %}
-
-
-#################################################################
-# #
-# prep stage #
-# #
-#################################################################
-
-# Re-generate the CI script and make sure it's the one currently checked in
-# If this job fails, re-generate the gitlab-ci.yml script, see
-# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py
-#
-check-ci-script:
- image: golang:alpine
- stage: prep
- before_script:
- - apk add python3 git
- - pip3 install --user jinja2 PyYAML
- script:
- - python3 ./.gitlab-ci/generate-gitlab-ci.py
- - git diff --exit-code && exit 0 || true
- - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify"
- - exit 1
-
-check-commit:
- image: golang:alpine
- stage: prep
- before_script:
- - apk add python3 git
- script:
- - pip3 install GitPython
- - pip3 install pytest
- - |
- pytest --junitxml=results.xml \
- --tb=line \
- --assert=plain \
- ./.gitlab-ci/check-commit.py
- except:
- - master@libevdev/libevdev
- variables:
- GIT_DEPTH: 100
- artifacts:
- expire_in: 1 week
- when: on_failure
- paths:
- - results.xml
- reports:
- junit: results.xml
-
-{% for distro in distributions %}
-.{{ distro.name }}.packages:
- variables:
- FDO_DISTRIBUTION_PACKAGES: '{{ ' '.join(distro.packages)}}'
-
-{% endfor %}
-
-{% for distro in distributions %}
-{% if distro.want_qemu %}
-{% for version in distro.versions %}
-# Pulls in the qemu container from upstream or rebuilds it if missing
-.{{ distro.name }}:{{ version }}@qemu-prep:
- extends:
- - .{{ distro.name }}:{{ version }}
- - .{{ distro.name}}.packages
- - .fdo.qemu-build@fedora
- stage: prep
- tags:
- - kvm
- variables:
- GIT_STRATEGY: none
- FDO_DISTRIBUTION_TAG: qemu-{{ distro.tag }}
- allow_failure: true
-
-# Always rebuilds the container
-.{{ distro.name }}:{{ version }}@qemu-forced-rebuild:
- extends:
- - .{{ distro.name }}:{{ version }}@qemu-prep
- variables:
- FDO_FORCE_REBUILD: 1
- only:
- - schedules
-
-{% endfor %}
-{% endif %}
-{% endfor %}
-
-# This is the actual job
-fedora:31@qemu-prep:
- extends: .fedora:31@qemu-prep
-
-fedora:31@qemu-forced-rebuild:
- extends: .fedora:31@qemu-forced-rebuild
-
-{% for distro in distributions %}
-{% for version in distro.versions %}
-
-# Pulls in the container from upstream or rebuilds it if missing
-{{ distro.name }}:{{ version }}@container-prep:
- extends:
- - .{{ distro.name }}:{{ version }}
- - .{{ distro.name}}.packages
- - .fdo.container-build@{{ distro.name }}
- stage: prep
- variables:
- GIT_STRATEGY: none
-
-# Always rebuilds the container
-{{ distro.name }}:{{ version }}@container-forced-rebuild:
- extends:
- - {{ distro.name }}:{{ version }}@container-prep
- only:
- - schedules
- variables:
- FDO_FORCE_REBUILD: 1
-
-{% endfor %}
-{% endfor %}
-
-#################################################################
-# #
-# container clean stage #
-# run during the clean stage #
-# #
-#################################################################
-
-#
-# This stage will look for the container images we currently have in
-# the registry and will remove any that are not tagged with the provided
-# $container_image:$tag
-.container-clean:
- stage: container_clean
- image: golang:alpine
- before_script:
- - apk add python3
- - pip3 install --user python-gitlab
- script:
- - LATEST_TAG=$(echo $DISTRO_CONTAINER_IMAGE | cut -f2 -d:)
- # Go to your Profile, Settings, Access Tokens
- # Create a personal token with 'api' scope, copy the value.
- # Go to Settings, CI/CD, Variables
- # Define a variable of type File named AUTHFILE. Content is that token
- # value.
- - python3 .gitlab-ci/gitlab-container-delete $CI_SERVER_URL $CI_PROJECT_PATH
- --repository $FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION
- --authfile $AUTHFILE --exclude-tag "$LATEST_TAG"
- dependencies: []
- allow_failure: true
- only:
- - schedules
-
-{% for distro in distributions %}
-{% for version in distro.versions %}
-### {{ distro.name }} {{ version }}
-{{ distro.name }}:{{ version }}@container-clean:
- extends:
- - .{{ distro.name }}:{{ version }}
- - .container-clean
- needs: ["{{distro.name}}:{{version}}@container-prep"]
-
-{% endfor %}
-{% endfor %}
-
-#################################################################
-# #
-# build stage #
-# #
-#################################################################
-
-.autotools-build@template:
- extends:
- - .autotools_build
- stage: build
- dependencies: []
- variables:
- MAKE_ARGS: "distcheck"
-
-.meson-build@template:
- extends:
- - .meson_build
- stage: build
- dependencies: []
- variables:
- NINJA_ARGS: "dist"
-
-{% for distro in distributions %}
-{% for version in distro.versions %}
-
-{{ distro.name }}:{{ version }}@autotools-build:
- extends:
- - .{{ distro.name }}:{{ version }}
- - .autotools-build@template
- stage: autotools
- {# Where we have extra_variables defined, add them to the list #}
- {% if distro.build is defined and distro.build.extra_variables is defined %}
- variables:
- {% for key, value in distro.build.extra_variables.items() %}
- {{ key }}: {{ value }}
- {% endfor %}
- {% endif %}
- needs: ['{{ distro.name }}:{{ version }}@container-prep']
-
-{% if not distro.build is defined or distro.build.meson|default(True) %}
-{{ distro.name }}:{{ version }}@meson-build:
- extends:
- - .{{ distro.name }}:{{ version }}
- - .meson-build@template
- stage: meson
- {# Where we have extra_variables defined, add them to the list #}
- {% if distro.build is defined and distro.build.extra_variables is defined %}
- variables:
- {% for key, value in distro.build.extra_variables.items() %}
- {{ key }}: {{ value }}
- {% endfor %}
- {% endif %}
- needs: ['{{ distro.name }}:{{ version }}@container-prep']
-{% endif %}
-
-{% endfor %}
-{% endfor %}
-
-# Build argument tests
-#
-# We only run the build option combinations on one image
-# because they're supposed to fail equally on all
-.fedora-custom-build@autotools-template:
- extends:
- - .fedora:31
- - .autotools-build@template
- stage: build
- needs: ['fedora:31@container-prep']
-
-no-valgrind:autotools:
- extends: .fedora-custom-build@autotools-template
- before_script:
- - dnf remove -y valgrind
-
-no-check:autotools:
- extends: .fedora-custom-build@autotools-template
- before_script:
- - dnf remove -y check check-devel
-
-no-doxygen:autotools:
- extends: .fedora-custom-build@autotools-template
- before_script:
- - dnf remove -y doxygen
- variables:
- MAKE_ARGS: '' # disable distcheck, requires doxygen
-
-# doxygen is required for distcheck
-no-doxygen-check-valgrind:autotools:
- extends: .fedora-custom-build@autotools-template
- before_script:
- - dnf remove -y doxygen valgrind check check-devel
- variables:
- MAKE_ARGS: '' # disable distcheck, requires doxygen
-
-no-nm:autotools:
- extends: .fedora-custom-build@autotools-template
- before_script:
- - mv /usr/bin/nm /usr/bin/nm.moved
-
-enable-gcov:autotools:
- extends: .fedora-custom-build@autotools-template
- variables:
- CONFIGURE_FLAGS: "--enable-gcov"
-
-.fedora-custom-build@meson-template:
- extends:
- - .fedora:31
- - .meson-build@template
- stage: build
- needs: ['fedora:31@container-prep']
-
-no-valgrind:meson:
- extends: .fedora-custom-build@meson-template
- before_script:
- - dnf remove -y valgrind
-
-no-check:meson:
- extends: .fedora-custom-build@meson-template
- before_script:
- - dnf remove -y check check-devel
- variables:
- MESON_ARGS: -Dtests=disabled
- SKIP_MESON_TEST: 1
-
-# doxygen is required for dist
-no-doxygen:meson:
- extends: .fedora-custom-build@meson-template
- before_script:
- - dnf remove -y doxygen
- variables:
- MESON_ARGS: -Ddocumentation=disabled
- NINJA_ARGS: ''
-
-# doxygen is required for dist
-no-doxygen-check-valgrind:meson:
- extends: .fedora-custom-build@meson-template
- before_script:
- - dnf remove -y doxygen valgrind check check-devel
- variables:
- MESON_ARGS: -Dtests=disabled -Ddocumentation=disabled
- NINJA_ARGS: ''
- SKIP_MESON_TEST: 1
-
-enable-gcov:meson:
- extends: .fedora-custom-build@meson-template
- variables:
- MESON_ARGS: '-Dcoverity=true'
-
-scan-build:meson:
- extends: .fedora-custom-build@meson-template
- variables:
- NINJA_ARGS: 'scan-build'
- SKIP_MESON_TEST: 1
-
-static-build:meson:
- extends: .fedora-custom-build@meson-template
- script:
- - meson "$MESON_BUILDDIR" --default-library=static --prefix=$PWD/prefix-meson/
- - ninja -C "$MESON_BUILDDIR" install
- - ls -l $PWD/prefix-meson/lib64/libevdev.a
-
-soname:
- extends:
- - .fedora:31
- stage: build
- script:
- - ./autogen.sh --prefix=$PWD/prefix-autotools/
- - make install
- - ls -l $PWD/prefix-autotools/lib/libevdev.so.2.3.0
- - meson "$MESON_BUILDDIR" --prefix=$PWD/prefix-meson/
- - ninja -C "$MESON_BUILDDIR" install
- - ls -l $PWD/prefix-meson/lib64/libevdev.so.2.3.0
- needs: ['fedora:31@container-prep']
-
-#################################################################
-# #
-# VM stage #
-# #
-#################################################################
-
-.check_tainted: &check_tainted |
- # make sure the kernel is not tainted
- if [[ "$(ssh localhost -p 5555 cat /proc/sys/kernel/tainted)" -gt 0 ]];
- then
- echo tainted kernel ;
- exit 1 ;
- fi
-
-.qemu@fedora:31:
- extends:
- - .fedora:31
- stage: VM
- image: $CI_REGISTRY_IMAGE/$FDO_DISTRIBUTION_NAME/$FDO_DISTRIBUTION_VERSION:qemu-$FDO_DISTRIBUTION_TAG
- tags:
- - kvm
- variables:
- MESON_BUILDDIR: build_dir
- script:
- # start our vm, no args required
- - /app/start_vm.sh
-
- - *check_tainted
-
- - "scp -P 5555 -r $PWD localhost:"
- - echo "CI_JOB_ID=\"$CI_JOB_ID\"" > sshenv
- - echo "CI_JOB_NAME=\"$CI_JOB_NAME\"" >> sshenv
- - echo "MESON_BUILDDIR=\"$MESON_BUILDDIR\"" >> sshenv
- - echo "MESON_TEST_ARGS=\"$MESON_TEST_ARGS\"" >> sshenv
- - echo "NINJA_ARGS=\"$NINJA_ARGS\"" >> sshenv
- - "scp -P 5555 sshenv localhost:~/$CI_PROJECT_NAME/.meson_environment"
- - ssh localhost -p 5555 "cd $CI_PROJECT_NAME ; .gitlab-ci/meson-build.sh" && touch .success || true
- # no matter the results of the tests, we want to fetch the logs
- - scp -P 5555 -r localhost:$CI_PROJECT_NAME/"$MESON_BUILDDIR" .
-
- - *check_tainted
-
- - ssh localhost -p 5555 halt || true
- - sleep 2
- - pkill qemu || true
-
- - if [[ ! -e .success ]] ;
- then
- exit 1 ;
- fi
- artifacts:
- name: "qemu-meson-logs-$CI_JOB_NAME"
- when: always
- expire_in: 1 week
- paths:
- - $MESON_BUILDDIR/meson-logs
- - console.out
- reports:
- junit: $MESON_BUILDDIR/junit-*.xml
-
- retry:
- max: 2
- when: script_failure
- needs: ['fedora:31@qemu-prep']
-
-qemu:meson:
- extends: .qemu@fedora:31
-
-qemu:meson:valgrind:
- extends: .qemu@fedora:31
- variables:
- MESON_TEST_ARGS: '--setup=valgrind'
-
-meson-from-tarball:
- extends:
- - .fedora:31
- stage: tarballs
- script:
- - export INSTALLDIR="$PWD/_inst"
- - mkdir _build
- - pushd _build > /dev/null
- - ../autogen.sh --disable-silent-rules $CONFIGURE_FLAGS
- - make
- - make distcheck
- - popd > /dev/null
- - mkdir -p _tarball_dir
- - tar xf _build/libevdev-*.tar.xz -C _tarball_dir
- - pushd _tarball_dir/libevdev-*/ > /dev/null
- - meson "$MESON_BUILDDIR" --prefix="$INSTALLDIR"
- - ninja -C "$MESON_BUILDDIR" test
- - ninja -C "$MESON_BUILDDIR" install
- - popd > /dev/null
- - ls -lR $INSTALLDIR
- needs: ['fedora:31@container-prep']
-
-autotools-from-tarball:
- extends:
- - .fedora:31
- stage: tarballs
- script:
- - export INSTALLDIR="$PWD/_inst"
- - meson "$MESON_BUILDDIR"
- - ninja -C "$MESON_BUILDDIR" dist
- - mkdir -p _tarball_dir
- - tar xf "$MESON_BUILDDIR"/meson-dist/libevdev-*.xz -C _tarball_dir
- - pushd _tarball_dir/libevdev-*/ > /dev/null
- - mkdir _build
- - pushd _build > /dev/null
- - ../autogen.sh --disable-silent-rules --prefix="$INSTALLDIR" $CONFIGURE_FLAGS
- - make
- - make install
- - make distcheck
- - popd > /dev/null
- - popd > /dev/null
- - ls -lR $INSTALLDIR
- needs: ['fedora:31@container-prep']
+++ /dev/null
-#!/usr/bin/env python3
-#
-# Usage:
-# $ gitlab-container-delete <instance> <project>
-# Deletes all containers within that instance project.
-# Filter with --repository and --exclude.
-# $ echo $MY_GITLAB_TOKEN > auth.file
-# $ gitlab-container-delete https://gitlab.freedesktop.org \
-# libevdev/libevdev \
-# --exclude 2020-02-28.latest-tag \
-# --authfile auth.file
-
-import argparse
-import gitlab
-import logging
-
-from pathlib import Path
-
-logging.basicConfig(level=logging.INFO)
-logger = logging.getLogger(Path(__file__).stem)
-
-
-def delete_images(instance, project_name, repository=None, exclude=None, authfile=None):
- if authfile is not None:
- token = open(authfile).read().strip()
- else:
- token = None
-
- gl = gitlab.Gitlab(instance, private_token=token)
- p = gl.projects.list(search=project_name)[0]
-
- repos = [r for r in p.repositories.list() if repository is None or repository == r.name]
- for repo in repos:
- logger.info('Repository {}'.format(repo.name))
- for tag in repo.tags.list(per_page=100):
- if tag.name != exclude:
- logger.info('Deleting tag {}:{}'.format(repo.name, tag.name))
- tag.delete()
-
-
-if __name__ == '__main__':
- description = '''
- This tool deletes all container images in the registry of the given
- gitlab project.
-
- Use with --repository and --exclude-tag to limit to one repository and
- delete all but the given tag.
-
- Where authentication is needed, use a --authfile containing the string
- that is your gitlab private token value with 'api' access. Usually this
- token looks like 12345678-abcdefgh. This tool will strip any whitespaces
- from that file and use the rest of the file as token value.
-
- '''
- parser = argparse.ArgumentParser(description='Tool to delete all but one image from a gitlab registry')
- parser.add_argument('instance', type=str, help='registry URL with transport, e.g. http://gitlab.freedesktop.org.')
- parser.add_argument('project', type=str, help='project name in gitlab terminus, e.g. wayland/ci-templates')
- parser.add_argument('--repository', type=str,
- help='registry repository to work on, e.g. fedora/latest',
- default=None)
- parser.add_argument('--exclude-tag', type=str,
- help='tag to exclude, i.e. to not delete',
- default=None)
- parser.add_argument('--authfile', type=str,
- help='path to a file containing the gitlab auth token string',
- default=None)
-
- args = parser.parse_args()
- delete_images(args.instance, args.project, args.repository, args.exclude_tag, args.authfile)