diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..331158b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: ci +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +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: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Bazel + uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + + - name: Bazel tests + run: bazel test src:all 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..46de054f 100644 --- a/src/BUILD +++ b/src/BUILD @@ -27,10 +27,15 @@ OPT_COPTS = select({ "-fno-fast-math", "-flto", "-march=native", - "-mmacosx-version-min=10.15" ], ":debug": ["-Og"], -}) + ["-std=c++20"] +}) + select({ + "@platforms//os:windows": ["/std:c++20"], + "//conditions:default": ["-std=c++20"], +}) + select({ + "@platforms//os:macos": ["-mmacosx-version-min=10.15"], + "//conditions:default": [], +}) OPT_LINKOPTS = select({ "//conditions:default": [ @@ -100,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