Add lint, service config, and test helper templates for HAF apps
Summary
Adds new reusable templates to haf_app_testing.gitlab-ci.yml to reduce CI duplication across HAF applications (balance_tracker, reputation_tracker, haf_block_explorer).
New Templates
Lint templates:
-
.haf_app_lint_bash- Bash script linting with shellcheck (checkstyle XML output) -
.haf_app_lint_sql- SQL linting with sqlfluff (PostgreSQL dialect)
Service container configuration:
-
.haf_service_config- HAF instance configuration variables -
.postgrest_service_config- PostgREST service configuration variables
Test helpers (composable with !reference):
-
.haf_app_wait_for_postgres- Wait for PostgreSQL readiness (DinD or service containers) -
.haf_app_wait_for_postgrest- Wait for PostgREST API -
.haf_app_wait_for_sync- Wait for HAF to reach target block -
.haf_app_extract_test_cache- Extract cache for test jobs
Usage Example
include:
- project: 'hive/common-ci-configuration'
ref: develop
file: '/templates/haf_app_testing.gitlab-ci.yml'
lint_bash:
extends: .haf_app_lint_bash
my_tests:
before_script:
- '!reference [.haf_app_wait_for_postgres, script]'
- '!reference [.haf_app_wait_for_postgrest, script]'
script:
- pytest tests/
Also Included
- Updated docs/haf-app-testing.md with documentation for all new templates
- Added docs/CI-IMPROVEMENT-PLAN.md documenting CI analysis and improvement roadmap
Test plan
- Review template syntax for correctness
- Optionally test with balance_tracker as pilot (follow-up MR)