From 37c552e220ab7b5129f019155130c39d03b7b8c4 Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 11:00:20 +0000 Subject: [PATCH 1/8] add a ci job --- .github/ci.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/ci.yml diff --git a/.github/ci.yml b/.github/ci.yml new file mode 100644 index 00000000..535f0cd6 --- /dev/null +++ b/.github/ci.yml @@ -0,0 +1,31 @@ +name: ci +on: + push: + branches: + - master + pull_request: + +defaults: + run: + shell: bash + +# Cancels a previous run if a new commit is made on the same pull request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Bazel + uses: bazelbuild/setup-bazel@v3 + with: + bazel-version: 'latest' + + - name: Bazel tests + run: bazel test src:all From a8ee8fdf101a0418384b8a9d11a3631d9419d4fa Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 15:22:38 +0000 Subject: [PATCH 2/8] move ci.yml to workflows --- .github/{ => workflows}/ci.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/ci.yml (100%) diff --git a/.github/ci.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/ci.yml rename to .github/workflows/ci.yml From 57cc7cf3efd567c99eb82a9c529089a89b214c04 Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 15:23:55 +0000 Subject: [PATCH 3/8] add workflow dispatch trigger --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 535f0cd6..460b81ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: branches: - master pull_request: + workflow_dispatch: defaults: run: From 3c721a4d2454e43c02b068ed126ebe96687b30be Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 15:25:55 +0000 Subject: [PATCH 4/8] debugging ci workflow --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 460b81ee..d5a2a99a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,9 +24,14 @@ jobs: uses: actions/checkout@v4 - name: Set up Bazel - uses: bazelbuild/setup-bazel@v3 + uses: bazel-contrib/setup-bazel@0.14.0 with: - bazel-version: 'latest' + # 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 - name: Bazel tests run: bazel test src:all From fec8a3171d3c5fd104d02794b3b579f13030d3ce Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 15:38:39 +0000 Subject: [PATCH 5/8] update ci job --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5a2a99a..331158b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true + jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} steps: - name: Checkout repository @@ -26,11 +31,8 @@ jobs: - name: Set up Bazel uses: bazel-contrib/setup-bazel@0.14.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 - name: Bazel tests From 02f515498e18debb574f68a35d6d8e9dc476bfc9 Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 15:38:49 +0000 Subject: [PATCH 6/8] use platforms for macos fix --- WORKSPACE | 6 ++++++ src/BUILD | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 7a56fd70..4a53785b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -59,3 +59,9 @@ git_repository( remote = "https://github.com/nlohmann/json.git", shallow_since = "1701207391 +0100", ) + +http_archive( + name = "platforms", + urls = ["https://github.com/bazelbuild/platforms/archive/refs/tags/0.0.6.zip"], + strip_prefix = "platforms-0.0.6", +) diff --git a/src/BUILD b/src/BUILD index e5564c35..5ff6ba8a 100644 --- a/src/BUILD +++ b/src/BUILD @@ -27,10 +27,12 @@ OPT_COPTS = select({ "-fno-fast-math", "-flto", "-march=native", - "-mmacosx-version-min=10.15" ], ":debug": ["-Og"], -}) + ["-std=c++20"] +}) + ["-std=c++20"] + select({ + "@platforms//os:macos": ["-mmacosx-version-min=10.15"], + "//conditions:default": [], +}) OPT_LINKOPTS = select({ "//conditions:default": [ From 467be617b981191269938ba49dae3ebbbaf1f173 Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Wed, 2 Apr 2025 15:48:12 +0000 Subject: [PATCH 7/8] attempt to fix windows build --- src/BUILD | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/BUILD b/src/BUILD index 5ff6ba8a..80370e70 100644 --- a/src/BUILD +++ b/src/BUILD @@ -29,7 +29,10 @@ OPT_COPTS = select({ "-march=native", ], ":debug": ["-Og"], -}) + ["-std=c++20"] + select({ +}) + select({ + "@platforms//os:windows": ["/std:c++20"], + "//conditions:default": ["-std=c++20"], +}) + select({ "@platforms//os:macos": ["-mmacosx-version-min=10.15"], "//conditions:default": [], }) From c918678f237f193fd6ec0694e3d8dfa8ec0d4688 Mon Sep 17 00:00:00 2001 From: Noah Shutty Date: Fri, 18 Apr 2025 18:35:08 +0000 Subject: [PATCH 8/8] reduce the test durations --- src/BUILD | 3 ++- src/tesseract.test.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/BUILD b/src/BUILD index 80370e70..46de054f 100644 --- a/src/BUILD +++ b/src/BUILD @@ -105,7 +105,8 @@ cc_test( name = "tesseract_tests", timeout = "eternal", srcs = ["tesseract.test.cc"], - tags = ["exclusive"], + copts = OPT_COPTS, + linkopts = OPT_LINKOPTS, deps = [ ":libsimplex", ":libtesseract", diff --git a/src/tesseract.test.cc b/src/tesseract.test.cc index c51bc47b..b70ac5fe 100644 --- a/src/tesseract.test.cc +++ b/src/tesseract.test.cc @@ -80,7 +80,7 @@ bool simplex_test_compare(stim::DetectorErrorModel& dem, TEST(tesseract, Tesseract_simplex_test) { for (float p_err : {0.001, 0.003, 0.005}) { - for (size_t distance : {3, 5, 7}) { + for (size_t distance : {3, 5}) { for (const size_t num_rounds : {2, 5, 10}) { const size_t num_shots = 1000 / num_rounds / distance; std::cout << "p_err = " << p_err << " distance = " << distance