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

How to update README.org and check if building of jar and cljs works? #52

Open
2 of 4 tasks
schoettl opened this issue May 30, 2021 · 3 comments
Open
2 of 4 tasks

Comments

@schoettl
Copy link
Collaborator

schoettl commented May 30, 2021

After changes and before pushing to GitHub, we usually want to:

  • check if the cljs build still works (lein cljsbuild once main)
  • check if the jar build still works (lein uberjar)
  • update the samples in the README, starting here
  • update package version number (maybe something with org mode macros?)

The README.org already have build instructions and code for samples embedded in babel blocks.

Can we call emacs with org-mode babel to run all source blocks and fail if a shell source block has non-zero exit status?

We could have a Makefile with

update-readme:
    emacs --batch … README.org

Alternatively we could add build rules in the Makefile but that would actually be redundant to the README.org.

What do you think?

@munen
Copy link
Contributor

munen commented Jun 3, 2021

It is possible to do what you're saying and it would be pretty cool, but it is a bit of work. I'm getting us started with some snippets.

Given this code: https://gist.github.com/munen/4cb3b5493f48e7f032d72b5c3440346a

You can run it like so:

munen@lambda:~/tmp% emacs -l init.el --batch tangle_test.org -f org-babel-execute-src-block
executing Ruby code block...
Code block evaluation complete.

Unfortunately, we're not done, yet.

Firstly, the org-babel-execute-src-block only runs, because the source block starts with the first character in the file. Otherwise it would crash. Secondly, the output is not written anywhere.

I've searched the Interwebs for a finished solution and interestingly couldn't find one so far. The best thing I've found is https://emacs.stackexchange.com/a/28655/17889 which provides a shell script which needs an Org file and a named source block as input. From a first look it looks a bit complicated, though. Maybe that's required.

Starting from my too simple and the probably too complicated script, we could build something that doesn't need a specific named source block, but just walks through the file and executes all source blocks. That could be a sweet little snippet that can be re-used in different places.

@schoettl
Copy link
Collaborator Author

schoettl commented Jun 3, 2021

Another idea is to use the easier to use tangle feature of org mode. It's described here, again at EmacsConf2020 ;)

It's not meant to update the README itself but generate source files from babel source blocks which can be executed as tests.

It would be useful for testing the compilation and also the use of the library in a sample clojure script.

@schoettl
Copy link
Collaborator Author

schoettl commented Jun 3, 2021

I created a Makefile and made use of tangling

Now, the build and more tests can be executed with:

make build && make test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants