Add make backup and make restore commands and document them in the contributing section, for #268

This commit is contained in:
David Dworken 2024-12-31 10:22:32 -08:00
parent 173a424c07
commit 625ce46de6
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View File

@ -17,13 +17,21 @@ forcetest: ## Force running all tests without a test cache
test: ## Run all tests
TZ='America/Los_Angeles' HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 gotestsum --packages ./... --rerun-fails=10 --rerun-fails-max-failures=30 --format testname --jsonfile /tmp/testrun.json --post-run-command "go run client/posttest/main.go export" -- -p 1 -timeout 90m
ftest: ## Run a specific test specified via `make ftest FILTER=TestParam/testTui/color`
ftest: ## Run a specific test specified via `make ftest FILTER=TestParam/testTui/color` or `make ftest FILTER=TestImportJson`
go clean -testcache
HISHTORY_FILTERED_TEST=1 TZ='America/Los_Angeles' HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 gotestsum --packages ./... --rerun-fails=0 --format testname -- -p 1 -run "$(FILTER)" -timeout 60m
fbench: ## Run a specific benchmark test specified via `make fbench FILTER=BenchmarkQuery`
HISHTORY_FILTERED_TEST=1 TZ='America/Los_Angeles' HISHTORY_TEST=1 HISHTORY_SKIP_INIT_IMPORT=1 go test -benchmem -bench "$(FILTER)" -timeout 60m ./...
backup: ## Backup the local hishtory install. It is recommended to do this before doing any local dev or running any integration tests.
rm -rf ~/.hishtory.bak || true
cp -a ~/.hishtory ~/.hishtory.bak
restore: ## Restore the local hishtory install. If anything goes wrong during local dev or from running integration tests, you can restore the local hishtory install to the last backup.
rm -rf ~/.hishtory
mv ~/.hishtory.bak ~/.hishtory
release: ## [ddworken only] Release the latest version on Github
# Bump the version
expr `cat VERSION` + 1 > VERSION

View File

@ -269,13 +269,14 @@ Contributions are extremely welcome! I appreciate all contributions in terms of
If you're making code contributions, check out `make help` for some information on some useful commands. Namely, note that my general dev workflow consists of:
* Run `make backup` to create a backup of the current hishtory install in `~/.hishtory.bak/`
* Make some local changes (e.g. to fix a bug or add a new feature)
* Run `make local-install` to build and install your local version (note that this won't mess up your current hishtory DB!)
* ... Repeat until you're happy with your change ...
* Write some tests for your change. Unit tests are great, but we also have a large number of integration tests in `client_test.go`
* Note that the hishtory tests are quite thorough, so running them locally is quite time consuming (and some of them only work on Github Actions). Instead, I recommend using `make ftest` (see `make help` for information on this) to run the specific tests that you're adding/changing.
* Open a PR on Github! Once you open the PR, I'll take a look and will trigger Github Actions to run all the tests which will ensure that your change doesn't lead to any reggressions.
* [Optional] If you want to switch back to the latest released version (rather than your local change), run `hishtory update`
* [Optional] If you want to switch back to your previously installed hishtory version (rather than your local change), run `make restore`
* Merge the PR! :tada:
## Security