diff --git a/.bazelignore b/.bazelignore index 9c6ed551..b4ebeadb 100644 --- a/.bazelignore +++ b/.bazelignore @@ -4,3 +4,4 @@ out cmake-build-debug third_party +.clwb \ No newline at end of file diff --git a/.github/workflows/bazel-macos.yml b/.github/workflows/bazel-macos.yml index 0736d54b..6ebd6119 100644 --- a/.github/workflows/bazel-macos.yml +++ b/.github/workflows/bazel-macos.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 # This causes build failures # - name: Mount bazel cache # Optional diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 8218b7b0..7e260cc2 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -13,10 +13,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Setup bazel - uses: bazelbuild/setup-bazelisk@v2 + uses: bazel-contrib/setup-bazel@0.18.0 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true # This causes build failures # - name: Mount bazel cache # Optional diff --git a/.github/workflows/cmake-codecov.yml b/.github/workflows/cmake-codecov.yml index 6b970aea..2d040780 100644 --- a/.github/workflows/cmake-codecov.yml +++ b/.github/workflows/cmake-codecov.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - uses: hendrikmuhs/ccache-action@v1.2 @@ -42,8 +42,8 @@ jobs: working-directory: ${{github.workspace}}/build run: | cd test/CMakeFiles/all_tests.dir/ - lcov --directory . --capture -o coverage.info - lcov -r coverage.info */build/* */test/* */c++/* */gtest/* -o coverageFiltered.info - lcov --list coverageFiltered.info + lcov --directory . --capture -o coverage.info --ignore-errors mismatch + lcov -r coverage.info */build/* */test/* */c++/* -o coverageFiltered.info --ignore-errors mismatch + lcov --list coverageFiltered.info --ignore-errors mismatch bash <(curl -s https://codecov.io/bash) -f coverageFiltered.info || echo "Upload failed" diff --git a/.github/workflows/cmake-macos.yml_fails b/.github/workflows/cmake-macos.yml_fails index 9cf466cd..87230d2d 100644 --- a/.github/workflows/cmake-macos.yml_fails +++ b/.github/workflows/cmake-macos.yml_fails @@ -11,7 +11,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 # - uses: hendrikmuhs/ccache-action@v1.2 diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml index 7cf6c607..e72d9f2e 100644 --- a/.github/workflows/cmake-windows.yml +++ b/.github/workflows/cmake-windows.yml @@ -10,7 +10,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - uses: hendrikmuhs/ccache-action@v1.2 diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index de6e9884..b8d6004c 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - uses: hendrikmuhs/ccache-action@v1.2 diff --git a/.github/workflows/codcecov.yml_old b/.github/workflows/codcecov.yml_old deleted file mode 100644 index e5eca13a..00000000 --- a/.github/workflows/codcecov.yml_old +++ /dev/null @@ -1,42 +0,0 @@ -name: Upload CodeCov Report -on: [ push ] -jobs: - run: - runs-on: windows-latest - name: Build, Test , Upload Code Coverage Report - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: ‘2’ - id: checkout_code - - name: Setup MSBuild and add to PATH - uses: microsoft/setup-msbuild@v1.0.2 - id: setup_msbuild - - - name: Generate Solution - run: cmake -G "Visual Studio 17 2022" -A x64 . -DPHTREE_CODE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug - - - name: Run MSBuild - id: run_msbuild - run: msbuild /p:Configuration=Debug /p:Platform=x64 /p:gtest_force_shared_crt=on phtree.sln - - name: Setup VSTest and add to PATH - uses: darenm/Setup-VSTest@v1 - id: setup_vstest - - - name: Setup OpenCppCoverage and add to PATH - id: setup_opencppcoverage - run: | - choco install OpenCppCoverage -y - echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH - - - name: Generate Report - id: generate_test_report - shell: cmd - run: OpenCppCoverage.exe --modules phtree --export_type cobertura:phtree.xml -- "vstest.console.exe" test\Debug\all_tests.exe - - name: Upload Report to Codecov - uses: codecov/codecov-action@v3 - with: - files: ./phtree.xml - fail_ci_if_error: true - functionalities: fix diff --git a/CHANGELOG.md b/CHANGELOG.md index ffb26b27..763e091d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] - Nothing yet +### Changed +- Added support for bazel 8 and 9, thanks to @polasek + [#142](https://github.com/tzaeschke/phtree-cpp/issues/142) + [#161](https://github.com/tzaeschke/phtree-cpp/pull/161) +- Updated build files, new Release How-To with support for bazel central registry (BCR) + [#163](https://github.com/tzaeschke/phtree-cpp/pull/163) + ## [1.6.2] - 2025-03-08 ### Fixed - Fixed links in CHANGELOG and README. [#152](https://github.com/tzaeschke/phtree-cpp/issues/152) diff --git a/MODULE.bazel b/MODULE.bazel index 6609ca3f..4418ca57 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,6 +15,7 @@ bazel_dep(name = "google_benchmark", version = "1.9.5") # Development environment tooling http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") BUILDIFIER_VERSION = "0.29.0" diff --git a/ReleaseHowTo.md b/ReleaseHowTo.md new file mode 100644 index 00000000..5416fb87 --- /dev/null +++ b/ReleaseHowTo.md @@ -0,0 +1,89 @@ + + + + +https://github.com/tzaeschke/phtree-cpp/releases/v1.6.2/download/v1.6.2.tar.gz + + +# Create Release (document WIP) + + +## Verify code + +### Run examples +```shell +bazel run //examples:example +``` + +### Test release with +- test-phtree-cpp-bazel +- test-phtree-cpp-cmake + +### Compilers + +- Test with gcc + clang on Linux +- Test with VisualStudio on Windows +- Update references of tested compilers in README.md + +## Create Archive + +```bash +git archive --format=zip v1.6.2 > phtree-cpp-v1.6.2.zip +``` + +Upload to GitHub release. + +Resulting link: +``` +https://github.com/tzaeschke/phtree-cpp/releases/download/v1.6.2/phtree-cpp-v1.6.2.zip +``` + + +## Bazel Central Repository -- Unfinished documentation + +Documentation: +https://github.com/bazelbuild/bazel-central-registry/blob/main/docs/README.md + + +PH-Tree build target: +``` +bazel build //:phtree +``` + +#### Start + +Checkout personal fork of bazel-central-registry. +Create branch `phtree-cpp@1.6.2`. + +#### After modifying any file + +Recreate hashes for `source.json` +```shell +bazel run -- //tools:update_integrity phtree-cpp +``` + This also accepts `--version` but defaults to latest version. + +#### Validate + +```shell +bazel run -- //tools:bcr_validation --check=phtree-cpp@1.6.2 +``` + +#### Test locally + +```bash +bazel run //tools:setup_presubmit_repos -- --module phtree-cpp@1.6.2 +``` + +There is also a GitHub action for release automation: +https://github.com/bazel-contrib/publish-to-bcr + + +#### Test with Test repos + +Check out `test-phtree-cpp-bazel` and run: + +```shell +bazel shutdown && bazel build --enable_bzlmod --registry="file:///home/.../bazel-central-registry" --lockfile_mode=off @phtree-cpp//:phtree-cpp +--> Target might be incorrect +``` \ No newline at end of file