From 9c198f11094768fff29cd65efae335acca68cc68 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sun, 14 Aug 2022 12:57:29 +0200 Subject: [PATCH] wip: CI --- .ci/pipeline.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ .ci/rock.sh | 17 ++++++++++++++++ .ci/rock.yml | 20 ++++++++++++++++++ .ci/test.sh | 34 +++++++++++++++++++++++++++++++ .ci/test.yml | 20 ++++++++++++++++++ README.adoc | 8 +++----- 6 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 .ci/pipeline.yml create mode 100755 .ci/rock.sh create mode 100644 .ci/rock.yml create mode 100755 .ci/test.sh create mode 100644 .ci/test.yml diff --git a/.ci/pipeline.yml b/.ci/pipeline.yml new file mode 100644 index 0000000..3e2e6b5 --- /dev/null +++ b/.ci/pipeline.yml @@ -0,0 +1,53 @@ +--- +resources: +- name: repo + type: git + icon: github + source: + uri: https://git.sclu1034.dev/lucas/lgi-libpulse-glib.git + branch: ci + +jobs: +- name: test + plan: + - get: repo + trigger: true + - in_parallel: + - task: run-test-5.1 + file: repo/.ci/test.yml + vars: + lua-version: 5.1 + - task: run-test-5.2 + file: repo/.ci/test.yml + vars: + lua-version: 5.2 + - task: run-test-5.3 + file: repo/.ci/test.yml + vars: + lua-version: 5.3 + - task: run-test-5.4 + file: repo/.ci/test.yml + vars: + lua-version: 5.4 + +- name: rock + plan: + - get: repo + trigger: true + - in_parallel: + - task: run-rock-5.1 + file: repo/.ci/rock.yml + vars: + lua-version: 5.1 + - task: run-rock-5.2 + file: repo/.ci/rock.yml + vars: + lua-version: 5.2 + - task: run-rock-5.3 + file: repo/.ci/rock.yml + vars: + lua-version: 5.3 + - task: run-rock-5.4 + file: repo/.ci/rock.yml + vars: + lua-version: 5.4 diff --git a/.ci/rock.sh b/.ci/rock.sh new file mode 100755 index 0000000..e959445 --- /dev/null +++ b/.ci/rock.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -ex + +sudo enable-lua ${LUA_VERSION:-5.1} +eval "$(luarocks --lua-version ${LUA_VERSION:-5.1} path)" + +sudo apt-get update +sudo apt-get install -y --no-install-recommends gobject-introspection libgirepository1.0-dev libpulse-dev + +luarocks --lua-version ${LUA_VERSION:-5.1} install lgi +luarocks --lua-version ${LUA_VERSION:-5.1} install ldoc +luarocks --lua-version ${LUA_VERSION:-5.1} install lua-discount + +luarocks --lua-version ${LUA_VERSION:-5.1} make rocks/lgi-libpulse-glib-scm-1.rockspec + +sudo disable-lua ${LUA_VERSION:-5.1} diff --git a/.ci/rock.yml b/.ci/rock.yml new file mode 100644 index 0000000..9127953 --- /dev/null +++ b/.ci/rock.yml @@ -0,0 +1,20 @@ + +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: registry.local:5000/lua-clib-x11 + tag: latest + +inputs: +- name: repo + +params: + CI: true + LUA_VERSION: ((lua-version)) + +run: + path: .ci/rock.sh + dir: repo diff --git a/.ci/test.sh b/.ci/test.sh new file mode 100755 index 0000000..4562fb9 --- /dev/null +++ b/.ci/test.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -ex + +mkdir -p "${BUILD_DIR:-./build}" + +CMAKE_ARGS="" + +if [ -n "$CI" ]; then + CMAKE_ARGS="-DCI=ON" +fi + +sudo enable-lua ${LUA_VERSION:-5.1} +eval "$(luarocks --lua-version ${LUA_VERSION:-5.1} path)" + +sudo apt-get update +sudo apt-get install -y --no-install-recommends gobject-introspection libgirepository1.0-dev libpulse-dev + +luarocks --lua-version ${LUA_VERSION:-5.1} install busted +luarocks --lua-version ${LUA_VERSION:-5.1} install lgi +luarocks --lua-version ${LUA_VERSION:-5.1} install ldoc +luarocks --lua-version ${LUA_VERSION:-5.1} install lua-discount + +cmake -S "${SOURCE_DIR:-./}" -B "${BUILD_DIR:-./build}" ${CMAKE_ARGS} +make -j $(nproc) -C "${BUILD_DIR:-./build}" + +busted \ + --lua /usr/bin/lua \ + -C "${SOURCE_DIR:-./}" \ + "--config-file=${SOURCE_DIR:-./}/.busted.lua" \ + "--cpath=${BUILD_DIR:-./build}/?.so" \ + --output=TAP + +sudo disable-lua ${LUA_VERSION:-5.1} diff --git a/.ci/test.yml b/.ci/test.yml new file mode 100644 index 0000000..0fea350 --- /dev/null +++ b/.ci/test.yml @@ -0,0 +1,20 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: registry.local:5000/lua-clib-x11 + tag: latest + +inputs: +- name: repo + +params: + CI: true + SOURCE_DIR: repo + BUILD_DIR: /tmp/build-output + LUA_VERSION: ((lua-version)) + +run: + path: repo/.ci/test.sh diff --git a/README.adoc b/README.adoc index 77416f8..0e4d6cb 100644 --- a/README.adoc +++ b/README.adoc @@ -5,7 +5,6 @@ ifdef::env-github,env-browser[] :toc: macro :toclevels: 1 endif::[] -ifdef::env-github[] :branch: master :status: :outfilesuffix: .adoc @@ -15,16 +14,15 @@ ifdef::env-github[] :note-caption: :paperclip: :tip-caption: :bulb: :warning-caption: :warning: -endif::[] -:url-ci-github: https://github.com/sclu1034/lua-libpulse-glib/actions -:url-ci-badge-github: https://img.shields.io/github/workflow/status/sclu1034/lua-libpulse-glib/Lint%20&%20Test?style=flat-square +:url-ci: https://ci.sclu1034.dev/teams/main/pipelines/lgi-libpulse-glib +:url-ci-badge: https://ci.sclu1034.dev/api/v1/teams/main/pipelines/lgi-libpulse-glib/badge :url-license-badge: https://img.shields.io/badge/license-GPLv3-brightgreen?style=flat-square :url-luarocks-badge: https://img.shields.io/luarocks/v/sclu1034/lua-libpulse-glib?style=flat-square :url-luarocks-link: https://luarocks.org/modules/sclu1034/lua-libpulse-glib image:{url-license-badge}[License] ifdef::status[] -image:{url-ci-badge-github}[Build Status (GitHub Actions), link={url-ci-github}] +image:{url-ci-badge}[Build Status (Concourse CI), link={url-ci}] endif::[] image:{url-luarocks-badge}[LuaRocks Package, link={url-luarocks-link}]