aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-03-28 00:53:55 -0700
committerGravatar Tom Willemse2019-03-28 00:53:55 -0700
commit714f2c6ef7edbc5d78fcaebfc60034dbe0c7c465 (patch)
tree6d7c046dda571f5c3498d1dc36bb4cee14a63bf6
parent592067ef70e9bb12ca6dae6c49d0b63fdbbbed29 (diff)
downloademacs-config-714f2c6ef7edbc5d78fcaebfc60034dbe0c7c465.tar.gz
emacs-config-714f2c6ef7edbc5d78fcaebfc60034dbe0c7c465.zip
Add GitLab CI/CD settings
-rw-r--r--.gitlab-ci.yml38
-rw-r--r--GNUmakefile26
-rw-r--r--oni-package.el6
-rw-r--r--test/oni-alert-test.el9
-rw-r--r--test/oni-bookmark-test.el9
5 files changed, 86 insertions, 2 deletions
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 <tom@ryuslash.org>
;; 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)))