This file provides guidelines for agentic coding agents operating in this repository.
# Run all tests (Go + shell scripts + linting)
make
# Run only Go tests
make test-go
# Run Go tests with verbose output
go test -v ./...
# Run a single Go test by name
go test -v -run TestName ./...
# Run only shell script tests (requires Docker)
make unit-tests
# Run specific linter
make test-github # GitHub workflow/action validation
make test-json # JSON validation
make test-markdown # Markdown linting
make test-openapi # OpenAPI spec validation
make test-shellcheck # Shell script lintingRead .editorconfig for formatting rules.
Use idiomatic go:
- Testing: Uses
github.com/stretchr/testify/assertfor assertions - Error handling: Wrap errors with
errors.Join()for multiple errors, use sentinel errors defined at package level - JSON: Use struct tags for serialization (e.g.,
json:"euro") - Formatting: Run
go fmtbefore committing;go mod tidyfor dependencies
- Use POSIX-compliant
sh(not bash) - Always use
set -efor error handling - Check required tools with
whichbefore use - Exit codes: 1 = file error, 2 = directory error, 3 = validation error
- Quote variables:
"$VAR"not$VAR
Example pattern for validation:
set -e
FILE=$1
[ -f "$FILE" ] || { echo "Not a file: $FILE"; exit 1; }This repository relies on GitHub Actions for CI/CD and data updates.
Workflows are located in .github/workflows/.
| Workflow | Purpose |
|---|---|
merge-test.yaml |
Runs make on all PRs to main. Auto-merges dependabot and automation bot PRs. |
health-checks.yaml |
Scheduled daily health checks. Calls health-check-grid.yaml, health-check-networks.yaml, and health-check-integrity.yaml. |
health-check-grid.yaml |
Validates grid configuration data |
health-check-networks.yaml |
Validates network configuration data |
health-check-integrity.yaml |
Validates data integrity across datasets |
pull-data.yaml |
Fetches energy price data from Energi Data Service API |
pull-tariff-data.yaml |
Fetches tariff data from Energinet |
update-visualization.yaml |
Updates static visualization files |
update-api-constants.yaml |
Updates API constant definitions |
upgrade-go.yaml |
Automated Go version upgrades |
- Workflows use
on.schedulefor periodic tasks - Most workflows support
workflow_dispatchfor manual runs - Health check workflows publish results to
gh-pagesbranch
Docker and Docker Compose are required for running tests and development:
# Install dependencies and run all tests
make deps
make
# Run a shell in the runner container
make shellThe compose.yml defines services for:
runner- Main container for running scripts and testsbuilder- For build operationsswagger- Local OpenAPI documentation
When modifying this repository:
-
Adding new tests: Add Go tests in
*_test.gofiles. Add shell tests intest/*.shand call them from the main Makefile target. -
Adding new workflows: Place in
.github/workflows/and validate withmake test-github. -
Updating AGENTS.md: If you add new commands, change code style, or add new workflows, update this file to reflect those changes. Run
maketo ensure all tests pass. -
Dependencies: Use
go mod tidyfor Go dependencies. Shell scripts should use tools available in the runner container (checkcompose.ymlfor the base image).
├── .github/
│ ├── workflows/ # GitHub Actions workflows
│ └── actions/ # Reusable GitHub Actions
├── build/ # Generated build artifacts (gitignored)
├── configuration/ # JSON configuration files
├── resources/ # OpenAPI spec and static HTML
├── src/ # Shell scripts for data operations
├── test/ # Shell script tests
├── test/fixtures/ # Shell test fixtures
├── testdata/ # Go test fixtures (raw API responses)
└── Makefile # Build automation