Issue generating docs in Github Workflow

See here for the failing action: ci(docs): try with mlugg/setup-zig action · DoubleWord-Labs/bbcodez@bfc4170 · GitHub

It is a simple GitHub Workflow that runs zig build docs

I have the exact same workflow over at GitHub - byterix-labs/conduit-z

Run zig build docs
docs
+- install generated/
   +- zig build-lib bbcodez Debug native 1 errors
error: unable to open directory '/home/runner/.cache/zig/b/19eb8400ec3447d1c5917ed1a0ab8db4': FileNotFound
error: the following command failed with 1 compilation errors:
/opt/hostedtoolcache/zig/0.14.1/x64/zig build-lib /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib/bbcpputils.cpp /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib/BBDocument.cpp /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib/bbcpp_c.cpp -ODebug -I /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib --dep bbcpp -Mroot=/home/runner/work/bbcodez/bbcodez/src/root.zig -ODebug -Mbbcpp=/home/runner/.cache/zig/o/bfbde050b1777efa50962314eb7e6a59/bbcpp_c.zig -lc++ -lc -femit-docs --cache-dir /home/runner/.cache/zig --global-cache-dir /home/runner/.cache/zig --name bbcodez -static --zig-lib-dir /opt/hostedtoolcache/zig/0.14.1/x64/lib/ --listen=- 
Build Summary: 1/4 steps succeeded; 1 failed
docs transitive failure
+- install generated/ transitive failure
   +- zig build-lib bbcodez Debug native 1 errors
error: the following build command failed with exit code 1:
/home/runner/.cache/zig/o/b6b198488b30060f1edd332cef9bdc45/build /opt/hostedtoolcache/zig/0.14.1/x64/zig /opt/hostedtoolcache/zig/0.14.1/x64/lib /home/runner/work/bbcodez/bbcodez /home/runner/.cache/zig /home/runner/.cache/zig --seed 0x62b3d9dc -Zdc0899da3d0bd03a docs

The only interesting thing about this project is that it is building a C++ dependency with C headers that I wrote.

I should note that zig build docs runs fine locally, even when I nuked ~/.cache/zig, ./.zig-cache and zig-out/

There’s something weird with cache handling in the mlugg/setup-zig GH Action, but I’m not sure if that’s the problem you’re seeing - usually the problem already manifests earlier during the Zig installation.

One thing you could try is use the goto-bus-stop/setup-zig@v2 action, that’s what I usually do when the mlugg extension breaks, then after a while I switch back to mlugg/setup-zig which then usually works (thinking the problem had been fixed) until at some later point it doesn’t work again :slight_smile: - in general, the goto-bus-stop extension has been much more robust even though it’s deprecated.

PS: your problem indeed looks similar: Failing builds on Windows since recently. · Issue #26 · mlugg/setup-zig · GitHub (it doesn’t happen only on Windows as I suspected first - and in case of this bug the problem also only manifested during the build, not during installation, e.g. similar to what you’re seeing).

PPS: yeah, on Linux the error looks exactly like yours:

docs
+- install generated to docs/sources.tar
   +- install generated/
      +- run fixdoctar (sources.tar)
         +- zig build-lib sokol Debug native 1 errors
error: unable to open directory '/home/runner/.cache/zig/b/3931e6c8a7d1843e67e992e008eaf67c': FileNotFound
error: the following command failed with 1 compilation errors:

@mlugg you may be interested to see this

I was using mise before. See here: ci(docs): run build first · DoubleWord-Labs/bbcodez@6f48d64 · GitHub

I just tried your suggestion and it didn’t work. However there is verbose output now:

docs
+- install generated/
   +- zig build-lib bbcodez Debug native 1 errors
error: unable to open directory '/home/runner/.cache/zig/b/19eb8400ec3447d1c5917ed1a0ab8db4': FileNotFound
error: the following command failed with 1 compilation errors:
/opt/hostedtoolcache/zig/0.14.1/x64/zig build-lib /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib/bbcpputils.cpp /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib/BBDocument.cpp /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib/bbcpp_c.cpp -ODebug -I /home/runner/.cache/zig/p/N-V-__8AAIDCAQBp9Jk5jeFXRkB09sNlIVtqQRNYuIXV5mf9/lib --dep bbcpp -Mroot=/home/runner/work/bbcodez/bbcodez/src/root.zig -ODebug -Mbbcpp=/home/runner/work/bbcodez/bbcodez/.zig-cache/o/efebe8d31fcd5a0fa19501bff6fc328d/bbcpp_c.zig -lc++ -lc -femit-docs --cache-dir /home/runner/work/bbcodez/bbcodez/.zig-cache --global-cache-dir /home/runner/.cache/zig --name bbcodez -static --zig-lib-dir /opt/hostedtoolcache/zig/0.14.1/x64/lib/ --listen=- 
Build Summary: 1/4 steps succeeded; 1 failed
docs transitive failure
+- install generated/ transitive failure
   +- zig build-lib bbcodez Debug native 1 errors
error: the following build command failed with exit code 1:
/home/runner/work/bbcodez/bbcodez/.zig-cache/o/8ebe13ed32be6748430f9e333fa7ebde/build /opt/hostedtoolcache/zig/0.14.1/x64/zig /opt/hostedtoolcache/zig/0.14.1/x64/lib /home/runner/work/bbcodez/bbcodez /home/runner/work/bbcodez/bbcodez/.zig-cache /home/runner/.cache/zig --seed 0x9188794b -Z4b823b5949f3b302 docs

It has to have something to do with caching/building the C++ project.

OP’s issue looks like a simple compiler bug, particularly since it repros with goto-bus-stop/setup-zig too.

@floooh – I missed that you commented on the setup-zig issue after it was closed, apologies for that. Looking at the issue again, I think it is extremely likely that the issues you were seeing were caused by some known cache bugs in 0.14.0 which were fixed in 0.14.1. Please try switching back to mlugg/setup-zig@v2 targeting 0.14.1 (by the way, in setup-zig v2 you can omit the version: and it’ll take it from your build.zig.zon instead, so you might want to do that if you up the minimum_zig_version in that file to 0.14.1). I am fairly confident that you won’t encounter the issue again. If you do, then:

  • I’d appreciate a new issue being opened on setup-zig; unfortunately the old logs have expired so I can’t do any further investigation with those, but as I mention, they look reminiscent of known bugs which are now fixed.
  • You can set use-cache: false in the Action’s options in your workflow to disable caching of the Zig cache directory between runs if this continues to be a problem. Please don’t do this unless you do actually see the problem again – I’d really like to know if the issue still exists!
6 Likes

Will do! Thanks for the heads up (especially about taking the version from build.zig.zon)

3 Likes