From f68c451b00c38e9c192c03741e3e081b8c4331ed Mon Sep 17 00:00:00 2001 From: Matheus Macabu Date: Thu, 19 Jun 2025 12:36:37 +0200 Subject: [PATCH] Build: Add experimental build+watch with Air (#106834) * Build: Add experimental build+watch with Air * Codeowners: Add owner for .air.toml * Makefile: Add installation reference for Air --- .air.toml | 25 +++++++++++++++++++++++++ .github/CODEOWNERS | 1 + Makefile | 4 ++++ 3 files changed, 30 insertions(+) create mode 100644 .air.toml diff --git a/.air.toml b/.air.toml new file mode 100644 index 00000000000..b3923357b54 --- /dev/null +++ b/.air.toml @@ -0,0 +1,25 @@ +[build] +bin = "./bin/grafana" +args_bin = ["server", "-profile", "-profile-addr=127.0.0.1", "-profile-port=6000", "-profile-block-rate=1", "-profile-mutex-rate=5", "-packaging=dev", "cfg:app_mode=development"] +cmd = "make GO_BUILD_DEV=1 build-backend" +exclude_regex = ["_test.go", "_gen.go"] +exclude_unchanged = true +follow_symlink = true +include_dir = ["apps", "conf", "devenv/dev-dashboards", "pkg", "public/views"] +include_ext = ["go", "ini", "toml", "html", "json"] +pre_cmd = ["make gen-go", "make gen-jsonnet"] +rerun_delay = 1000 +stop_on_error = true + +[log] +time = true + +[misc] +clean_on_exit = false + +[proxy] +enabled = false + +[screen] +clear_on_rebuild = false +keep_scroll = true diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 45237e07fb9..e8b8b63c53d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -68,6 +68,7 @@ /scripts/go-workspace @grafana/grafana-app-platform-squad /scripts/ci/backend-tests @grafana/grafana-operator-experience-squad /hack/ @grafana/grafana-app-platform-squad +/.air.toml @macabu /pkg/apis/provisioning @grafana/grafana-git-ui-sync-team /public/app/features/provisioning @grafana/grafana-git-ui-sync-team diff --git a/Makefile b/Makefile index 837c794858c..97d6da04774 100644 --- a/Makefile +++ b/Makefile @@ -266,6 +266,10 @@ run-go: ## Build and run web server immediately. run-frontend: deps-js ## Fetch js dependencies and watch frontend for rebuild yarn start +.PHONY: run-air +run-air: ## [Experimental] Build and run backend, and watch for changes. See .air.toml for configuration. Check https://github.com/air-verse/air for installation instructions. + air -c .air.toml + ##@ Testing .PHONY: test-go