-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
78 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
|
||
(package-file "bydi.el") | ||
|
||
(files "bydi.el" "bydi-report.el") | ||
(files "bydi.el" "bydi-report.el" "bydi-ci.el") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
;;; bydi-ci.el --- CI helpers -*- lexical-binding: t; -*- | ||
|
||
;; Author: Krister Schuchardt <[email protected]> | ||
;; Homepage: https://github.com/Walheimat/bydi | ||
;; Version: 0.2.0 | ||
;; Package-Requires: ((emacs "28.1")) | ||
;; Keywords: extensions | ||
|
||
;;; Commentary: | ||
;; | ||
;; Utility to integrate with CI. | ||
|
||
;;; Code: | ||
|
||
(defvar bydi-setup--env-github-workspace "GITHUB_WORKSPACE" | ||
"Location of the project in GitHub action.") | ||
|
||
(defun bydi-ci--setup-paths (paths) | ||
"Set up `load-path'. | ||
Optionally, set up additional relative PATHS. | ||
This function returns a list of the directories added to the | ||
`load-path'." | ||
(let* ((source-dir (expand-file-name (or (getenv bydi-setup--env-github-workspace) | ||
default-directory))) | ||
(paths (append (list source-dir) (mapcar (lambda (it) (expand-file-name it source-dir)) paths)))) | ||
|
||
(message "Adding %s to `load-path'" paths) | ||
|
||
(dolist (it paths) | ||
(add-to-list 'load-path it)) | ||
|
||
paths)) | ||
|
||
(defun bydi-ci-setup-paths (paths) | ||
"Add PATHS to load path in a CI-aware way." | ||
(bydi-ci--setup-paths paths)) | ||
|
||
(provide 'bydi-ci) | ||
|
||
;;; bydi-ci.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
;;; bydi-ci-test.el --- Tests for custom functionality. -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; | ||
;; Tests for the custom functionality. | ||
|
||
;;; Code: | ||
|
||
(require 'bydi-ci nil t) | ||
|
||
(ert-deftest bydi-ci-setup-paths () | ||
(let ((load-path nil) | ||
(default-directory "/tmp")) | ||
|
||
(bydi ((:ignore getenv)) | ||
|
||
(bydi-ci-setup-paths (list "test" "mock")) | ||
|
||
(should (equal load-path '("/tmp/mock" "/tmp/test" "/tmp")))))) | ||
|
||
;;; bydi-ci-test.el ends here | ||
|
||
;; Local Variables: | ||
;; no-byte-compile: t | ||
;; End: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters