From 4f78007f42d5a796c2f40c907cb02e4fa67649a0 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 6 Sep 2024 12:12:22 +0900 Subject: [PATCH] Impelemt CI --- .fmf/version | 1 + plans/test.fmf | 5 +++++ tests/validation/main.fmf | 8 ++++++++ tests/validation/main.js | 17 +++++++++++++++++ tests/validation/test.js | 7 +++++++ tests/validation/test.sh | 17 +++++++++++++++++ 6 files changed, 55 insertions(+) create mode 100644 .fmf/version create mode 100644 plans/test.fmf create mode 100644 tests/validation/main.fmf create mode 100644 tests/validation/main.js create mode 100644 tests/validation/test.js create mode 100755 tests/validation/test.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/test.fmf b/plans/test.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/test.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/validation/main.fmf b/tests/validation/main.fmf new file mode 100644 index 0000000..d396a72 --- /dev/null +++ b/tests/validation/main.fmf @@ -0,0 +1,8 @@ +summary: Lint check for GNOME-Shell extension files +test: ./test.sh +framework: beakerlib +require: + - gjs + - glib2 + - gnome-shell-extension-no-overview + - json-glib-devel diff --git a/tests/validation/main.js b/tests/validation/main.js new file mode 100644 index 0000000..c5163d9 --- /dev/null +++ b/tests/validation/main.js @@ -0,0 +1,17 @@ +import GObject from 'gi://GObject'; + +export const LayoutManager = GObject.registerClass( +class LayoutManager extends GObject.Object { + constructor() { + super(); + this._startingUp = 1; + } + + connectObject(object) { + } + + disconnectObject(object) { + } +}); + +export let layoutManager = new LayoutManager(); diff --git a/tests/validation/test.js b/tests/validation/test.js new file mode 100644 index 0000000..ae1b278 --- /dev/null +++ b/tests/validation/test.js @@ -0,0 +1,7 @@ +import GObject from 'gi://GObject'; + +import NoOverviewExtension from './extension.js'; + +let extension = new NoOverviewExtension(); +extension.enable(); +extension.disable(); diff --git a/tests/validation/test.sh b/tests/validation/test.sh new file mode 100755 index 0000000..b7e5709 --- /dev/null +++ b/tests/validation/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k + +# gjs or js115 in mozjs115-devel provides very simple validations. + +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun -t "sed -e 's|resource:.*/main.js|./main.js|' /usr/share/gnome-shell/extensions/no-overview@fthx/extension.js > extension.js" + rlPhaseEnd + + rlPhaseStartTest + rlRun -t "json-glib-validate /usr/share/gnome-shell/extensions/no-overview@fthx/metadata.json" + rlRun -t "gjs -m test.js" + rlPhaseEnd +rlJournalEnd