Skip to content

Commit

Permalink
Merge pull request #160 from emacs-php/fix/github-actions
Browse files Browse the repository at this point in the history
Fix GitHub Actions
  • Loading branch information
zonuexe authored Jan 13, 2023
2 parents bb8c3d7 + f4aabe5 commit 9440005
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 30 deletions.
33 changes: 26 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,48 @@ jobs:
strategy:
matrix:
emacs_version:
- "25.2"
- "25.3"
- "26.2"
- "26.3"
- "27.1"
- "27.2"
- "28.2"
- snapshot
include:
- emacs_version: "25.2"
- emacs_version: "25.3"
allow_failure: true
- emacs_version: snapshot
allow_failure: true
steps:
- uses: actions/setup-python@v2
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
python-version: '3.6'
php-version: '8.2'
tools: composer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}
- uses: conao3/setup-cask@master
with:
version: 'snapshot'
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get Composer cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer packages
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer
restore-keys: |
${{ runner.os }}-composer
- name: Composer install
run: 'composer install'
- name: Run tests
if: matrix.allow_failure != true
run: 'make test'
Expand Down
49 changes: 26 additions & 23 deletions tests/e2e/test-sanity.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,43 @@
(require 'buttercup)
(require 'phpactor)

(defun buffer-string* (buffer)
(with-current-buffer buffer
(buffer-substring-no-properties (point-min) (point-max) )))

(describe "var: `phpactor-history-size'"
(it "should have default value"
(expect phpactor-history-size :to-be 100)
))
(expect phpactor-history-size :to-be nil)))

(describe "var: `phpactor-install-directory'"
(it "should have some value"
(display-warning 'buttercup (format "phpactor install folder is : %s" phpactor-install-directory) :debug)
(expect phpactor-install-directory :not :to-be nil)
))
(display-warning 'buttercup
(format "phpactor install directory is: %s" phpactor-install-directory)
:debug)
(expect phpactor-install-directory :not :to-be nil)))

(describe ": `phpactor--lisp-directory'" ;; I prefer having a test as I'm not that really fine with it being nil
(describe ": `phpactor--lisp-directory'"
;; I prefer having a test as I'm not that really fine with it being nil
(it "should have some value"
(display-warning 'buttercup (format "phpactor lisp folder is : %s" phpactor--lisp-directory) :debug)
(expect phpactor--lisp-directory :not :to-be nil)
))
(display-warning 'buttercup
(format "phpactor lisp directory is: %s" phpactor--lisp-directory)
:debug)
(expect phpactor--lisp-directory :not :to-be nil)))

(describe "defun: `phpactor-install-or-update'"
(it "should find phpactor installed under phpactor-install-directory :"
(let ((timeout-duration 300))
(phpactor-install-or-update)
(with-timeout
(timeout-duration (display-warning 'buttercup (format "Error : timeout waiting %s seconds for composer install to finish" timeout-duration)))
(while (not (file-exists-p (f-join phpactor-install-directory "vendor/bin/phpactor")))
(let* ((phpactor-install-directory default-directory)
(timeout-duration 300)
(error-timeout (format "Error: timeout waiting %s seconds for composer install to finish"
timeout-duration))
(path-to-phpactor (expand-file-name "vendor/bin/phpactor" phpactor-install-directory))
(compilation-buffer (phpactor-install-or-update)))
(expect (executable-find "composer") :not :to-be nil)
(with-timeout (timeout-duration (display-warning 'buttercup error-timeout))
(while (not (eq 'run (process-status (get-buffer-process compilation-buffer))))
(sleep-for 1))
(sleep-for 1))
(expect phpactor-executable :to-equal (f-join phpactor-install-directory "vendor/bin/phpactor"))
)))
(princ "\n--------------------\n")
(princ (with-current-buffer compilation-buffer
(buffer-substring (point-min) (point-max))))
(princ "--------------------\n\n")
(expect (phpactor--find-executable) :to-equal path-to-phpactor))))

(describe "defun: `phpactor-get-working-dir'"
(it "should rely on php-project"
Expand All @@ -67,9 +72,7 @@
(with-current-buffer (find-file "tests/src/Book.php")
;; (message "phpactor-working-dir is : %s" (php-project-get-root-dir))
(phpactor-get-working-dir)
(expect 'php-project-get-root-dir :to-have-been-called)
)
))
(expect 'php-project-get-root-dir :to-have-been-called))))

(provide 'test-sanity)
;;; test-sanity.el ends here

0 comments on commit 9440005

Please sign in to comment.