From 7445472ba3aeb8488ea80a97966cc55b215241af Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 09:16:38 +0000 Subject: [PATCH 01/11] Added windows and new gcc versions to release checks. --- .bcr/presubmit.yml | 6 ++++-- .github/workflows/main.yml | 10 ++++++++-- CHANGELOG.md | 2 ++ bazelmod/llvm.20.1.0.MODULE.bazel | 22 +--------------------- bazelmod/llvm.MODULE.bazel | 7 +------ 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml index 5d004e8..47fe577 100644 --- a/.bcr/presubmit.yml +++ b/.bcr/presubmit.yml @@ -3,8 +3,10 @@ matrix: - 7.x - 8.x platform: - - ubuntu2404 - - macos + - debian11 + - ubuntu2404 + - macos + - windows tasks: verify_targets: name: Verify build targets diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 76ec374..b922e59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,10 +18,10 @@ jobs: secrets: inherit strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, windows] bazel_mode: [bzlmod, workspace] compiler: [gcc] - gcc_version: [11, 12, 13] + gcc_version: [11, 12, 13, 14, 15] bazel_config: [cpp23, opt] proto_version: ['30.0'] exclude: @@ -29,10 +29,16 @@ jobs: gcc_version: 11 - bazel_mode: workspace gcc_version: 13 + - bazel_mode: workspace + gcc_version: 14 + - bazel_mode: workspace + gcc_version: 15 - bazel_config: cpp23 gcc_version: 11 - bazel_config: cpp23 gcc_version: 12 + - bazel_config: cpp23 + gcc_version: 13 uses: ./.github/workflows/test.yml with: diff --git a/CHANGELOG.md b/CHANGELOG.md index a4961f8..da28de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # 1.2.1 +* Added windows and new gcc versions to release checks. + # 1.2.0 * Added std::optional variants for file reading. diff --git a/bazelmod/llvm.20.1.0.MODULE.bazel b/bazelmod/llvm.20.1.0.MODULE.bazel index cd3e540..3dfe70d 100644 --- a/bazelmod/llvm.20.1.0.MODULE.bazel +++ b/bazelmod/llvm.20.1.0.MODULE.bazel @@ -13,32 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -bazel_dep(name = "toolchains_llvm", version = "1.3.0") -git_override( - module_name = "toolchains_llvm", - commit = "e831f94a8b7f3a39391f5822adcab8e4d443c03b", # Add more tools by default (#463) - remote = "https://github.com/bazel-contrib/toolchains_llvm", -) +bazel_dep(name = "toolchains_llvm", version = "1.4.0") llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True) llvm.toolchain( name = "llvm_toolchain_llvm", llvm_version = "20.1.0", - sha256 = { - "darwin-aarch64": "2c42ec26ec50c4bf8b95585f762b9d2f5b385d170dee772d9c1d6c9a7190dcef", - "linux-aarch64": "9d1bbf3f6d4d011e3b8b4b585f686bc968474917f37d3b82b4a534f456168c67", - "linux-x86_64": "954ac51498519f6ed9540714fb04bc401f70039b296a8160dd1559be380788d7", - }, - strip_prefix = { - "darwin-aarch64": "LLVM-20.1.0-macOS-ARM64", - "linux-aarch64": "LLVM-20.1.0-Linux-ARM64", - "linux-x86_64": "LLVM-20.1.0-Linux-X64", - }, - urls = { - "darwin-aarch64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.0/LLVM-20.1.0-macOS-ARM64.tar.xz"], - "linux-aarch64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.0/LLVM-20.1.0-Linux-ARM64.tar.xz"], - "linux-x86_64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.0/LLVM-20.1.0-Linux-X64.tar.xz"], - }, ) use_repo(llvm, "llvm_toolchain_llvm") diff --git a/bazelmod/llvm.MODULE.bazel b/bazelmod/llvm.MODULE.bazel index d68674a..dab3ba3 100644 --- a/bazelmod/llvm.MODULE.bazel +++ b/bazelmod/llvm.MODULE.bazel @@ -13,12 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -bazel_dep(name = "toolchains_llvm", version = "1.3.0") -git_override( - module_name = "toolchains_llvm", - commit = "e831f94a8b7f3a39391f5822adcab8e4d443c03b", # Add more tools by default (#463) - remote = "https://github.com/bazel-contrib/toolchains_llvm", -) +bazel_dep(name = "toolchains_llvm", version = "1.4.0") llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm", dev_dependency = True) llvm.toolchain( From 2b7c71b550b77852512e43d3323f0a20df523326 Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 09:19:25 +0000 Subject: [PATCH 02/11] No GCC 15 yet --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b922e59..eefdac5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: os: [ubuntu-latest, windows] bazel_mode: [bzlmod, workspace] compiler: [gcc] - gcc_version: [11, 12, 13, 14, 15] + gcc_version: [11, 12, 13, 14] bazel_config: [cpp23, opt] proto_version: ['30.0'] exclude: @@ -31,8 +31,6 @@ jobs: gcc_version: 13 - bazel_mode: workspace gcc_version: 14 - - bazel_mode: workspace - gcc_version: 15 - bazel_config: cpp23 gcc_version: 11 - bazel_config: cpp23 From 48e0512e9b15e3e7efbf483dcd1c2c2a50ea76a2 Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 09:44:01 +0000 Subject: [PATCH 03/11] Windows is named windows-latest --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++-- README.md | 7 ++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eefdac5..8f9793f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: secrets: inherit strategy: matrix: - os: [ubuntu-latest, windows] + os: [ubuntu-latest] bazel_mode: [bzlmod, workspace] compiler: [gcc] gcc_version: [11, 12, 13, 14] @@ -48,6 +48,28 @@ jobs: module_version: "proto${{ matrix.proto_version }}" module_default: proto30.0 + test-windows: + needs: pre-commit + secrets: inherit + strategy: + matrix: + os: [windows-latest] + bazel_mode: [bzlmod] + compiler: [gcc] + gcc_version: [11, 14] + bazel_config: [opt] + proto_version: ['30.0'] + + uses: ./.github/workflows/test.yml + with: + os: ${{ matrix.os }} + bazel_mode: ${{ matrix.bazel_mode }} + compiler: ${{ matrix.compiler }} + gcc_version: ${{ matrix.gcc_version }} + bazel_config: ${{ matrix.bazel_config }} + module_version: "proto${{ matrix.proto_version }}" + module_default: proto30.0 + test-clang: needs: [pre-commit, test-gcc] secrets: inherit @@ -159,7 +181,7 @@ jobs: module_default: proto30.0 done: - needs: [pre-commit, test-gcc, test-clang, test-bcr] + needs: [pre-commit, test-bcr, test-clang, test-gcc, test-windows] runs-on: ubuntu-latest steps: - name: Done diff --git a/README.md b/README.md index 738074a..6314acf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ This package contains a collection of utilities around Google's [Protocolbuffer](https://github.com/protocolbuffers/protobuf). The functions offered in this packages are widely used across Google's C++ code base and have saved tens of thousands of engineering hours. Some of these functons were originally implemented by the author and later re-implemented or cloned (see below). -The project works with Google's proto library version 27, 28, 29 and 30. Packages are available at [Bazel Central Registry](https://registry.bazel.build/modules/helly25_proto) and [Github](https://github.com/helly25/proto/releases). +The project works with: +* Google's proto library version 27, 28, 29, 30 +* Operating system: MacOS, Ubuntu, Windows +* Compiler: GCC [11, 14], Clang [17.0.4, 20.1.0] + +Packages are available at [Bazel Central Registry](https://registry.bazel.build/modules/helly25_proto) and [Github](https://github.com/helly25/proto/releases). [![Test](https://github.com/helly25/proto/actions/workflows/main.yml/badge.svg)](https://github.com/helly25/proto/actions/workflows/main.yml) From a5e8ecb318c002c5005b108e8c0d872e5aa28e4f Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 09:56:45 +0000 Subject: [PATCH 04/11] Update windows/gcc setup --- .github/workflows/main.yml | 2 +- .github/workflows/test.yml | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8f9793f..ca1c670 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,7 @@ jobs: os: [windows-latest] bazel_mode: [bzlmod] compiler: [gcc] - gcc_version: [11, 14] + gcc_version: ['', 11, 14] bazel_config: [opt] proto_version: ['30.0'] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70a2783..1b9f173 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,11 +66,15 @@ jobs: - uses: actions/checkout@v4 - uses: bazelbuild/setup-bazelisk@v3 - uses: egor-tensin/setup-gcc@v1 - if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != ''}} + if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != '' && !startsWith(inputs.os, 'windows')}} + with: + version: ${{inputs.gcc_version}} + platform: ${{runner.arch}} + - uses: egor-tensin/setup-mingw@v2 + if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != '' && startsWith(inputs.os, 'windows')}} with: version: ${{inputs.gcc_version}} platform: ${{runner.arch}} - - uses: actions/cache/restore@v4 id: cache_restore with: From 65adb65107ee252b4d00cd526ad2bde1539b690a Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 10:02:31 +0000 Subject: [PATCH 05/11] Separate windows build. --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1b9f173..e5005e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -85,7 +85,14 @@ jobs: ${{env.CACHE_KEY_PREFIX}}-refs/heads/main ${{env.CACHE_KEY_PREFIX}} + + - name: Build and Test + if: ${{startsWith(inputs.os, 'windows')}} + run: | + bazel test //... + - name: Build and Test + if: ${{!startsWith(inputs.os, 'windows')}} run: | if [ "${{inputs.compiler}}:${{inputs.gcc_version}}" == "gcc:" ]; then echo "ERROR: When compiler=='gcc', then a valid 'compiler_version' must be given." @@ -153,7 +160,7 @@ jobs: key: ${{env.CACHE_KEY_PREFIX}}-${{github.ref}}-${{github.sha}} - name: Cleanup old caches - if: ${{!startsWith(github.ref, 'refs/tags/') && steps.cache_restore.outputs.cache-hit}} + if: ${{!startsWith(github.ref, 'refs/tags/') && steps.cache_restore.outputs.cache-hit && !startsWith(inputs.os, 'windows')}} run: | set -euo pipefail PREFIX="${{env.CACHE_KEY_PREFIX}}-${{github.ref}}" From 846e8b7a50b867df7488027fa05659a415283628 Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 10:08:08 +0000 Subject: [PATCH 06/11] Next step. --- .github/workflows/main.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ca1c670..79b715d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,7 +56,7 @@ jobs: os: [windows-latest] bazel_mode: [bzlmod] compiler: [gcc] - gcc_version: ['', 11, 14] + gcc_version: [''] bazel_config: [opt] proto_version: ['30.0'] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5005e8..e949315 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,7 +73,7 @@ jobs: - uses: egor-tensin/setup-mingw@v2 if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != '' && startsWith(inputs.os, 'windows')}} with: - version: ${{inputs.gcc_version}} + #version: ${{inputs.gcc_version}} platform: ${{runner.arch}} - uses: actions/cache/restore@v4 id: cache_restore From 273a841e897b711a8d9f1aaacf3bdfc644f48a6d Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 10:22:33 +0000 Subject: [PATCH 07/11] Try forcing shell bash --- .github/workflows/test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e949315..6dbb689 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,12 +87,7 @@ jobs: - name: Build and Test - if: ${{startsWith(inputs.os, 'windows')}} - run: | - bazel test //... - - - name: Build and Test - if: ${{!startsWith(inputs.os, 'windows')}} + shell: bash run: | if [ "${{inputs.compiler}}:${{inputs.gcc_version}}" == "gcc:" ]; then echo "ERROR: When compiler=='gcc', then a valid 'compiler_version' must be given." From 84fc748fb5b1806e81addede322c8d8138a6b784 Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 10:25:02 +0000 Subject: [PATCH 08/11] Try native compiler on windows. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79b715d..e3cb084 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,7 +55,7 @@ jobs: matrix: os: [windows-latest] bazel_mode: [bzlmod] - compiler: [gcc] + compiler: [native] gcc_version: [''] bazel_config: [opt] proto_version: ['30.0'] From b1fa98b58581082cc0118228f2447bf74d779994 Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 10:36:38 +0000 Subject: [PATCH 09/11] Try windows with gcc12 --- .github/workflows/main.yml | 4 ++-- .github/workflows/test.yml | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e3cb084..0c7898b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,8 +55,8 @@ jobs: matrix: os: [windows-latest] bazel_mode: [bzlmod] - compiler: [native] - gcc_version: [''] + compiler: [gcc] + gcc_version: [12] bazel_config: [opt] proto_version: ['30.0'] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6dbb689..edd5821 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,15 +65,14 @@ jobs: steps: - uses: actions/checkout@v4 - uses: bazelbuild/setup-bazelisk@v3 - - uses: egor-tensin/setup-gcc@v1 - if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != '' && !startsWith(inputs.os, 'windows')}} + - uses: egor-tensin/setup-mingw@v2 + if: ${{inputs.compiler == 'gcc' && startsWith(inputs.os, 'windows')}} with: - version: ${{inputs.gcc_version}} platform: ${{runner.arch}} - - uses: egor-tensin/setup-mingw@v2 - if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != '' && startsWith(inputs.os, 'windows')}} + - uses: egor-tensin/setup-gcc@v1 + if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != ''}} with: - #version: ${{inputs.gcc_version}} + version: ${{inputs.gcc_version}} platform: ${{runner.arch}} - uses: actions/cache/restore@v4 id: cache_restore From b0491d02e6b7b50e880fa8c7ac360a20a711d646 Mon Sep 17 00:00:00 2001 From: helly25 Date: Tue, 6 May 2025 10:59:44 +0000 Subject: [PATCH 10/11] Try separate mingw --- .github/workflows/main.yml | 4 ++-- .github/workflows/test.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c7898b..ada7ad1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,8 +55,8 @@ jobs: matrix: os: [windows-latest] bazel_mode: [bzlmod] - compiler: [gcc] - gcc_version: [12] + compiler: [mingw] + gcc_version: [''] bazel_config: [opt] proto_version: ['30.0'] diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index edd5821..6a1a62a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,11 +66,11 @@ jobs: - uses: actions/checkout@v4 - uses: bazelbuild/setup-bazelisk@v3 - uses: egor-tensin/setup-mingw@v2 - if: ${{inputs.compiler == 'gcc' && startsWith(inputs.os, 'windows')}} + if: ${{inputs.compiler == 'mingw' && startsWith(inputs.os, 'windows')}} with: platform: ${{runner.arch}} - uses: egor-tensin/setup-gcc@v1 - if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != ''}} + if: ${{inputs.compiler == 'gcc' && inputs.gcc_version != '' && !startsWith(inputs.os, 'windows')}} with: version: ${{inputs.gcc_version}} platform: ${{runner.arch}} @@ -119,7 +119,7 @@ jobs: elif [ "${{inputs.compiler}}" == "gcc" ]; then export CC=/usr/local/bin/gcc export CXX=/usr/local/bin/g++ - elif [ "${{inputs.compiler}}" == "native" ]; then + elif [ "${{inputs.compiler}}" == "mingw" ] || [ "${{inputs.compiler}}" == "native" ]; then # Use whatever is found! [ -n "${CC}" ] && [ -x "${CC}" ] && echo "CC: $(${CC} --version)" [ -n "${CXX}" ] && [ -x "${CXX}" ] && echo "CXX: $(${CXX} --version)" From 4f89f168aa65ba17934045a78c98fbec42dae06b Mon Sep 17 00:00:00 2001 From: helly25 Date: Wed, 7 May 2025 08:01:13 +0000 Subject: [PATCH 11/11] Try both windows versions mingw and native. --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ada7ad1..2958c7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,13 +55,14 @@ jobs: matrix: os: [windows-latest] bazel_mode: [bzlmod] - compiler: [mingw] + compiler: [mingw, native] gcc_version: [''] bazel_config: [opt] proto_version: ['30.0'] uses: ./.github/workflows/test.yml with: + continue-on-error: true os: ${{ matrix.os }} bazel_mode: ${{ matrix.bazel_mode }} compiler: ${{ matrix.compiler }}