summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kohnert2021-01-30 16:22:33 +0100
committerJan Kohnert2021-02-14 14:13:11 +0100
commita6ab9d751062871a173a4e09380c5ada14aec273 (patch)
treedf12cc756891636baa85378c385c677a04de9b3b
parent6cf061c8a706b2345df2f834ff2fec2c4007780e (diff)
downloadaur-a6ab9d751062871a173a4e09380c5ada14aec273.tar.gz
Added CI/CD, fixed dependencies.
-rw-r--r--.SRCINFO5
-rw-r--r--.gitignore1
-rw-r--r--.gitlab-ci.yml84
-rw-r--r--Dockerfile.build_and_test9
-rw-r--r--PKGBUILD26
5 files changed, 111 insertions, 14 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b9fac13235c..b21b0f7891a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,18 +1,15 @@
pkgbase = eccodes
pkgdesc = ECMWF decoding library for GRIB, BUFR and GTS
pkgver = 2.20.0
- pkgrel = 1
+ pkgrel = 2
url = https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home
arch = i686
arch = x86_64
license = Apache
makedepends = gcc-fortran
- makedepends = python
- makedepends = python-numpy
makedepends = cmake
depends = openjpeg
depends = libpng
- depends = python
depends = netcdf
optdepends = libaec: for compression
optdepends = jasper: as an alternative to openjpeg
diff --git a/.gitignore b/.gitignore
index c87943cb9b6..0daffa4bb73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/*
!.gitignore
+!.gitlab-ci.yml
!PKGBUILD
!.SRCINFO
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000000..b66ce725790
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,84 @@
+include:
+ - project: 'common/gitlab-helper'
+ ref: master
+ file: 'container-helper.yml'
+ - project: 'common/gitlab-helper'
+ ref: master
+ file: 'deploy-helper.yml'
+
+variables:
+ BUILD_AND_TEST_IMAGE: build_and_test
+
+workflow:
+ rules:
+ # don't create pipeline if the commit message starts with WIP
+ - if: $CI_COMMIT_MESSAGE =~ /^WIP/
+ when: never
+ # don't create pipeline if we're merging from master or version branches
+ - if: $CI_MERGE_REQUEST_IID && $CI_COMMIT_REF_NAME =~ /^(master|VER_\d+_\d+)$/
+ when: never
+ - if: $CI_MERGE_REQUEST_IID
+ - if: $CI_COMMIT_REF_NAME =~ /^(master|VER_\d+_\d+)$/
+ - if: $CI_COMMIT_TAG
+ - if: $CI_PIPELINE_SOURCE =~ /^(trigger|pipeline|web|api|merge_request_event)$/
+
+.rules_templates:
+ rules:
+ - if: &on_master $CI_COMMIT_REF_NAME =~ /^master$/
+
+stages:
+ - prepareBuild
+ - build
+ - test
+ - deploy
+
+docker-build-and-test:
+ stage: prepareBuild
+ extends: .container-build-and-push
+ variables:
+ WORKING_DIR: ${CI_PROJECT_DIR}
+ DOCKERFILE_NAME: "Dockerfile.build_and_test"
+ IMAGE_NAME: ${CI_REGISTRY_IMAGE}/${BUILD_AND_TEST_IMAGE}:${CI_COMMIT_REF_NAME}
+ BUILD_ARGS: REGISTRY=${CI_REGISTRY}
+ needs: []
+
+build-eccodes:
+ stage: build
+ image: ${CI_REGISTRY_IMAGE}/${BUILD_AND_TEST_IMAGE}:${CI_COMMIT_REF_NAME}
+ needs:
+ - job: "docker-build-and-test"
+ artifacts: no
+ artifacts:
+ name: "${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
+ expire_in: 1 day
+ paths:
+ - eccodes*.pkg.tar.zst
+ script:
+ # We istalled only depends in the build-and-test image,
+ # build-depends need to installed here, so we're able to check
+ # the installed package is not dependent on any of the build libs/packages
+ - makepkg -s --noconfirm
+
+test-eccodes:
+ stage: test
+ image: ${CI_REGISTRY_IMAGE}/${BUILD_AND_TEST_IMAGE}:${CI_COMMIT_REF_NAME}
+ needs: ["build-eccodes"]
+ script:
+ # Recommended checks
+ - namcap -m PKGBUILD
+ - namcap -m eccodes*.pkg.tar.zst
+ # Try to install package
+ - sudo pacman -U --noconfirm eccodes*.pkg.tar.zst
+
+deploy-eccodes:
+ stage: deploy
+ extends: .git-ssh-push-remote
+ variables:
+ REMOTE_HOST: "aur.archlinux.org"
+ REMOTE_USER: "aur"
+ REMOTE_REPOSITORY: "eccodes.git"
+ before_script:
+ - echo "Uploading to AUR..."
+ rules:
+ - if: *on_master
+ when: manual
diff --git a/Dockerfile.build_and_test b/Dockerfile.build_and_test
new file mode 100644
index 00000000000..6ac1cfc93b0
--- /dev/null
+++ b/Dockerfile.build_and_test
@@ -0,0 +1,9 @@
+ARG REGISTRY
+
+FROM "$REGISTRY/common/gitlab-helper/archlinux-yay:master"
+
+RUN (\
+ yay -Syuq --noconfirm --needed openjpeg libpng netcdf \
+ && yes | yay -Scc --noconfirm \
+ && sudo rm -rf /var/cache/pacman/pkg/* \
+)
diff --git a/PKGBUILD b/PKGBUILD
index 71067be5930..b48831adf49 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,16 @@
+# Maintainer: "Jan Kohnert <bughunter@jan-kohnert.de"
# Contributor: Graziano Giuliani <graziano.giuliani@poste.it>
pkgname=eccodes
pkgver=2.20.0
_attnum=45757960
-pkgrel=1
+pkgrel=2
pkgdesc="ECMWF decoding library for GRIB, BUFR and GTS"
arch=('i686' 'x86_64')
url="https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home"
license=('Apache')
-depends=('openjpeg' 'libpng' 'python' 'netcdf')
+depends=('openjpeg' 'libpng' 'netcdf')
optdepends=('libaec: for compression' 'jasper: as an alternative to openjpeg')
-makedepends=('gcc-fortran' 'python' 'python-numpy' 'cmake')
+makedepends=('gcc-fortran' 'cmake')
conflicts=('grib_api' 'libbufr-ecmwf')
source=(http://software.ecmwf.int/wiki/download/attachments/${_attnum}/${pkgname}-${pkgver}-Source.tar.gz)
sha512sums=('ea2953987c4713b230e6d75ad5ae1dbbeea2633d1caf60614ececfe2fabe07d7c794baf120f5df82716f37b2540f7f6a6cd82f04070a78bf65dc7d499ca50dc0')
@@ -19,17 +20,22 @@ build() {
sed -i 's/image.inmem_.*=.*1;//' src/grib_jasper_encoding.c
mkdir -p build
cd build
- [ -x /usr/bin/aec ] && has_aec=1 || has_aec=0
+ [ $(pacman -Qq libaec 2>/dev/null) ] && use_aec="ON" || use_aec="OFF"
+ [ $(pacman -Qq jasper 2>/dev/null) ] && use_jasper="ON" || use_jasper="OFF"
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=production \
-DCMAKE_INSTALL_DATAROOTDIR=/usr/share/$pkgname/definitions \
- -DCMAKE_INSTALL_DATADIR=/usr/share -DENABLE_AEC=$has_aec \
- -DENABLE_PNG=1 -DENABLE_ECCODES_THREADS=1 \
- -DOPENJPEG_INCLUDE_DIR=`pkg-config --variable=includedir libopenjpeg` \
- -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
- make || return 1
+ -DCMAKE_INSTALL_DATADIR=/usr/share -DENABLE_AEC=$use_aec \
+ -DENABLE_PNG=ON -DENABLE_ECCODES_THREADS=ON -DENABLE_JPG=ON \
+ -DENABLE_JPG_LIBOPENJPEG=ON -DENABLE_JPG_LIBJASPER=$use_jasper ..
+ make
+}
+
+check() {
+ cd "$srcdir"/${pkgname}-${pkgver}-Source/build
+ make test
}
package() {
cd "$srcdir"/${pkgname}-${pkgver}-Source/build
- make DESTDIR="$pkgdir" install || return 1
+ make DESTDIR="$pkgdir" install
}