Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove racer integration #553

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5d36b91
Fix cargo login token tests
psibi Aug 18, 2023
e3ebab3
Remove rust-ts-mode from auto-mode-alist
psibi Feb 18, 2024
866c5e2
Fix possible babel test failures
psibi Feb 18, 2024
a4fbc1b
Change regex for rustic-test-babel-error-results
psibi Feb 18, 2024
9a6ddd0
No issue with compile error
psibi Feb 18, 2024
8620a98
Do fixes at other locations too
psibi Feb 18, 2024
fd5b5d8
Merge pull request #2 from psibi/babel-test-failures
psibi Feb 18, 2024
4002826
Enable test for emacs 29.1
psibi Feb 18, 2024
c6cd30f
Bump version of cask
psibi Feb 18, 2024
a743dd7
Try using ert tests
psibi Feb 18, 2024
5a36ba4
Require test-helper
psibi Feb 18, 2024
36077a2
Add load-file
psibi Feb 18, 2024
b56aba0
Update depedency
psibi Feb 18, 2024
0b03616
Add melpa check
psibi Feb 18, 2024
de38bba
Update
psibi Feb 18, 2024
c64e2fb
Fix seq version
psibi Feb 18, 2024
e784003
seq is included with Emacs 25
psibi Feb 18, 2024
408adb1
Remove seq
psibi Feb 18, 2024
69b02b4
Do relevant imports for rustic-cargo-test
psibi Feb 18, 2024
038c4f6
Modify test setup for Emacs 29.1
psibi Feb 19, 2024
ebee470
Slight cleanup
psibi Feb 19, 2024
498e7b7
Update tests
psibi Feb 19, 2024
5654d66
Switch the compilation error count to 1
psibi Feb 19, 2024
91731e8
Revert it back to 10
psibi Feb 19, 2024
6da5f7b
Remove should-not
psibi Feb 19, 2024
c726954
Simplify github action
psibi Feb 19, 2024
3748f6d
Revert test numbers
psibi Feb 19, 2024
2621065
Add changelog
psibi Feb 19, 2024
6c2f266
Try fixing flaky tests
psibi Feb 19, 2024
ecd95ed
Fix one more flaky test
psibi Feb 19, 2024
5c1cff5
Merge pull request #3 from psibi/emacs-20
psibi Feb 19, 2024
adf3690
Update changelog
psibi Feb 19, 2024
5fb361c
Update pinned rustc to latest stable
psibi Feb 19, 2024
ccd6df0
Merge pull request #4 from psibi/rustc-1.76
psibi Feb 19, 2024
331968e
Fix rustic-cargo-outdated
psibi Feb 23, 2024
6d00f85
Update changelog
psibi Feb 23, 2024
89b3350
Try fixing flaky test
psibi Feb 23, 2024
9f13601
Merge pull request #5 from psibi/outdated-fix
psibi Feb 23, 2024
37d033f
Remove racer integration
psibi Feb 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 37 additions & 48 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,40 @@ name: CI
on: [push, pull_request]

jobs:
unix-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
emacs-version:
- 27.2
- 28.1
steps:
- uses: actions/checkout@v2

- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs-version }}

- uses: conao3/setup-cask@master
with:
version: 0.8.4

- name: Install requirements
run: |
echo "$HOME/.cask/bin" >> $GITHUB_PATH
echo "$HOME/bin" >> $GITHUB_PATH

sudo apt update
sudo apt install -y gnutls-bin gnupg2 dirmngr
sudo apt install -y texinfo libgif-dev libxpm-dev

- name: Install needed rust stuff
run: |
curl -sSf https://build.travis-ci.com/files/rustup-init.sh | sh -s -- --default-toolchain=stable -y
source $HOME/.cargo/env
rustup component add rustfmt-preview

- name: rustic-doc prerequisites
run: |
wget https://github.com/jgm/pandoc/releases/download/2.17.0.1/pandoc-2.17.0.1-1-amd64.deb
sudo dpkg -i pandoc-2.17.0.1-1-amd64.deb
mkdir -p ~/.local/bin
mkdir -p ~/.local/share/emacs/rustic-doc/std/
curl -sL https://github.com/sharkdp/fd/releases/download/v8.3.2/fd-v8.3.2-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/fd'
curl -sL https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz | tar xz --wildcards --strip-components=1 -C /usr/local/bin '*/rg'
rustup component add rust-docs

- name: Run tests
run: |
make test
unix-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
emacs-version:
- 27.2
- 28.1
- 29.1
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: [email protected]
- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs-version }}

- uses: cask/setup-cask@v1
with:
version: 0.9.0

- name: Install requirements
run: |
echo "$HOME/.cask/bin" >> $GITHUB_PATH
echo "$HOME/bin" >> $GITHUB_PATH

- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0
components: clippy, rustfmt

- name: Run tests
run: |
just build
just test
13 changes: 13 additions & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* Unreleased

- Revamp testing in CI: Use only cask.
- Replace Makefile with justfile.
- Pin Rust version in CI to avoid spurious failure.
- Create a new babel variable to create temporary directory and not
rely on babel's internal stuff. This was needed to fix the tests.
- Fix flaky tests.
- Enable tests for Emacs 29.1
- Update rustc to 1.76.0
- Fix bugs in rustic-cargo-outdated mode in the presence of git
repositories as dependency.
- Remove racer integrace since it's development has been discontinued.
153 changes: 0 additions & 153 deletions Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# List all recipes
just:
just --list --unsorted

# Install dependencies and build via cask
build:
emacs --version
cask install
cask build

# Test
test:
cask emacs --batch -L . -L test -f batch-byte-compile $(cask files)
cask emacs --batch -L . -L test -l test/all-tests.el -f ert-run-tests-batch-and-exit
23 changes: 11 additions & 12 deletions rustic-babel.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

(require 'rustic-rustfmt)

;; FIXME This variable doesn't exist in noninteractive emacs sessions,
;; which probably means that it is internal and we shouldn't use it.
(defvar org-babel-temporary-directory)

(defvar rustic-info nil)

(add-to-list 'org-src-lang-modes '("rust" . rustic))
Expand Down Expand Up @@ -160,7 +156,7 @@ execution with rustfmt."
(save-excursion
(save-match-data
(goto-char (point-min))
(when (re-search-forward "^thread '[^']+' panicked at '[^']+', ")
(when (re-search-forward "^thread '[^']+' panicked at .*")
(goto-char (match-beginning 0))
(setq result (buffer-substring-no-properties (point) (line-end-position)))))))
(rustic-babel-run-update-result-block result)
Expand Down Expand Up @@ -210,10 +206,13 @@ after successful compilation."
(buffer-string)))))))
(kill-buffer "rustic-babel-format-buffer"))))

(defvar rustic-org-babel-temporary-directory
(make-temp-file "babel-" t))

(defun rustic-babel-generate-project (&optional expand)
"Create rust project in `org-babel-temporary-directory'.
"Create rust project in `rustic-org-babel-temporary-directory'.
Return full path if EXPAND is t."
(let* ((default-directory org-babel-temporary-directory)
(let* ((default-directory rustic-org-babel-temporary-directory)
(dir (make-temp-file-internal "cargo" 0 "" nil)))
(shell-command-to-string (format "cargo new %s --bin --quiet" dir))
(if expand
Expand All @@ -224,14 +223,14 @@ Return full path if EXPAND is t."
"In order to reduce the execution time when the project has
dependencies, the project name is stored as a text property in the
header of the org-babel block to check if the project already exists
in `org-babel-temporary-directory'. If the project exists, reuse it.
in `rustic-org-babel-temporary-directory'. If the project exists, reuse it.
Otherwise create it with `rustic-babel-generate-project'."
(let* ((beg (org-babel-where-is-src-block-head))
(end (save-excursion (goto-char beg)
(line-end-position)))
(line (buffer-substring beg end)))
(let* ((project (symbol-name (get-text-property 0 'project line)))
(path (concat org-babel-temporary-directory "/" project "/")))
(path (concat rustic-org-babel-temporary-directory "/" project "/")))
(if (file-directory-p path)
(progn
(put-text-property beg end 'project (make-symbol project))
Expand Down Expand Up @@ -348,7 +347,7 @@ kill the running process."
(progn
(rustic-process-kill-p p t)
nil)
(let* ((default-directory org-babel-temporary-directory)
(let* ((default-directory rustic-org-babel-temporary-directory)
(project (rustic-babel-project))
(dir (setq rustic-babel-dir (expand-file-name project)))
(main-p (cdr (assq :main params)))
Expand Down Expand Up @@ -392,7 +391,7 @@ at least one time in this emacs session before this command can be used."
(line-end-position)))
(line (buffer-substring beg end))
(project (symbol-name (get-text-property 0 'project line)))
(path (concat org-babel-temporary-directory "/" project "/src/main.rs")))
(path (concat rustic-org-babel-temporary-directory "/" project "/src/main.rs")))
(if (file-exists-p path)
(find-file path)
(message "Run block first to visit generated project."))))
Expand All @@ -403,7 +402,7 @@ at least one time in this emacs session before this command can be used."
(interactive)
(rustic--inheritenv
(let* ((err-buff (get-buffer-create rustic-babel-compilation-buffer-name))
(default-directory org-babel-temporary-directory)
(default-directory rustic-org-babel-temporary-directory)
(body (org-element-property :value (org-element-at-point)))
(project (rustic-babel-project))
(params (list "cargo" "clippy")))
Expand Down
Loading
Loading