From 53df0f6f10aef89b1a010aeb7434acf4d30ab823 Mon Sep 17 00:00:00 2001 From: niry1 Date: Thu, 11 Jun 2026 11:28:39 +0300 Subject: [PATCH 1/5] Testing: build-runid and build-url --- .github/workflows/c-cpp.yml | 2 ++ specs/src/generate_build_info.py | 6 ++++++ specs/src/processing/Config.cc | 2 ++ 3 files changed, 10 insertions(+) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 005db0c..75f53c0 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -9,6 +9,8 @@ on: env: SPECS_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} SPECS_BUILD_SOURCE: github + SPECS_BUILD_RUNID: ${{ github.run_id }} + SPECS_BUILD_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID jobs: build-linux: diff --git a/specs/src/generate_build_info.py b/specs/src/generate_build_info.py index 32a2ade..4d574bb 100644 --- a/specs/src/generate_build_info.py +++ b/specs/src/generate_build_info.py @@ -60,6 +60,10 @@ def run_git(name, args): report_success("SPECS_BUILD_SOURCE", build_source) build_number = os.environ.get("SPECS_BUILD_NUMBER", "") report_success("SPECS_BUILD_NUMBER", build_number) +build_runid = os.environ.get("SPECS_BUILD_RUNID", "") +report_success("SPECS_BUILD_RUNID", build_runid) +build_url = os.environ.get("SPECS_BUILD_URL", "") +report_success("SPECS_BUILD_URL", build_url) # Get UTC build time if build_source == "local": @@ -75,5 +79,7 @@ def run_git(name, args): f.write('#define SPECS_BUILD_TIME "{}"\n'.format(build_time)) f.write('#define SPECS_BUILD_SOURCE "{}"\n'.format(build_source)) f.write('#define SPECS_BUILD_NUMBER "{}"\n'.format(build_number)) + f.write('#define SPECS_BUILD_RUNID "{}"\n'.format(build_runid)) + f.write('#define SPECS_BUILD_URL "{}"\n'.format(build_url)) print("Generated utils/build_info.h") diff --git a/specs/src/processing/Config.cc b/specs/src/processing/Config.cc index ca62593..de5301c 100644 --- a/specs/src/processing/Config.cc +++ b/specs/src/processing/Config.cc @@ -224,6 +224,8 @@ void readConfigurationFile(useKeyValueCB cb) ExternalLiterals["build-time"] = dequote(STRINGIFY(SPECS_BUILD_TIME)); ExternalLiterals["build-source"] = dequote(STRINGIFY(SPECS_BUILD_SOURCE)); ExternalLiterals["build-number"] = dequote(STRINGIFY(SPECS_BUILD_NUMBER)); + ExternalLiterals["build-runid"] = dequote(STRINGIFY(SPECS_BUILD_RUNID)); + ExternalLiterals["build-url"] = dequote(STRINGIFY(SPECS_BUILD_URL)); // Compose build-info std::string build_info = "Built "; From caae738b99d6469962221b9d1cfc12b4466ffdbd Mon Sep 17 00:00:00 2001 From: niry1 Date: Thu, 11 Jun 2026 11:40:22 +0300 Subject: [PATCH 2/5] Testing: trying to improve... --- .github/workflows/c-cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 75f53c0..e8bd81d 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -10,7 +10,7 @@ env: SPECS_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }} SPECS_BUILD_SOURCE: github SPECS_BUILD_RUNID: ${{ github.run_id }} - SPECS_BUILD_URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID + SPECS_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} jobs: build-linux: From 5bdb1216118264c7b6e69d2f718c2f406d4fa0f2 Mon Sep 17 00:00:00 2001 From: niry1 Date: Thu, 11 Jun 2026 12:03:57 +0300 Subject: [PATCH 3/5] Testing: now with docs and release.yml --- .github/workflows/c-cpp.yml | 2 +- .github/workflows/release.yml | 12 +++++++----- manpage | 6 +++++- specs/docs/alu.md | 4 +++- specs/docs/onepage.md | 2 ++ specs/src/processing/Config.cc | 5 +++-- specs/src/test/specs-autocomplete.cc | 2 ++ 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index e8bd81d..489d906 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -42,7 +42,7 @@ jobs: run: make all - name: Test specs executable - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: make check working-directory: specs/src diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 58c2e0f..8515af5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,8 @@ env: SPECS_BRANCH: ${{ github.event.release.target_commitish }} SPECS_BUILD_SOURCE: github SPECS_BUILD_NUMBER: ${{ github.run_number }} + SPECS_BUILD_RUNID: ${{ github.run_id }} + SPECS_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} jobs: build-linux: @@ -56,7 +58,7 @@ jobs: run: make some - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare manpage run: | @@ -132,7 +134,7 @@ jobs: run: make some - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare manpage run: | @@ -216,7 +218,7 @@ jobs: run: msbuild specs/specs.sln /p:Configuration=Release /p:Platform=x64 /p:GitTag=${{ steps.version.outputs.display }} - name: Verify binary - run: specs\bin\Release\specs.exe "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare standalone executable shell: bash @@ -302,7 +304,7 @@ jobs: run: msbuild specs/specs.sln /p:Configuration=Release /p:Platform=x64 /p:GitTag=${{ steps.version.outputs.display }} /p:EnablePython=true - name: Verify binary - run: specs\bin\Release\specs.exe "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" + run: specs\bin\Release\specs.exe "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare standalone executable shell: bash @@ -390,7 +392,7 @@ jobs: run: make some - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare manpage run: | diff --git a/manpage b/manpage index 9dd9849..21c6694 100644 --- a/manpage +++ b/manpage @@ -2315,6 +2315,10 @@ or depending on where the build was created. .IP "build-number" 3 contains the build number from GitHub Actions (github.run_number). Empty for local builds. +.IP "build-runid" 3 +contains the 11-digit build id from GitHub Actions (github.run_id). Empty for local builds. +.IP "build-url" 3 +contains the build URL for the GitHub build. Empty for local builds. .IP "build-info" 3 contains a composite string with all build information. For example: .p @@ -2322,7 +2326,7 @@ contains a composite string with all build information. For example: .p or .p - Built on github (build 217) from commit 8bd11da of version 1.0.0 at 2026-06-08T10:01:18 UTC + Built on github (id 27334782912; build 217) from commit 8bd11da of version 1.0.0 at 2026-06-08T10:01:18 UTC .p .SH EXAMPLES diff --git a/specs/docs/alu.md b/specs/docs/alu.md index 373a9fa..2e1b7d5 100644 --- a/specs/docs/alu.md +++ b/specs/docs/alu.md @@ -123,10 +123,12 @@ Build information is also available via the following labels: - `@build-time` — the timestamp when the build was created (format: `yyyy-MM-ddTHH:mm:ss`). It's local time for local builds, or UTC for GitHub builds. - `@build-source` — either `local` or `github` - `@build-number` — the GitHub Actions build number (empty for local builds) +- `@build-runid` — the 11-digit GitHub Actions run id (empty for local builds) +- `@build-url` — the build URL for the GitHub build (Empty for local builds), e.g: [https://github.com/yoavnir/specs2016/actions/runs/27334782912](https://github.com/yoavnir/specs2016/actions/runs/27334782912). - `@build-info` — a composite string with all build information, e.g.: ``` Built locally from commit 8bd11da on branch dev-1.0.0 at 2026-06-08T13:01:18 local - Built on github (build 217) from commit 8bd11da of version 1.0.0 at 2026-06-08T10:01:18 UTC + Built on github (id 27334782912; build 217) from commit 8bd11da of version 1.0.0 at 2026-06-08T10:01:18 UTC ``` Additionally, the `@@` string stands for the entire input record. When rolling context is in effect (see [Streams and Records](streams.md#rolling-context)), `@@` always refers to the original input record. The `@!` string refers to the current record as affected by `CONTEXT`, which is the same as `@@` when no `CONTEXT` is active. The `@-n` and `@+n` syntax is an alternative to using that is effective within expressions. Note that reading beyond the input with `@+n` or `@-n` does not cause processing to stop, even if a `READSTOP` token is present in the specification. The following three specifications are equivalent: diff --git a/specs/docs/onepage.md b/specs/docs/onepage.md index 1a4c903..22387ac 100644 --- a/specs/docs/onepage.md +++ b/specs/docs/onepage.md @@ -205,6 +205,8 @@ There are some pre-configured labels that do not need to be explicitly defined: * build-time - contains the timestamp when the build was created (format: `yyyy-MM-ddTHH:mm:ss`). It's local time for local builds, or UTC for GitHub builds. * build-source - contains either `local` or `github` * build-number - contains the GitHub Actions build number (empty for local builds) +* build-runid - contains the 11-digit GitHub Actions run id (empty for local builds) +* build-url - contains the build URL for the GitHub build (Empty for local builds) * build-info - contains a composite string with all build information Examples diff --git a/specs/src/processing/Config.cc b/specs/src/processing/Config.cc index de5301c..741e71a 100644 --- a/specs/src/processing/Config.cc +++ b/specs/src/processing/Config.cc @@ -230,10 +230,11 @@ void readConfigurationFile(useKeyValueCB cb) // Compose build-info std::string build_info = "Built "; if (ExternalLiterals["build-source"] == "github") { - build_info += "on github"; + build_info += "on github (id " + ExternalLiterals["build-runid"]; if (!ExternalLiterals["build-number"].empty()) { - build_info += " (build " + ExternalLiterals["build-number"] + ")"; + build_info += "; build " + ExternalLiterals["build-number"]; } + build_info += ")"; } else { build_info += "locally"; } diff --git a/specs/src/test/specs-autocomplete.cc b/specs/src/test/specs-autocomplete.cc index 3d695e3..b9a9b11 100644 --- a/specs/src/test/specs-autocomplete.cc +++ b/specs/src/test/specs-autocomplete.cc @@ -19,6 +19,8 @@ StringVector SystemDefinedLabels = { "@build-time", "@build-source", "@build-number", + "@build-runid", + "@build-url", "@build-info" }; From ed17f458a6bda86f66659a03f25af1e8c562036e Mon Sep 17 00:00:00 2001 From: niry1 Date: Thu, 11 Jun 2026 12:19:23 +0300 Subject: [PATCH 4/5] Testing: fix unwanted change in Windows release --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8515af5..08b2a64 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: run: make some - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare manpage run: | @@ -134,7 +134,7 @@ jobs: run: make some - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare manpage run: | @@ -218,7 +218,7 @@ jobs: run: msbuild specs/specs.sln /p:Configuration=Release /p:Platform=x64 /p:GitTag=${{ steps.version.outputs.display }} - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" + run: specs\bin\Release\specs.exe "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare standalone executable shell: bash @@ -392,7 +392,7 @@ jobs: run: make some - name: Verify binary - run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" + run: specs/exe/specs "Version:" 1 "@version" WRITE "Platform:" 1 "@platform" WRITE "Build info:" 1 "@build-info" WRITE "Build URL:" 1 "@build-url" - name: Prepare manpage run: | From 3064fde6366d0102e36ca368f61e5a87b59da2c4 Mon Sep 17 00:00:00 2001 From: niry1 Date: Thu, 11 Jun 2026 12:27:53 +0300 Subject: [PATCH 5/5] Testing: Add Windows support --- specs/src/build_info.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/specs/src/build_info.targets b/specs/src/build_info.targets index 7e1e622..c002637 100644 --- a/specs/src/build_info.targets +++ b/specs/src/build_info.targets @@ -8,6 +8,8 @@ local $(SPECS_BUILD_SOURCE) $(SPECS_BUILD_NUMBER) + $(SPECS_BUILD_RUNID) + $(SPECS_BUILD_URL) @@ -38,6 +40,8 @@ + +