portability: Run the lint suite on macOS and Windows - #14705
atharvaHJoshi wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Re-pushing to re-trigger CLA check |
|
Is the intent here to allow someone developing gVisor natively on macOS/Windows to run the linter locally? That would be fine, but I think running lints on all three OSes in GitHub Actions is overkill, right? I can't imagine clang-format gives different results on different platforms. |
|
Linters are too much in flux for this to make sense yet. Please rebase next week where the linters will actually start being enforced. |
Rebase the cross-platform lint run onto the current enforced-linter
baseline and rework the portability layer on top of it.
tools/lint.sh now detects the host OS and architecture instead of
hardcoding Linux:
- Downloads actionlint, buildifier, and clang-format binaries and
wheels for Linux, macOS, and Windows (both amd64 and arm64 where
published), with per-platform checksums.
- clang-tidy remains Linux-only (its compile_commands.json database
is produced by Bazel).
- Fixes platform-specific tooling assumptions: sha256sum -> shasum
on macOS, nproc -> sysctl / NUMBER_OF_PROCESSORS, GNU-only
xargs -d '\n', and unzip -> Python zipfile on Windows.
- Handles .exe suffixes and skips chmod'ing on Windows.
- Locates Python 3 through a python3/python fallback.
The lint job runs on an ubuntu/macos/windows matrix and calls
'tools/lint.sh' directly with the bash shell, since Windows runners
have neither make nor a POSIX default shell. It also forces
core.autocrlf=false before checkout: GitHub Windows runners default
autocrlf to true, which would check out every tracked file as CRLF
and fail every formatting check.
4cc5060 to
71bf5ae
Compare
|
Rebased onto current @relkochta — intent. It's not (primarily) about running the linters locally on macOS/Windows; it's CI coverage. @EtiennePerot — "do the linters do anything different across platforms?" After rebasing I found the answer is now yes, in a sense that makes this worth doing, plus one genuine content-level difference:
So: the lint rules are identical everywhere, but the runner plumbing differs per platform (checksums, I verified the full suite passes on Linux locally, and validated the Darwin/Windows install paths (download → checksum → extract → rename) with a mocked |
Extends
tools/lint.shand theLintworkflow so the source-level checks run on macOS and Windows, not just Ubuntu.tools/lint.sh: detects host OS/arch (Linux, macOS, Windows via Git Bash/MSYS2/Cygwin; x86_64 + arm64) and fetches the matchingactionlint,buildifier, andclang-formatassets with pinned SHA256 checksums for every OS+arch combination.sha256_of()handlessha256sumvsshasum -a 256;xargs -0for the codespell pipeline;extract_archive()andmake_executable()helpers..github/workflows/lint.yml: matrix overubuntu-latest,macos-latest,windows-latestrunningbash tools/lint.sh.Verified: full suite passes on Linux (x86_64) natively and inside a real
linux/arm64QEMU container (all four checks PASS); fresh-cache downloads of every darwin/windows asset checksum-validated; workflow itself passesactionlint.