batteries icon indicating copy to clipboard operation
batteries copied to clipboard

Testing Discussion

Open 1bardesign opened this issue 3 years ago • 3 comments

https://github.com/1bardesign/batteries/pull/52 adds testing, and a few other recent prs from @idbrii have also added other CI functionality.

I'm torn on adding this stuff to the repo, especially in the main branch. At the very least we should move them under an easily deleted directory, probably .test or similar so it's ignored by utilities that ignore dotfiles.

The various alternatives, as i see them:

  • keep them in main branch, move to a directory, and don't worry about it beyond that.
  • move them to a test branch that CI can still use, with the caveat that we'll need to merge main into test often (some friction)
  • move them to a separate repo that uses batteries as a submodule (highest friction)

Some discussion from here onwards in discord

1bardesign avatar Mar 06 '22 23:03 1bardesign

@eigenbom i know you cared about this

I think they should probably be split to per-module tests rather than one big file. i think I don't mind them being in .test directory rather than a branch as it's not too hard to filter out or delete prior to packaging, and i think the default zip tool will ignore the filenames with a dot anyway.

1bardesign avatar Mar 07 '22 02:03 1bardesign

I don't know if you can put the github actions configuration anywhere except .github/ in the root of the repo. In theory, we could put the tests inside there. Unusual and makes them less discoverable, but a single superfluous directory to delete.

I agree about putting them in a folder and splitting them up.

CI detects PRs and pushes to this repo, so the yml needs to be in this repo to work. In theory CI could even merge batteries to the test repo on a push to this repo, but I don't know anything about handling github secrets/auth to allow that kind of setup. Doesn't seem worth the effort.

Putting them in another repo seems easier than a test branch. I guess that repo could have scripts for running the tests on different platforms and even include testy so no luarocks is required.

Personally, I'd rather they're in this repo because I think it's more likely someone will see them and actually add a test (and it's easier for me to do so too). Adding tests that are tied to code changes would be much easier.

idbrii avatar Mar 07 '22 02:03 idbrii

(Github yaml in the github folder is fine.)

I'm happy with the tests in .test so far, i think.

As a submodule, adding an exclusion on dotfiles when zipping for distribution works well and strips both .github, and .test, and more importantly all the git history.

With plain zip on arch linux:

zip -r -x*/.* batteries.zip path/to/batteries/

Gives a clean zip with the lua, readme, and license files.

When just grabbing the zip off github, it's easy to just leave out the dotfiles when extracting.

1bardesign avatar Mar 07 '22 22:03 1bardesign

Closing this, I think we're fine with it.

1bardesign avatar Jan 15 '23 22:01 1bardesign