This repository has been archived on 2026-03-07. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
c10y-complement-results/Makefile
2026-03-05 09:54:55 -05:00

21 lines
738 B
Makefile

SHELL := /bin/bash
DB = ledger.db
EXPORT_RUNS = csvdata/runs.csv
EXPORT_TESTS = csvdata/test_results.csv
.PHONY: export
export: ##H Export the current database to CSVs
sqlite3 -header -csv $(DB) "SELECT * FROM runs ORDER BY id ASC;" > $(EXPORT_RUNS)
sqlite3 -header -csv $(DB) "SELECT * FROM test_results ORDER BY id ASC;" > $(EXPORT_TESTS)
.PHONY: rebuild
rebuild: ##H Re-build the database from the exported CSVs
rm -f $(DB)
sqlite3 $(DB) < tables.sql
sqlite3 $(DB) ".mode csv" ".import --skip 1 $(EXPORT_RUNS) runs"
sqlite3 $(DB) ".mode csv" ".import --skip 1 $(EXPORT_TESTS) test_results"
echo "OK."
.PHONY: tail
tail: ##H Show the last 10 runs in the log
sqlite3 -box $(DB) "SELECT * FROM runs ORDER BY id DESC LIMIT 10;"