Skip to content

Commit e6018b7

Browse files
authored
add a ci job for the tests (#19)
1 parent 18b0385 commit e6018b7

File tree

4 files changed

+55
-4
lines changed

4 files changed

+55
-4
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: ci
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
workflow_dispatch:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
# Cancels a previous run if a new commit is made on the same pull request
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
19+
jobs:
20+
build:
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest, macos-latest, windows-latest]
24+
25+
runs-on: ${{ matrix.os }}
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Bazel
32+
uses: bazel-contrib/setup-bazel@0.14.0
33+
with:
34+
bazelisk-cache: true
35+
disk-cache: ${{ github.workflow }}
36+
repository-cache: true
37+
38+
- name: Bazel tests
39+
run: bazel test src:all

WORKSPACE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,9 @@ git_repository(
5959
remote = "https://github.com/nlohmann/json.git",
6060
shallow_since = "1701207391 +0100",
6161
)
62+
63+
http_archive(
64+
name = "platforms",
65+
urls = ["https://github.com/bazelbuild/platforms/archive/refs/tags/0.0.6.zip"],
66+
strip_prefix = "platforms-0.0.6",
67+
)

src/BUILD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@ OPT_COPTS = select({
2727
"-fno-fast-math",
2828
"-flto",
2929
"-march=native",
30-
"-mmacosx-version-min=10.15"
3130
],
3231
":debug": ["-Og"],
33-
}) + ["-std=c++20"]
32+
}) + select({
33+
"@platforms//os:windows": ["/std:c++20"],
34+
"//conditions:default": ["-std=c++20"],
35+
}) + select({
36+
"@platforms//os:macos": ["-mmacosx-version-min=10.15"],
37+
"//conditions:default": [],
38+
})
3439

3540
OPT_LINKOPTS = select({
3641
"//conditions:default": [
@@ -100,7 +105,8 @@ cc_test(
100105
name = "tesseract_tests",
101106
timeout = "eternal",
102107
srcs = ["tesseract.test.cc"],
103-
tags = ["exclusive"],
108+
copts = OPT_COPTS,
109+
linkopts = OPT_LINKOPTS,
104110
deps = [
105111
":libsimplex",
106112
":libtesseract",

src/tesseract.test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ bool simplex_test_compare(stim::DetectorErrorModel& dem,
8080

8181
TEST(tesseract, Tesseract_simplex_test) {
8282
for (float p_err : {0.001, 0.003, 0.005}) {
83-
for (size_t distance : {3, 5, 7}) {
83+
for (size_t distance : {3, 5}) {
8484
for (const size_t num_rounds : {2, 5, 10}) {
8585
const size_t num_shots = 1000 / num_rounds / distance;
8686
std::cout << "p_err = " << p_err << " distance = " << distance

0 commit comments

Comments
 (0)