about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml1
-rw-r--r--Makefile5
-rwxr-xr-xci/build-environment.py25
-rw-r--r--flake/devshell.nix8
4 files changed, 38 insertions, 1 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 6c70ff3..2c8d647 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -28,6 +28,7 @@ jobs:
             experimental-features = nix-command flakes
       - run: nix flake check
       - run: nix develop -c echo OK
+      - run: make build-environment
       - run: make all
       - run: ./bin/x509-info github.com
       - run: ./bin/flake-info
diff --git a/Makefile b/Makefile
index 9e28dc2..695c129 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all build-binaries clean
+.PHONY: all build-binaries clean build-environment
 
 all: build-binaries
 
@@ -13,6 +13,9 @@ BINARIES = bin/x509-info bin/flake-info
 
 ALL_BINARIES = $(foreach binary, $(BINARIES), ./$(binary))
 
+build-environment:
+	@./ci/build-environment.py
+
 bin/%:
 	go build -o $@ \
 		-ldflags "-X $(PKG)/internal/version.Version=${VERSION} -X $(PKG)/internal/version.BuildDate=${BUILD_DATE}" \
diff --git a/ci/build-environment.py b/ci/build-environment.py
new file mode 100755
index 0000000..64a827a
--- /dev/null
+++ b/ci/build-environment.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+from shutil import which
+import subprocess
+
+
+def go_version():
+    print("go information:")
+
+    path = which("go")
+    print(f"  path={path}")
+
+    cmd = subprocess.run([path, "version"], capture_output=True, text=True)
+    # output is `go version go1.21.5 darwin/arm64`, we want the version and architecture
+    version = cmd.stdout.rstrip().split()
+    print(f"  version={version[2]}")
+    print(f"  architecture={version[3]}")
+
+
+def main():
+    go_version()
+
+
+if __name__ == "__main__":
+    main()
diff --git a/flake/devshell.nix b/flake/devshell.nix
index 2cdce16..79bb2f9 100644
--- a/flake/devshell.nix
+++ b/flake/devshell.nix
@@ -16,6 +16,8 @@
         packages = with pkgs; [
           (config.treefmt.build.wrapper)
 
+          python3
+
           go_1_21
           gopls
           golangci-lint
@@ -29,6 +31,12 @@
         commands = [
           { package = config.treefmt.build.wrapper; }
           {
+            name = "environment";
+            help = "Print various information from CI";
+            category = "CI";
+            command = "make build-environment";
+          }
+          {
             name = "update";
             help = "Update + Commit the Lock File";
             command = "nix flake update --commit-lock-file";