From 5c1f987285c5443b697da48bb249cbb3fd3a20cd Mon Sep 17 00:00:00 2001 From: Tomas Pecka <tomas.pecka@fit.cvut.cz> Date: Sat, 6 Jul 2019 13:20:28 +0200 Subject: [PATCH] CI: Build and sign Arch Linux packages --- .gitlab-ci.yml | 55 +++---- extra/distro/arch/nightly/PKGBUILD | 82 ++++++++++ extra/obs/PKGBUILD | 51 ------ extra/obs/_service | 8 - extra/obs/algorithms-library.spec | 209 ------------------------ extra/obs/make-distrofiles.sh | 55 ------- extra/obs/remove-werror.patch | 13 -- extra/obs/skip-measurements-tests.patch | 13 -- 8 files changed, 106 insertions(+), 380 deletions(-) create mode 100644 extra/distro/arch/nightly/PKGBUILD delete mode 100644 extra/obs/PKGBUILD delete mode 100644 extra/obs/_service delete mode 100644 extra/obs/algorithms-library.spec delete mode 100755 extra/obs/make-distrofiles.sh delete mode 100644 extra/obs/remove-werror.patch delete mode 100644 extra/obs/skip-measurements-tests.patch diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a38f4a7f00..ecd621102e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -353,41 +353,34 @@ deploy:docker:release: - docker push "$IMAGE_GUI:$TAG_RELEASE" # ----------------------------------------------- -# obs push +# create distro packages +# GPG_PRIVATE_KEY and GPG_PASSPHRASE are secret variables in the ALT group. Secret vars can be used only in protected branches +# GPG_PUBLIC_KEY and GPG_KEYID (fingerprint) are public variables in the ALT group -.obs: &obs_template +.deploy:package:arch: &packaging_arch + image: gitlab.fit.cvut.cz:5000/algorithms-library-toolkit/ci-docker-images/archlinux-makepkg stage: deploy - image: gitlab.fit.cvut.cz:5000/algorithms-library-toolkit/ci-docker-images/osc:latest - before_script: - - echo -e "[general]\napiurl = https://api.opensuse.org\n\n[https://api.opensuse.org]\nuser = ${OBS_USER}\npass = ${OBS_PASS}\n" > ~/.oscrc - - mkdir -p /obs_repo /distrofiles script: - - extra/obs/make-distrofiles.sh ${OBS_MODE} /distrofiles/ - - cd /obs_repo && osc co ${OBS_PROJECT} ${OBS_PACKAGE} - - cd ${OBS_PROJECT}/${OBS_PACKAGE} - - mv /distrofiles/* . - - osc addremove - - osc ci -n -m "CI autocommit (${CI_COMMIT_SHA}, tag=${CI_COMMIT_TAG})" - dependencies: [] + - pacman -Suy --noconfirm --needed base-devel gnupg + - echo "$GPG_PRIVATE_KEY" | sudo -u builder -- gpg --no-tty --batch --import - + - KEYGRIP=$(sudo -u builder -- gpg --with-keygrip -k $GPG_KEYID | grep Keygrip | cut -d= -f2 | tr -d ' ') + - sudo -u builder -- /usr/lib/gnupg/gpg-preset-passphrase --preset --passphrase "$GPG_PASSPHRASE" "$KEYGRIP" + - sudo -u builder -- makepkg --syncdeps --noconfirm --sign --key $GPG_KEYID + artifacts: + paths: + - "*.pkg.tar.xz*" + expire_in: 1 day + variables: + PACKAGER: "Tomáš Pecka <peckato1@fit.cvut.cz>" -deploy:obs:nightly: - <<: *obs_template +deploy:package:nightly:arch: + <<: *packaging_arch <<: *config_run_only_nightly - environment: - name: obs-nightly - url: https://build.opensuse.org/package/show/home:algorithms-library/algorithms-library-all-nightly - variables: - OBS_PROJECT: home:algorithms-library - OBS_PACKAGE: algorithms-library-all-nightly - OBS_MODE: nightly + before_script: + - cp extra/distro/arch/nightly/PKGBUILD . -deploy:obs:release: - <<: *obs_template +deploy:package:release:arch: + <<: *packaging_arch <<: *config_run_only_release - environment: - name: obs-production - url: https://build.opensuse.org/package/show/home:algorithms-library/algorithms-library - variables: - OBS_PROJECT: home:algorithms-library - OBS_PACKAGE: algorithms-library - OBS_MODE: release + before_script: + - cp extra/distro/arch/release/PKGBUILD . diff --git a/extra/distro/arch/nightly/PKGBUILD b/extra/distro/arch/nightly/PKGBUILD new file mode 100644 index 0000000000..a35dccc306 --- /dev/null +++ b/extra/distro/arch/nightly/PKGBUILD @@ -0,0 +1,82 @@ +# Maintainer: Tomas Pecka <peckato1 at fit dot cvut dot cz> + +pkgname=('algorithms-library-git' 'algorithms-library-gui-git') +pkgbase='automata-library' + +pkgver=0.0.0.r515.gc4bc905a4 +pkgrel=1 + +pkgdesc='Theoretical computer science datastructures and algorithms implementation. The library provides graphical and console interface similar to bash with many classical algorithms manipulating automata, grammars, regular expressions, trees and strings.' +arch=('x86_64' 'armv7' 'i686') +url='https://gitlab.fit.cvut.cz/algorithms-library-toolkit/' +license=('GPL') + +makedepends=('python3' 'cmake' 'gcc>=7.3.1' 'make' 'tclap' 'libxml2' 'qt5-base>=5.7' 'graphviz' 'jsoncpp' 'git') +checkdepends=() + +source=("$pkgbase::git+https://gitlab.fit.cvut.cz/algorithms-library-toolkit/automata-library.git") +sha256sums=('SKIP') +validpgpkeys=() + +pkgver() { + cd "$pkgbase" + git describe --long --tags --match="v*" | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd "$pkgbase" + + #patch -p1 -i "$srcdir/$pkgname-$pkgver.patch" + + mkdir -p build +} + +build() { + cd "$pkgbase/build" + python ../CMake/generate.py -wm + cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr + make +} + +check() { + cd "$pkgbase/build" + make test ARGS="--output-on-failure" +} + +package_algorithms-library-git() { + depends=('tclap' 'libxml2' 'readline') + optdepends=('graphviz: Visualize data structures') + provides=('algorithms-library') + conflicts=('algorithms-library') + + cd "$pkgbase/build" + make DESTDIR="$pkgdir" install + + # remove gui parts + mkdir -p gui/usr/lib gui/usr/bin gui/usr/include/algorithms-library + + # move binaries + mv -f $pkgdir/usr/bin/agui2 gui/usr/bin + + # move libraries + mv -f $pkgdir/usr/lib/libalib2gui* gui/usr/lib + + # move includes + pushd ../alib2gui/src + for file in $(find . -name "*.h" -o -name "*.hpp"); do + mkdir -p $(dirname "../../build/gui/usr/include/algorithms-library/$file") + mv $pkgdir/usr/include/algorithms-library/$file ../../build/gui/usr/include/algorithms-library/$file + done + popd +} + +package_algorithms-library-gui-git() { + depends=('libxml2' 'qt5-base>=5.7' 'graphviz' 'jsoncpp' 'algorithms-library') + provides=('algorithms-library-gui') + conflicts=('algorithms-library-gui') + + cd "$pkgbase/build" + mv gui/* $pkgdir +} diff --git a/extra/obs/PKGBUILD b/extra/obs/PKGBUILD deleted file mode 100644 index 3ee7f38345..0000000000 --- a/extra/obs/PKGBUILD +++ /dev/null @@ -1,51 +0,0 @@ -# Maintainer: Tomas Pecka <tomas.pecka at fit dot cvut dot cz> - -pkgname="algorithms-library@PKGMODE@" -pkgver="@PKGVER@" -pkgrel=1 - -pkgdesc='Theoretical computer science datastructures and algorithms implementation. The library provides graphical and console interface similar to bash with many classical algorithms manipulating automata, grammars, regular expressions, trees and strings.' -arch=('x86_64' 'armv7' 'i686') -url='https://gitlab.fit.cvut.cz/algorithms-library-toolkit/' -license=('GPL') -depends=('tclap' 'libxml2' 'readline' 'qt5-base>=5.7' 'graphviz' 'jsoncpp') -makedepends=('python3' 'cmake' 'gcc' 'bash' 'make' 'tclap') -provides=('algorithms-library') -conflicts=('algorithms-library') -sha256sums=('SKIP' 'c16c8d32762a69edaf27a96f348d14cf96092273eda99f65d6215b0d2b6ad4fb' '7a8e3aa1c28371e8317a42468dfce62e4233929a2291e53fc7b2dae310810ae5') -source=("algorithms-library.tar.gz" "remove-werror.patch" "skip-measurements-tests.patch") - -prepare() { - cd "${srcdir}/${pkgname%-git}" - ls - patch -p0 --forward --input="${srcdir}/skip-measurements-tests.patch" - patch -p0 --forward --input="${srcdir}/remove-werror.patch" -} - -build() { - cd "${srcdir}/${pkgname%-git}" - - mkdir -p build - cd build - ../CMake/generate.py -wm - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr \ - .. - make -j $(grep -c processor /proc/cpuinfo) -} - -check() { - cd "${srcdir}/${pkgname%-git}" - - cd build - make test ARGS="-j$(grep -c processor /proc/cpuinfo) --output-on-failure" -} - -package() { - cd "${srcdir}/${pkgname%-git}" - - cd build - make DESTDIR="${pkgdir}" install - install -D -m644 ../LICENSE $pkgdir/usr/share/licenses/${pkgname%-git}/LICENSE -} diff --git a/extra/obs/_service b/extra/obs/_service deleted file mode 100644 index 2e3b06cb16..0000000000 --- a/extra/obs/_service +++ /dev/null @@ -1,8 +0,0 @@ -<services> - <service name="download_url"> - <param name="host">app.evandar.cz</param> - <param name="protocol">https</param> - <param name="path">/alib-proxy/api/download/518/release</param> - <param name="filename">algorithms-library.tar.gz</param> - </service> -</services> diff --git a/extra/obs/algorithms-library.spec b/extra/obs/algorithms-library.spec deleted file mode 100644 index 1aa245c598..0000000000 --- a/extra/obs/algorithms-library.spec +++ /dev/null @@ -1,209 +0,0 @@ -# -# spec file for package algorithms-library -# -# This file is part of Algorithms library toolkit. -# Copyright (C) 2018 Jan Travnicek (jan.travnicek@fit.cvut.cz) -# -# Algorithms library toolkit is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Algorithms library toolkit is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. -# - -# adresář ve staĹľenĂ©m tar.gz z _service se zdrojáky obsahuje adresář kterĂ˝ musĂ mĂt jmĂ©no ${Name}-${Version} - -Name: algorithms-library -Version: 0.0.1 -Release: 2%{?dist} -Summary: Theoretical computer science datastructures and algorithms implementation -License: GPL-3.0-or-later -Group: Productivity/Scientific/Math -Url: https://gitlab.fit.cvut.cz/algorithms-library-toolkit/automata-library -Source0: algorithms-library.tar.gz -Patch0: remove-werror.patch -BuildRequires: python3 cmake gcc-c++ curl bash make libxml2-devel tclap readline-devel libQt5Widgets-devel libQt5Xml-devel graphviz-devel jsoncpp-devel -Requires: readline - -%description -Theoretical computer science datastructures and algorithms implementation. - -The library provides graphical and console interface similar to bash with many classical algorithms manipulating automata, grammars, regular expressions, trees and strings. - -#------------------------------------------------------------------ - -%package devel -Summary: Development files for algorithms-library -Group: Development/Libraries/C and C++ -Requires: algorithms-library = 0.0.1 - -%description devel -Theoretical computer science datastructures and algorithms implementation development sources. - -The library provides graphical and console interface similar to bash with many classical algorithms manipulating automata, grammars, regular expressions, trees and strings. - -%prep -%setup -q -%patch0 -p0 - -%build -./CMake/generate.py -w -m - -mkdir debug -cd debug -cmake -DCMAKE_BUILD_TYPE=Release -DALIB_PRODUCTION=1 .. -make -j6 - -%install -cd debug -%makeinstall - -cd .. -for library in alib2std alib2abstraction alib2algo alib2algo_experimental alib2aux alib2cli alib2common alib2data alib2data_experimental alib2dummy alib2elgo alib2graph_algo alib2graph_data alib2gui alib2measure alib2raw alib2raw_cli_integration alib2std alib2str alib2str_cli_integration alib2xml; do - find ${library}/src/ -name "*\.hpp" -o -name "*\.h" -o -name "*\.hxx" | while read line; do - if [ -s "$line" ]; then - target=$(dirname ${RPM_BUILD_ROOT}/usr/include/algorithms-library/`echo $line | cut -sd / -f 3-`) - mkdir -p $target && cp $line $target - fi - done -done -cd alib2std/src/ -cp -r alib ${RPM_BUILD_ROOT}/usr/include/algorithms-library/ - -%post -/sbin/ldconfig - -%postun -/sbin/ldconfig - -%files -%defattr(-,root,root) -/usr/bin/aaccess2 -/usr/bin/aarbology2 -/usr/bin/acast2 -/usr/bin/acompaction2 -/usr/bin/acompare2 -/usr/bin/aconversions2 -/usr/bin/aconvert2 -/usr/bin/aderivation2 -/usr/bin/adeterminize2 -/usr/bin/aecho2 -/usr/bin/aepsilon2 -/usr/bin/agenerate2 -/usr/bin/agui2 -/usr/bin/aintegral2 -/usr/bin/aintrospection2 -/usr/bin/alangop2 -/usr/bin/aminimize2 -/usr/bin/anormalize2 -/usr/bin/aql2 -/usr/bin/aquery2 -/usr/bin/arand2 -/usr/bin/araw2 -/usr/bin/arename2 -/usr/bin/areverse2 -/usr/bin/arun2 -/usr/bin/astat2 -/usr/bin/astringology2 -/usr/bin/atrim2 -/usr/bin/tniceprint - -/usr/lib/libalib2abstraction.so.0 -/usr/lib/libalib2abstraction.so.0.0.1 - -/usr/lib/libalib2algo.so.0 -/usr/lib/libalib2algo.so.0.0.1 - -/usr/lib/libalib2algo_experimental.so.0 -/usr/lib/libalib2algo_experimental.so.0.0.1 - -/usr/lib/libalib2aux.so.0 -/usr/lib/libalib2aux.so.0.0.1 - -/usr/lib/libalib2cli.so.0 -/usr/lib/libalib2cli.so.0.0.1 - -/usr/lib/libalib2common.so.0 -/usr/lib/libalib2common.so.0.0.1 - -/usr/lib/libalib2data.so.0 -/usr/lib/libalib2data.so.0.0.1 - -/usr/lib/libalib2data_experimental.so.0 -/usr/lib/libalib2data_experimental.so.0.0.1 - -/usr/lib/libalib2dummy.so.0 -/usr/lib/libalib2dummy.so.0.0.1 - -/usr/lib/libalib2elgo.so.0 -/usr/lib/libalib2elgo.so.0.0.1 - -/usr/lib/libalib2graph_algo.so.0 -/usr/lib/libalib2graph_algo.so.0.0.1 - -/usr/lib/libalib2graph_data.so.0 -/usr/lib/libalib2graph_data.so.0.0.1 - -/usr/lib/libalib2gui.so.0 -/usr/lib/libalib2gui.so.0.0.1 - -/usr/lib/libalib2measure.so.0 -/usr/lib/libalib2measure.so.0.0.1 - -/usr/lib/libalib2raw.so.0 -/usr/lib/libalib2raw.so.0.0.1 - -/usr/lib/libalib2raw_cli_integration.so.0 -/usr/lib/libalib2raw_cli_integration.so.0.0.1 - -/usr/lib/libalib2std.so.0 -/usr/lib/libalib2std.so.0.0.1 - -/usr/lib/libalib2str.so.0 -/usr/lib/libalib2str.so.0.0.1 - -/usr/lib/libalib2str_cli_integration.so.0 -/usr/lib/libalib2str_cli_integration.so.0.0.1 - -/usr/lib/libalib2xml.so.0 -/usr/lib/libalib2xml.so.0.0.1 - -%files devel -%defattr(-,root,root) -/usr/lib/libalib2abstraction.so -/usr/lib/libalib2algo.so -/usr/lib/libalib2algo_experimental.so -/usr/lib/libalib2aux.so -/usr/lib/libalib2cli.so -/usr/lib/libalib2common.so -/usr/lib/libalib2data.so -/usr/lib/libalib2data_experimental.so -/usr/lib/libalib2dummy.so -/usr/lib/libalib2elgo.so -/usr/lib/libalib2graph_algo.so -/usr/lib/libalib2graph_data.so -/usr/lib/libalib2gui.so -/usr/lib/libalib2measure.so -/usr/lib/libalib2raw.so -/usr/lib/libalib2raw_cli_integration.so -/usr/lib/libalib2std.so -/usr/lib/libalib2str.so -/usr/lib/libalib2str_cli_integration.so -/usr/lib/libalib2xml.so - -%dir /usr/include/algorithms-library -/usr/include/algorithms-library/* - -%changelog -* Wed Nov 15 2018 Jan Travnicek <Jan.Travnicek@fit.cvut.cz> 0.0.1-2 -- Add devel package - -* Wed Nov 14 2018 Jan Travnicek <Jan.Travnicek@fit.cvut.cz> 0.0.1-1 -- Initial RPM release diff --git a/extra/obs/make-distrofiles.sh b/extra/obs/make-distrofiles.sh deleted file mode 100755 index 16eb8da127..0000000000 --- a/extra/obs/make-distrofiles.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -function help { - echo "$0 MODE OUTPUT" >& 2 - echo -e " - MODE: 'release' or 'nightly'" >& 2 - echo -e " - OUTPUT: output directory" >& 2 -} - -function nightly_pkgver { - git describe --long --tags --match="v*" | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' -} - -function release_pkgver { - MAJOR=$(sed -En 's/^major = (.*)$/\1/p' CMake/generate.conf) - MINOR=$(sed -En 's/^minor = (.*)$/\1/p' CMake/generate.conf) - PATCH=$(sed -En 's/^patch = (.*)$/\1/p' CMake/generate.conf) - - echo "${MAJOR}.${MINOR}.${PATCH}" -} - -if [[ $# -ne 2 ]]; then - help - exit 1 -fi - -MODE=$1 -OUTPUT=$(realpath $2) - -if [[ "$MODE" != "release" && "$MODE" != "nightly" ]]; then - echo "Mode is not release or nightly" >& 2 - help - exit 1 -fi - -# go to source root -cd $(dirname $0) -cd ../../ - -# create sources tarball -pushd .. -tar -c \ - --exclude=.git -vz \ - --transform 's/automata-library/algorithms-library/' \ - -f $OUTPUT/algorithms-library.tar.gz automata-library -popd - -# create distrofiles for obs -if [[ $MODE == "nightly" ]]; then - sed "s/@PKGVER@/$(nightly_pkgver)/;s/@PKGMODE@/-git/" extra/obs/PKGBUILD > ${OUTPUT}/PKGBUILD -else - sed "s/@PKGVER@/$(release_pkgver)/;s/@PKGMODE@//" extra/obs/PKGBUILD > ${OUTPUT}/PKGBUILD -fi - -# copy patches -cp extra/obs/*.patch ${OUTPUT}/ diff --git a/extra/obs/remove-werror.patch b/extra/obs/remove-werror.patch deleted file mode 100644 index cbb95dfcb0..0000000000 --- a/extra/obs/remove-werror.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git CMake/Modules/CompilerFlags.cmake CMake/Modules/CompilerFlags.cmake -index 942fa958b..c06f3992e 100644 ---- CMake/Modules/CompilerFlags.cmake -+++ CMake/Modules/CompilerFlags.cmake -@@ -15,7 +15,7 @@ if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "(Clang|GNU)") - endif () - - # set build flags --add_compile_options(-Wall -pedantic -pipe -Wextra -Werror -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls) -+add_compile_options(-Wall -pedantic -pipe -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wdelete-non-virtual-dtor -Wredundant-decls) - - add_definitions(-DQT_NO_FOREACH) - diff --git a/extra/obs/skip-measurements-tests.patch b/extra/obs/skip-measurements-tests.patch deleted file mode 100644 index df1b9ff781..0000000000 --- a/extra/obs/skip-measurements-tests.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git alib2measure/test-src/measurements/MeasurementsTest.cpp alib2measure/test-src/measurements/MeasurementsTest.cpp -index 1571890f1..9370ffd03 100644 ---- alib2measure/test-src/measurements/MeasurementsTest.cpp -+++ alib2measure/test-src/measurements/MeasurementsTest.cpp -@@ -5,7 +5,7 @@ - #include <iostream> - #include <alib/measure> - --TEST_CASE ( "Measurements", "[unit][measure][measurements]" ) { -+TEST_CASE ( "Measurements", "[unit][measure][measurements][.]" ) { - measurements::reset ( ); - - SECTION ( "Construct Measurements" ) { -- GitLab