From 714f2c6ef7edbc5d78fcaebfc60034dbe0c7c465 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 28 Mar 2019 00:53:55 -0700 Subject: Add GitLab CI/CD settings --- .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++++++++++++ GNUmakefile | 26 ++++++++++++++++++++++++++ oni-package.el | 6 ++++-- test/oni-alert-test.el | 9 +++++++++ test/oni-bookmark-test.el | 9 +++++++++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 GNUmakefile create mode 100644 test/oni-alert-test.el create mode 100644 test/oni-bookmark-test.el diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e001702 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,38 @@ +image: silex/emacs:26.1-alpine-dev + +stages: + - test + - package + - deploy + +test-oni-bookmark: + stage: test + script: make test-oni-bookmark + +test-oni-alert: + stage: test + script: make test-oni-alert + +package: + stage: package + before_script: + - rm -rf bin/ + - mkdir bin/ + script: make package + artifacts: + paths: + - bin/ + +deploy-oni-bookmark: + stage: deploy + dependencies: + - package + before_script: + - mkdir ~/.ssh/ + - echo "$DEPLOY_KEY" > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - echo -e "$SSH_CONFIG" > ~/.ssh/config + - echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts + - apk update && apk add rsync + script: + - rsync -v -c -r --delete bin/ elpa@ryuslash.org:usr/share/emacs/elpa diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..3f364b8 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,26 @@ +FILES := $(wildcard *.el) + +PACKAGE_TARGETS := $(addprefix package-,$(FILES)) + +package: $(PACKAGE_TARGETS) + +package-%: % + emacs --batch \ + --load oni-package.el \ + --funcall package-initialize \ + --eval '(package-upload-file "$^")' + +test-%: + emacs --batch \ + --load oni-package.el \ + --funcall package-initialize \ + --eval '(package-refresh-contents)' \ + --load ert \ + --load "test/$*-test.el" \ + --funcall package-initialize \ + --eval "(package-install-file \"oni-data-dir.el\")" \ + --eval "(package-install-file \"$*.el\")" \ + --funcall ert-run-tests-batch-and-exit + +clean: + rm -fv $(FILES) diff --git a/oni-package.el b/oni-package.el index 101dd71..6efd62c 100644 --- a/oni-package.el +++ b/oni-package.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190218235251 +;; Version: 20190314002658 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -48,10 +48,12 @@ (add-to-list 'package-archives `("oni" . "https://ryuslash.org/elpa/")) +(setq package-update-news-on-upload t) + ;;; Specify where to upload packages to. Used by ;;; ‘package-upload-buffer’ and ‘package-upload-file’. (setq package-archive-upload-base - "/ssh:ryuslash.org:usr/share/emacs/elpa/") + "bin/") ;;; Temporary fix for `package-maint-add-news-item', until I get my ;;; Copyright assignment back in order. diff --git a/test/oni-alert-test.el b/test/oni-alert-test.el new file mode 100644 index 0000000..f8574e2 --- /dev/null +++ b/test/oni-alert-test.el @@ -0,0 +1,9 @@ +(ert-deftest oni-alert-test-autoloads () + "Test that `oni-alert' gets loaded automatically." + (require 'alert) + (should (featurep 'oni-alert))) + +(ert-deftest oni-alert-test-sets-default-style () + "Test that `oni-alert' test the default style." + (require 'alert) + (should (eql alert-default-style 'libnotify))) diff --git a/test/oni-bookmark-test.el b/test/oni-bookmark-test.el new file mode 100644 index 0000000..32d0c77 --- /dev/null +++ b/test/oni-bookmark-test.el @@ -0,0 +1,9 @@ +(ert-deftest oni-bookmark-test-sets-default-file () + "Test that oni-bookarks works." + (require 'bookmark) + (should (string-match "/data/" bookmark-default-file))) + +(ert-deftest oni-bookmark-test-autoloads () + "Test that `oni-bookmark' gets loaded automatically." + (require 'bookmark) + (should (featurep 'oni-bookmark))) -- cgit v1.2.3-54-g00ecf