Fixes and add presubmit (#166)
* Fix Bazel build and add presubmit checks
Fixes a variable name and adds Bazel presubmit checks to ensure the
Bazel build stays healthy.
* Remove Windows from presubmit checks for now
MSVC is tripping up on statement expressions in timer.h.
diff --git a/.bazelignore b/.bazelignore
new file mode 100644
index 0000000..dd2e8d2
--- /dev/null
+++ b/.bazelignore
@@ -0,0 +1 @@
+lib/pico-sdk
diff --git a/.github/workflows/bazel_build.yml b/.github/workflows/bazel_build.yml
new file mode 100644
index 0000000..2e775c7
--- /dev/null
+++ b/.github/workflows/bazel_build.yml
@@ -0,0 +1,36 @@
+name: Bazel presubmit checks
+
+on:
+ push:
+ pull_request:
+
+jobs:
+ bazel-build-check:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - name: Get Bazel
+ uses: bazel-contrib/setup-bazel@0.9.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: Fetch latest Pico SDK
+ uses: actions/checkout@v4
+ with:
+ repository: raspberrypi/pico-sdk
+ ref: develop
+ fetch-depth: 0
+ path: lib/pico-sdk
+ - name: Bazel Picotool with develop pico-sdk
+ run: bazel build @picotool//:picotool --override_module=pico-sdk=lib/pico-sdk
diff --git a/BUILD.bazel b/BUILD.bazel
index a5c0411..d120f50 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -81,7 +81,7 @@
],
}),
defines = [
- 'PICOTOOL_VERSION=\\"{}\\"'.format(PICOTOOL_VERSION_STRING),
+ 'PICOTOOL_VERSION=\\"{}\\"'.format(PICOTOOL_SDK_VERSION_STRING),
'SYSTEM_VERSION=\\"host\\"',
'COMPILER_INFO=\\"local\\"',
"SUPPORT_A0=0",