Try running generated configuration
This commit is contained in:
parent
7fb78d41eb
commit
191d6e9ea6
5 changed files with 108 additions and 363 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!Dockerfile
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
/*/.cask/
|
||||
/*/bin/
|
||||
/*/dist/
|
||||
|
||||
generated-config.yml*
|
||||
|
|
374
.gitlab-ci.yml
374
.gitlab-ci.yml
|
@ -1,369 +1,19 @@
|
|||
image: registry.gitlab.com/ryuslash/emacs-config
|
||||
|
||||
stages:
|
||||
- pre-package-multifile
|
||||
- package
|
||||
- unit-test
|
||||
- integration-test
|
||||
- deploy
|
||||
- generate
|
||||
- run
|
||||
|
||||
package-oni-conf:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-conf/dist
|
||||
script:
|
||||
- cask --path oni-conf package
|
||||
generate-config:
|
||||
stage: generate
|
||||
script: emacs -batch -load generate.el -funcall generate
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-conf/dist/
|
||||
- generated-config.yml
|
||||
|
||||
package-oni-css:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-css/dist
|
||||
script:
|
||||
- cask --path oni-css package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-css/dist/
|
||||
|
||||
package-oni-elisp:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-elisp/dist
|
||||
script:
|
||||
- cask --path oni-elisp package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-elisp/dist/
|
||||
|
||||
package-oni-haml:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-haml/dist
|
||||
script:
|
||||
- cask --path oni-haml package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-haml/dist/
|
||||
|
||||
package-oni-html:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-html/dist
|
||||
script:
|
||||
- cask --path oni-html package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-html/dist/
|
||||
|
||||
package-oni-nxml:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-nxml/dist
|
||||
script:
|
||||
- cask --path oni-nxml package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-nxml/dist/
|
||||
|
||||
package-oni-org:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-org/dist
|
||||
script:
|
||||
- cask --path oni-org package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-org/dist/
|
||||
|
||||
package-oni-php:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-php/dist
|
||||
script:
|
||||
- cask --path oni-php package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-php/dist/
|
||||
|
||||
package-oni-python:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-python/dist
|
||||
script:
|
||||
- cask --path oni-python package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-python/dist/
|
||||
|
||||
package-oni-ruby:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-ruby/dist
|
||||
script:
|
||||
- cask --path oni-ruby package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-ruby/dist/
|
||||
|
||||
package-oni-twig:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-twig/dist
|
||||
script:
|
||||
- cask --path oni-twig package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-twig/dist/
|
||||
|
||||
package-oni-csharp:
|
||||
stage: pre-package-multifile
|
||||
before_script:
|
||||
- rm -rf oni-csharp/dist
|
||||
script:
|
||||
- cask --path oni-csharp package
|
||||
artifacts:
|
||||
paths:
|
||||
- oni-csharp/dist/
|
||||
|
||||
package:
|
||||
stage: package
|
||||
dependencies:
|
||||
- package-oni-conf
|
||||
- package-oni-css
|
||||
- package-oni-elisp
|
||||
- package-oni-haml
|
||||
- package-oni-html
|
||||
- package-oni-nxml
|
||||
- package-oni-org
|
||||
- package-oni-php
|
||||
- package-oni-python
|
||||
- package-oni-ruby
|
||||
- package-oni-twig
|
||||
- package-oni-csharp
|
||||
before_script:
|
||||
- rm -rf bin/
|
||||
- mkdir bin/
|
||||
script: make package
|
||||
artifacts:
|
||||
paths:
|
||||
- bin/
|
||||
|
||||
unit-test-oni-alert:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-alert TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-bookmark:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-bookmark TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-conf:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-conf TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-core:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-core TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-elisp:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-elisp TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-grep:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-grep TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-highlight-indent-guides:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-highlight-indent-guides TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-org:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-org TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
unit-test-oni-php:
|
||||
stage: unit-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make unit-test-oni-php TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-alert:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-alert TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-autohotkey:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-autohotkey TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-bat:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-bat TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-bats:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-bats TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-company:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-company TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-conf:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-conf TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-counsel:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-counsel TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-csharp:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-csharp TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-css:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-css TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-bookmark:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-bookmark TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-browse-url:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-browse-url TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-core:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
before_script:
|
||||
- mkdir -p ~/.emacs.d/data/
|
||||
script: make integration-test-oni-core TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-cpp:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-cpp TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-docker:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-docker TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-fish:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-fish TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-gui:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-gui TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-haskell:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-haskell TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-ivy:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-ivy TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-json:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-json TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-lua:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-lua TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-org:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-org TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-paredit:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-paredit TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-prescient:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-prescient TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-scheme:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-scheme TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
integration-test-oni-yasnippet:
|
||||
stage: integration-test
|
||||
dependencies:
|
||||
- package
|
||||
script: make integration-test-oni-yasnippet TEST_ARCHIVE=$(realpath bin/)
|
||||
|
||||
deploy:
|
||||
only:
|
||||
- master
|
||||
stage: deploy
|
||||
image: instrumentisto/rsync-ssh
|
||||
dependencies:
|
||||
- package
|
||||
before_script:
|
||||
- chmod 600 "$DEPLOY_KEY"
|
||||
script:
|
||||
- rsync -e "ssh -o \"UserKnownHostsFile $KNOWN_HOSTS\" -p 4511 -i $DEPLOY_KEY" -v -c -r --delete bin/ "elpa@ryuslash.org:"
|
||||
child-pipeline:
|
||||
stage: run
|
||||
trigger:
|
||||
include:
|
||||
- artifact: generated-config.yml
|
||||
job: generate-config
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
FROM silex/emacs:26.3-alpine-dev
|
||||
|
||||
RUN apk add bats sqlite
|
||||
RUN apk add bats sqlite yaml yaml-dev \
|
||||
&& git clone git://github.com/syohex/emacs-libyaml.git \
|
||||
&& make -C emacs-libyaml \
|
||||
&& mkdir -p /usr/local/share/emacs/site-lisp/libyaml \
|
||||
&& mv emacs-libyaml/libyaml-core.so emacs-libyaml/libyaml.el /usr/local/share/emacs/site-lisp/libyaml \
|
||||
&& rm -r emacs-libyaml
|
||||
|
|
86
generate.el
Normal file
86
generate.el
Normal file
|
@ -0,0 +1,86 @@
|
|||
(require 'libyaml)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defun directory-name->package-name (dir)
|
||||
(format "package-%s" dir))
|
||||
|
||||
(defun directory->prepackage (module)
|
||||
`(,(directory-name->package-name module)
|
||||
("stage" . "pre-package-multifile")
|
||||
("before_script" ,(format "rm -rf %s/dist" module))
|
||||
("script" ,(format "cask --path %s package" module))
|
||||
("artifacts"
|
||||
("paths" ,(format "%s/dist" module)))))
|
||||
|
||||
(defun module->unit-test (module)
|
||||
`(,(format "unit-test-%s" module)
|
||||
("stage" . "unit-test")
|
||||
("dependencies" "package")
|
||||
("script" . ,(format "make unit-test-%s TEST_ARCHIVE=$(realpath bin/)" module))))
|
||||
|
||||
(defun module->integration-test (module)
|
||||
`(,(format "integration-test-%s" module)
|
||||
("stage" . "integration-test")
|
||||
("dependencies" "package")
|
||||
("script" . ,(format "make integration-test-%s TEST_ARCHIVE=$(realpath bin/)" module))))
|
||||
|
||||
(defun unit-test-exists-p (module)
|
||||
(file-exists-p (format "test/%s-test.el" module)))
|
||||
|
||||
(defun integration-test-exists-p (module)
|
||||
(file-exists-p (format "test/integration/%s.bats" module)))
|
||||
|
||||
(defun alist-p (lst)
|
||||
(and (listp lst)
|
||||
(listp (car lst))
|
||||
(= (length lst) 2)
|
||||
(not (proper-list-p (car lst)))))
|
||||
|
||||
(defun prepare-value-for-yaml (object)
|
||||
(pcase object
|
||||
((and (pred proper-list-p)
|
||||
lst
|
||||
(guard (listp (car lst))))
|
||||
(prepare-for-yaml object))
|
||||
((pred proper-list-p)
|
||||
(apply #'vector object))
|
||||
(_ object)))
|
||||
|
||||
(defun prepare-for-yaml (object)
|
||||
(let ((hash (make-hash-table)))
|
||||
(dolist (item object)
|
||||
(puthash (car item) (prepare-value-for-yaml (cdr item)) hash))
|
||||
hash))
|
||||
|
||||
(defun generate ()
|
||||
(let* ((modules (directory-files "." nil (rx string-start "oni-")))
|
||||
(directories (cl-remove-if-not #'file-directory-p modules)))
|
||||
(with-temp-buffer
|
||||
(insert
|
||||
(yaml-dump
|
||||
(prepare-for-yaml
|
||||
`(("image" . "registry.gitlab.com/ryuslash/emacs-config")
|
||||
("stages" "pre-package-multi-file" "package" "unit-test" "integration-test" "deploy")
|
||||
,@(mapcar #'directory->prepackage directories)
|
||||
("package"
|
||||
("stage" . "package")
|
||||
("dependencies" ,@(mapcar #'directory-name->package-name directories))
|
||||
("before_script"
|
||||
"rm -rf bin/"
|
||||
"mkdir bin/")
|
||||
("script" . "make package")
|
||||
("artifacts"
|
||||
("paths" "bin/")))
|
||||
,@(mapcar #'module->unit-test
|
||||
(cl-remove-if-not #'unit-test-exists-p modules))
|
||||
,@(mapcar #'module->integration-test
|
||||
(cl-remove-if-not #'integration-test-exists-p modules))
|
||||
("deploy"
|
||||
("only" "master")
|
||||
("stage" . "deploy")
|
||||
("image" . "instrumentisto/rsync-ssh")
|
||||
("dependencies" "package")
|
||||
("before_script" "chmod 600 \"$DEPLOY_KEY\"")
|
||||
("script"
|
||||
"rsync -e \"ssh -o \\\"UserKnownHostsFile $KNOWN_HOSTS\\\" -p 4511 -i $DEPLOY_KEY\" -v -c -r --delete bin/ \"elpa@ryuslash.org:\""))))))
|
||||
(write-file "generated-config.yml"))))
|
Loading…
Reference in a new issue