Skip to content

FileNotFoundError: 'compile_commands.json' in CI #105

Closed
@lalten

Description

@lalten

I'm trying to set up the compile_commands.json generation in GitHub Actions CI to feed it to clang-tidy in the next step. But it looks like this line:

with open('compile_commands.json', 'w') as output_file:

fails if the file does not exist yet:

INFO: Running command line: bazel-bin/external/hedron_compile_commands/refresh_all
>>> Automatically added //external workspace link:
    This link makes it easy for you--and for build tooling--to see the external dependencies you bring in. It also makes your source tree have the same directory structure as the build sandbox.
    It's a win/win: It's easier for you to browse the code you use, and it eliminates whole categories of edge cases for build tooling.
>>> Analyzing commands used in @//...
>>> Finished extracting commands for @//...
Traceback (most recent call last):
  File "/github/home/.cache/bazel/_bazel_root/284f8c6ca1cf5fd7f4e20c15176f40/execroot/repo/bazel-out/k8-fastbuild/bin/external/hedron_compile_commands/refresh_all.runfiles/hedron_compile_commands/refresh_all.py", line 1060, in <module>
    with open('compile_commands.json', 'w') as output_file:
FileNotFoundError: [Errno 2] No such file or directory: 'compile_commands.json'
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions