From 3d0ecd0a2d8fdb2fd48610f78d9345c17549e628 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Mon, 18 Apr 2022 10:27:07 +0200 Subject: [PATCH] ci: Added PKGBUILD & workflow for deploying Arch packages --- .woodpecker/.arch.yml | 32 +++++++++++++++ .woodpecker/.docker.yml | 18 +++++++++ .woodpecker.yml => .woodpecker/.vc.yml | 13 ------- Dockerfile.builder | 4 +- PKGBUILD | 54 ++++++++++++++++++++++++++ 5 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 .woodpecker/.arch.yml create mode 100644 .woodpecker/.docker.yml rename .woodpecker.yml => .woodpecker/.vc.yml (82%) create mode 100644 PKGBUILD diff --git a/.woodpecker/.arch.yml b/.woodpecker/.arch.yml new file mode 100644 index 0000000000..8ea137bb4e --- /dev/null +++ b/.woodpecker/.arch.yml @@ -0,0 +1,32 @@ +matrix: + PLATFORM: + - 'linux/amd64' + - 'linux/arm64' + +platform: ${PLATFORM} +branches: ['master'] +depends_on: + - 'vc' + +pipeline: + build: + image: 'menci/archlinuxarm:base-devel' + commands: + # Update packages + - pacman -Syu --noconfirm + # Create non-root user to perform build & switch to their home + - groupadd -g 1000 builder + - useradd -mg builder builder + - chown -R builder:builder "$PWD" + - "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" + - su builder + # Build the package + - makepkg -s --noconfirm --needed + + publish: + image: 'curlimages/curl' + secrets: + - 'vieter_api_key' + commands: + # Publish the package + - 'for pkg in $(ls -1 *.pkg*); do curl -f -XPOST -T "$pkg" -H "X-API-KEY: $VIETER_API_KEY" https://arch.r8r.be/vieter/publish; done' diff --git a/.woodpecker/.docker.yml b/.woodpecker/.docker.yml new file mode 100644 index 0000000000..5a6da6524f --- /dev/null +++ b/.woodpecker/.docker.yml @@ -0,0 +1,18 @@ +platform: 'linux/amd64' +branches: ['master'] +depends_on: + - 'vc' + +pipeline: + build-publish: + image: 'woodpeckerci/plugin-docker-buildx' + secrets: [ docker_username, docker_password ] + settings: + repo: chewingbever/vlang + tag: latest + dockerfile: Dockerfile.builder + platforms: [ linux/arm64/v8, linux/amd64 ] + # The build can run every time, because we should only push when there's + # actual changes + when: + event: push diff --git a/.woodpecker.yml b/.woodpecker/.vc.yml similarity index 82% rename from .woodpecker.yml rename to .woodpecker/.vc.yml index a3ebf890e2..b794e50adc 100644 --- a/.woodpecker.yml +++ b/.woodpecker/.vc.yml @@ -46,16 +46,3 @@ pipeline: - git -C vc push when: event: push - - publish: - image: woodpeckerci/plugin-docker-buildx - secrets: [ docker_username, docker_password ] - settings: - repo: chewingbever/vlang - tag: latest - dockerfile: Dockerfile.builder - platforms: [ linux/arm64/v8, linux/amd64 ] - # The build can run every time, because we should only push when there's - # actual changes - when: - event: push diff --git a/Dockerfile.builder b/Dockerfile.builder index 6f0965e52e..d5bb2bc5e3 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -1,4 +1,4 @@ -FROM alpine:3.12 +FROM alpine:3.15 ARG TARGETPLATFORM @@ -21,7 +21,7 @@ RUN ln -s /opt/vlang/v /usr/bin/v && \ gc-dev \ diffutils -RUN git clone https://git.rustybever.be/Chewing_Bever/v /opt/vlang && \ +RUN git clone https://git.rustybever.be/vieter/v /opt/vlang && \ make && \ v -version diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000000..23a66d1e8e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,54 @@ +# Maintainer: Jef Roosens +# This PKGBUILD is mostly copied over from the AUR +# https://aur.archlinux.org/packages/vlang-git + +pkgname=vieter-v +pkgver=0.2.2.r796.gfbc02cbc5 +pkgrel=1 +pkgdesc='Simple, fast, safe, compiled language for developing maintainable software' +arch=('x86_64' 'aarch64') +url='https://vlang.io' +license=('MIT') +depends=('glibc') +makedepends=('git') +optdepends=('glfw: Needed for graphics support' + 'freetype2: Needed for graphics support' + 'openssl: Needed for http support') +provides=('vlang') +conflicts=('v' 'vlang' 'vlang-bin') +source=('vlang::git+https://git.rustybever.be/Chewing_Bever/v') +sha256sums=('SKIP') + +pkgver() { + cd "${srcdir}/vlang" + # Weekly tags are considered older than semantic tags that are older than + # them, so to prevent version resolution problems we exclude weekly tags. + git describe --long --tags --exclude "weekly*" | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +build() { + cd "${srcdir}/vlang" + # We don't require optimizations when compiling the bootstrap executable and + # -O2 actually breaks `./v self` (resulting in "cgen error:"), so we empty + # CFLAGS and LDFLAGS to ensure successful compilation. + CFLAGS="" LDFLAGS="" prod=1 make + + # vpm and vdoc fail to compile with "unsupported linker option" when LDFLAGS + # is set + LDFLAGS="" ./v build-tools +} + +package() { + cd "${srcdir}/vlang" + install -d "$pkgdir/usr/lib/vlang" "$pkgdir/usr/share/vlang" "$pkgdir/usr/bin" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -Dm755 v "$pkgdir/usr/lib/vlang" + cp -a cmd "$pkgdir/usr/lib/vlang/" + cp -a examples "$pkgdir/usr/share/vlang/" + cp -a thirdparty "$pkgdir/usr/lib/vlang/" + cp -a vlib "$pkgdir/usr/lib/vlang/" + cp v.mod "$pkgdir/usr/lib/vlang/" + ln -s /usr/lib/vlang/v "$pkgdir/usr/bin/v" + + touch "$pkgdir/usr/lib/vlang/cmd/tools/.disable_autorecompilation" +}