Page MenuHomePhabricator

[BuildKite] Add cmake lint gate
ClosedPublic

Authored by jon on Jul 15 2022, 2:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM
Unknown Object (File)
Fri, Dec 27, 10:54 AM

Details

Summary

Add cmake linting gate

Test Plan

N/A

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Include a change to CMakeLists.txt to trigger gates

Whoa, super cool how easy it is to use NixOS here!! And thank you so much for adding this.

Separately, we consider setting this up for lint-staged and GitHub Actions as well. Can you create tasks for those?

(I think lint-staged is a more important one probably.)

atul requested changes to this revision.Jul 17 2022, 1:44 PM

Fails on the following:

error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

As an aside, are we sure we want to do with this with nix at this point?

I think we should definitely add Nix workflows to the CI with nix build, nix develop, etc... but think it would be best to do this sort of thing on a simple Debian machine like we do with shellcheck (eg https://github.com/CommE2E/comm/blob/master/.buildkite/shellcheck.yml)

If we add Nix workflows to the CI, we'll definitely want to run them on Debian/Ubuntu and macOS to reflect dev/production environment. Nix on Mac seems particularly brittle.

This revision now requires changes to proceed.Jul 17 2022, 1:44 PM

Nix on Mac seems particularly brittle.

This only seems to be the case if they overwrite /etc/zshrc on an update. I agree that is annoying when it does happen. But a good long term solution (e.g. /etc/zshrc.d/) would require support from Apple.

If we add Nix workflows to the CI, we'll definitely want to run them on Debian/Ubuntu and macOS to reflect dev/production environment.

Sounds good

atul requested changes to this revision.Jul 18 2022, 9:34 AM

It's failing on the following:

ERROR Failed to open **/CMakeLists.txt for read
Summary
=======
files scanned: 0
found lint:
 
🚨 Error: The command exited with status 1
This revision now requires changes to proceed.Jul 18 2022, 9:34 AM

The following works and doesn't depend on Nix so it should be easy for developers to run in their own environment:

steps:
  - label: 'cmake-lint'
    command:
      - 'pip install cmakelang'
      - 'shopt -s globstar'
      - 'cmake-lint **/CMakeLists.txt **/*.cmake'
    plugins:
      - docker#v3.13.0:
          image: 'python:bullseye'
          shell: ['/bin/bash', '-e', '-c']
    agents:
      - 'autoscaling=true'

It's failing on the following:

Yea, forgot that most docker instances don't have glob on.

Use atul's python image and instructions

Also, I'm unable to see the build logs in buildkite >.>

In D4548#130123, @jonringer-comm wrote:

Also, I'm unable to see the build logs in buildkite >.>

Do you have a link to where you're running it?

Do you have a link to where you're running it?

I mean, I click the "view in buildkite" link, and it just says, "this doesn't exist"

In D4548#130202, @jonringer-comm wrote:

Do you have a link to where you're running it?

I mean, I click the "view in buildkite" link, and it just says, "this doesn't exist"

Gotcha, looks like the invite expired. Sending another one

This revision is now accepted and ready to land.Jul 18 2022, 5:59 PM

looked through emails and found it. Forgot buildkite has you accept an invitation.

Hmm, I'm seeing @jonringer-comm as "jonathan-ringer@comm.app" in Buildkite when his email is actually "jonathan.ringer@comm.app". A bit confused how he has access...

Hmm, I'm seeing @jonringer-comm as "jonathan-ringer@comm.app" in Buildkite when his email is actually "jonathan.ringer@comm.app". A bit confused how he has access...

No idea, I cut and paste the email from the "Buildkite" cell in the Comm access list doc which had jonathan.ringer@comm.app when I sent the invite

This revision was automatically updated to reflect the committed changes.