From f1016e321e17fa711d40cef2c9f50c0c683e204a Mon Sep 17 00:00:00 2001 From: Dmitry Porunov Date: Fri, 1 Nov 2019 02:13:37 +0400 Subject: [PATCH] CI/CD test --- .gitlab-ci.yml | 113 ++++++++++++++++++++++++++++++ pkg/aur/aur.pub | 1 + pkg/aur/posy-cursors-git/PKGBUILD | 43 ++++++++++++ pkg/aur/posy-cursors/PKGBUILD | 21 ++++++ pkg/aur/posy-cursors/PKGBUILD_REF | 42 +++++++++++ src/buildFunctions.sh | 8 +-- 6 files changed, 224 insertions(+), 4 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 pkg/aur/aur.pub create mode 100644 pkg/aur/posy-cursors-git/PKGBUILD create mode 100644 pkg/aur/posy-cursors/PKGBUILD create mode 100644 pkg/aur/posy-cursors/PKGBUILD_REF diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..61b8b32 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,113 @@ +# GitLab CI configuration for ffsend builds, tests and releases +# +# To add a new release: +# - configure a new 'build-*' job with the proper target +# - export a build artifact from the new job +# - manually upload artifact to GitHub in the 'github-release' job + +# AUR packages release +package-aur: + image: archlinux/base + stage: package + # needs: + # - release-github + dependencies: [] + only: + - /^v(\d+\.)*\d+$/ + before_script: [] + script: + - cd ./pkg/aur + + # Determine the version number we're releasing for + - VERSION=$(echo $CI_COMMIT_REF_NAME | cut -c 2-) + - echo "Determined binary version number 'v$VERSION'" + + # Determine remote URLs and SHA checksums + - echo "Determining SHA checksums for remote files..." + - URL_SOURCE=https://git.auteiy.me/dmitry/cursorsPosy/-/archive/v$VERSION/ffsend-v$VERSION.tar.gz + - 'echo "Selected source URL: $URL_SOURCE"' + - echo "Determining sha256sum for remote source..." + - 'SHA_SOURCE=$(curl -sSL "$URL_SOURCE" | sha256sum | cut -d" " -f1)' + - 'echo "Got sha256sum: $SHA_SOURCE"' + + # Update PKGBUILD parameters: version, source URL and SHA sum + - echo "Updating PKGBUILDS with release information..." + - sed "s/^pkgver=.*\$/pkgver=$VERSION/" -i posy-cursors/PKGBUILD + - sed "s/^source=(\"\(.*\)::.*\").*\$/source=(\"\1::$(echo $URL_SOURCE | sed 's/\//\\\//g')\")/" -i ffsend/PKGBUILD + - sed "s/^sha256sums=.*\$/sha256sums=('$SHA_SOURCE')/" -i posy-cursors/PKGBUILD + + # Get SHA hash for local and remote file w/o version, update if it has changed + # - 'SHA_STRIP_LOCAL=$(cat ffsend-git/PKGBUILD | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)' + # - 'SHA_STRIP_REMOTE=$(curl -sSL "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=ffsend-git" | sed /^pkgver=.\*/d | sha256sum | cut -d" " -f1)' + + # Install dependencies + - echo "Installing required build packages..." + - pacman -Syu --noconfirm sudo base-devel openssh git openssl + + # Make AUR package + - mkdir -p /.cargo + - chmod -R 777 /.cargo + - cd posy-cursors/ + - echo "Making main source package..." + - sudo -u nobody makepkg -c + - sudo -u nobody makepkg --printsrcinfo > .SRCINFO + # Make git package if different than the remote + # - | + # if [ ! "$SHA_STRIP_LOCAL" == "$SHA_STRIP_REMOTE" ]; then + # cd ../ffsend-git + # echo "Making git source package..." + # sudo -u nobody makepkg -c + # sudo -u nobody makepkg --printsrcinfo > .SRCINFO + # else + # echo "Not making git source package, it has not changed" + # fi + # - cd .. + + # Set up SSH for publishing + - mkdir -p /root/.ssh + - cp ./aur.pub /root/.ssh/id_rsa.pub + - cat "$AUR_SSH_PRIVATE" | base64 -d > /root/.ssh/id_rsa + - echo "Host aur.archlinux.org" >> /root/.ssh/config + - echo " IdentityFile /root/.ssh/aur" >> /root/.ssh/config + - echo " User aur" >> /root/.ssh/config + - chmod 600 /root/.ssh/{id_rsa*,config} + - eval `ssh-agent -s` + - ssh-add /root/.ssh/id_rsa + - ssh-keyscan -H aur.archlinux.org >> /root/.ssh/known_hosts + - git config --global user.name "Dmitry Porunov" + - git config --global user.email "dmitry@auteiy.me" + + # Publish main package: clone AUR repo, commit update and push + - git clone ssh://aur@aur.archlinux.org/posy-cursors.git aur-posy-cursors + - cd aur-posy-cursors + - cp ../posy-cursors/{PKGBUILD,.SRCINFO} ./ + - git add PKGBUILD .SRCINFO + - git commit -m "Release v$VERSION" + - git push + - cd .. + + # Publish binary package: clone AUR repo, commit update and push + # - git clone ssh://aur@aur.archlinux.org/ffsend-bin.git aur-ffsend-bin + # - cd aur-ffsend-bin + # - cp ../ffsend-bin/{PKGBUILD,.SRCINFO} ./ + # - git add PKGBUILD .SRCINFO + # - git commit -m "Release v$VERSION" + # - git push + # - cd .. + + # Publish git package: clone AUR repo, commit update and push + # Only publish it if it is different than the remote + # - | + # if [ ! "$SHA_STRIP_LOCAL" == "$SHA_STRIP_REMOTE" ]; then + # git clone ssh://aur@aur.archlinux.org/ffsend-git.git aur-ffsend-git + # cd aur-ffsend-git + # cp ../ffsend-git/{PKGBUILD,.SRCINFO} ./ + # git add PKGBUILD .SRCINFO + # git commit -m "Update PKGBUILD for release v$VERSION" + # git push + # cd .. + # else + # echo "Not pushing git package, it has not changed" + # fi + +# TODO: add job to test ffsend{-git} AUR packages diff --git a/pkg/aur/aur.pub b/pkg/aur/aur.pub new file mode 100644 index 0000000..647b0fe --- /dev/null +++ b/pkg/aur/aur.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHfiNi+rOCPKGLB6v9uuYR6GkN6Zd+CdaRbV82A26AUzs48ZG0xZGXHsoRuZY/yCUhcrS2u9xZ16fsAxnyf1QCF1hZVABUYtNhL1eEbSbLNiG9vIWJzbRjgegN/yyiG9ZVhFfNqXtPeapvuM3H44a2XeeFJcvTOfj/alkVjypi/DY/+XpC1IlX+CARC/e0zXHa3KZohn+CfBj8kWZWQEr7+EtKT59pslNxuJPcDUw7sKYLcBBz00BT0vv3lntyvZI1rRsD7AvItOwSZPp6or78Tgp8+O0HvFpjrlNipPEqDPpETIPcjTIVAlvlPFK1J0Rpzud38YdoWGfPiM77k7L7 timvisee@aur diff --git a/pkg/aur/posy-cursors-git/PKGBUILD b/pkg/aur/posy-cursors-git/PKGBUILD new file mode 100644 index 0000000..4e7d1f1 --- /dev/null +++ b/pkg/aur/posy-cursors-git/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: Tim Visee +# +# This PKGBUILD is managed externally, and is automatically updated here: +# - https://gitlab.com/timvisee/ffsend/blob/master/pkg/aur/ffsend-git/PKGBUILD +# - Mirror: https://github.com/timvisee/ffsend/blob/master/pkg/aur/ffsend-git/PKGBUILD + +pkgname=ffsend-git +pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml +pkgrel=1 +pkgdesc="Easily and securely share files from the command line. A Firefox Send client." +url="https://gitlab.com/timvisee/ffsend" +license=('GPL3') +source=("ffsend::git+$url.git") +sha256sums=('SKIP') +arch=('x86_64' 'i686') +provides=('ffsend') +conflicts=('ffsend') +depends=('ca-certificates') +makedepends=('openssl>=1.0' 'rust>=1.32' 'cargo' 'cmake') +optdepends=('xclip: clipboard support' + 'bash-completion: support auto completion for bash') + +build() { + cd ffsend + env CARGO_INCREMENTAL=0 cargo build --release +} + +package() { + cd "$srcdir/ffsend" + + # Install Binary + install -Dm755 "./target/release/ffsend" "$pkgdir/usr/bin/ffsend" + + # Install shell completions and LICENSE file + install -Dm644 "contrib/completions/ffsend.bash" \ + "$pkgdir/etc/bash_completion.d/ffsend" + install -Dm644 "contrib/completions/_ffsend" \ + "$pkgdir/usr/share/zsh/site-functions/_ffsend" + install -Dm644 "contrib/completions/ffsend.fish" \ + "$pkgdir/usr/share/fish/vendor_completions.d/ffsend.fish" + install -Dm644 "LICENSE" \ + "$pkgdir/usr/share/licenses/ffsend/LICENSE" +} diff --git a/pkg/aur/posy-cursors/PKGBUILD b/pkg/aur/posy-cursors/PKGBUILD new file mode 100644 index 0000000..968ff26 --- /dev/null +++ b/pkg/aur/posy-cursors/PKGBUILD @@ -0,0 +1,21 @@ +# Maintainer: Auteiy + +pkgname=posy-cursors +pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml +pkgrel=1 +pkgdesc="Port of Posy's improved cursors" +arch=(any) +url="https://git.auteiy.me/dmitry/cursorsPosy" +license=(unknown) +source=("$pkgname-$pkgver.tar.gz::$url/-/archive/v$pkgver/cursorsPosy-v$pkgver.tar.gz?path=themes") # automatically set in CI, see: /.gitlab-ci.yml + +sha256sums=('SKIP') # automatically set in CI, see: /.gitlab-ci.yml + +package() { + cd cursorsPosy-v$pkgver-themes/themes + install -Ddm755 "$pkgdir/usr/share/icons" + cp -dr --no-preserve=ownership posy-white/ "$pkgdir/usr/share/icons/posy-white" + cp -dr --no-preserve=ownership posy-black/ "$pkgdir/usr/share/icons/posy-black" + cp -dr --no-preserve=ownership posy-white-tiny/ "$pkgdir/usr/share/icons/posy-white-tiny" + cp -dr --no-preserve=ownership posy-black-tiny/ "$pkgdir/usr/share/icons/posy-black-tiny" +} diff --git a/pkg/aur/posy-cursors/PKGBUILD_REF b/pkg/aur/posy-cursors/PKGBUILD_REF new file mode 100644 index 0000000..82482ca --- /dev/null +++ b/pkg/aur/posy-cursors/PKGBUILD_REF @@ -0,0 +1,42 @@ +# Maintainer: Tim Visee +# +# This PKGBUILD is managed externally, and is automatically updated here: +# - https://gitlab.com/timvisee/ffsend/blob/master/pkg/aur/ffsend/PKGBUILD +# - Mirror: https://github.com/timvisee/ffsend/blob/master/pkg/aur/ffsend/PKGBUILD + +pkgname=ffsend +pkgver=0.0.0 # automatically set in CI, see: /.gitlab-ci.yml +pkgrel=1 +pkgdesc="Easily and securely share files from the command line. A Firefox Send client." +url="https://gitlab.com/timvisee/ffsend" +license=('GPL3') +source=("ffsend-v$pkgver.tar.gz::$url/-/archive/v$pkgver/ffsend-v$pkgver.tar.gz") # automatically set in CI, see: /.gitlab-ci.yml +sha256sums=('SKIP') # automatically set in CI, see: /.gitlab-ci.yml +arch=('x86_64' 'i686') +provides=('ffsend') +depends=('ca-certificates') +makedepends=('openssl>=1.0' 'rust>=1.32' 'cargo' 'cmake') +optdepends=('xclip: clipboard support' + 'bash-completion: support auto completion for bash') + +build() { + cd "ffsend-v$pkgver" + env CARGO_INCREMENTAL=0 cargo build --release +} + +package() { + cd "$srcdir/ffsend-v$pkgver" + + # Install Binary + install -Dm755 "./target/release/ffsend" "$pkgdir/usr/bin/ffsend" + + # Install shell completions and LICENSE file + install -Dm644 "contrib/completions/ffsend.bash" \ + "$pkgdir/etc/bash_completion.d/ffsend" + install -Dm644 "contrib/completions/_ffsend" \ + "$pkgdir/usr/share/zsh/site-functions/_ffsend" + install -Dm644 "contrib/completions/ffsend.fish" \ + "$pkgdir/usr/share/fish/vendor_completions.d/ffsend.fish" + install -Dm644 "LICENSE" \ + "$pkgdir/usr/share/licenses/ffsend/LICENSE" +} diff --git a/src/buildFunctions.sh b/src/buildFunctions.sh index 114e77e..d427222 100644 --- a/src/buildFunctions.sh +++ b/src/buildFunctions.sh @@ -3,7 +3,7 @@ function buildWhite { cd "$sourceWhite" # generate cursors - BUILD="$sourceWhite"/../../Prebuilt/posy-white + BUILD="$sourceWhite"/../../themes/posy-white OUTPUT="$BUILD"/cursors ALIASES="$sourceWhite"/cursorList @@ -66,7 +66,7 @@ function buildWhite { function buildWhiteTiny { cd "$sourceWhiteTiny" # generate cursors - BUILD="$sourceWhiteTiny"/../../Prebuilt/posy-white-tiny + BUILD="$sourceWhiteTiny"/../../themes/posy-white-tiny OUTPUT="$BUILD"/cursors ALIASES="$sourceWhiteTiny"/cursorList @@ -129,7 +129,7 @@ function buildWhiteTiny { function buildBlack { cd "$sourceBlack" # generate cursors - BUILD="$sourceBlack"/../../Prebuilt/posy-black + BUILD="$sourceBlack"/../../themes/posy-black OUTPUT="$BUILD"/cursors ALIASES="$sourceBlack"/cursorList @@ -192,7 +192,7 @@ function buildBlack { function buildBlackTiny { cd "$sourceBlackTiny" # generate cursors - BUILD="$sourceBlackTiny"/../../Prebuilt/posy-black-tiny + BUILD="$sourceBlackTiny"/../../themes/posy-black-tiny OUTPUT="$BUILD"/cursors ALIASES="$sourceBlackTiny"/cursorList