9696 - name : Install zig and cargo-zigbuild
9797 run : pip3 install ziglang==0.11.0 cargo-zigbuild==0.17.1
9898
99+ - name : Force Cargo to create the target directory
100+ # Run `cargo clean` with an empty package name to force it to create the target directory
101+ # This fails because there is no package with an empty name, but the target directory is created
102+ # See https://github.com/rust-lang/cargo/issues/12441
103+ # This is needed because `cargo-zigbuild` sometimes (wrongly) creates the target directory
104+ # See https://github.com/rust-cross/cargo-zigbuild/issues/165
105+ run : cargo clean -p '' --target ${{ matrix.arch }}-unknown-linux-gnu || true
106+
99107 - name : Build the binary
100108 run : |
101109 cargo zigbuild \
@@ -163,6 +171,14 @@ jobs:
163171 - name : Download the macOS SDK
164172 run : curl -L "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz" | tar -J -x -C /opt
165173
174+ - name : Force Cargo to create the target directory
175+ # Run `cargo clean` with an empty package name to force it to create the target directory
176+ # This fails because there is no package with an empty name, but the target directory is created
177+ # See https://github.com/rust-lang/cargo/issues/12441
178+ # This is needed because `cargo-zigbuild` sometimes (wrongly) creates the target directory
179+ # See https://github.com/rust-cross/cargo-zigbuild/issues/165
180+ run : cargo clean -p '' --target ${{ matrix.arch }}-apple-darwin || true
181+
166182 - name : Build the binary
167183 run : |
168184 cargo zigbuild \
@@ -172,13 +188,6 @@ jobs:
172188 --features dist \
173189 -p mas-cli
174190
175- - name : Create CACHEDIR.TAG files
176- # This is a workaround for `cargo-zigbuild` not creating the CACHEDIR.TAG files
177- # https://github.com/rust-cross/cargo-zigbuild/issues/165
178- run : |
179- touch target/CACHEDIR.TAG
180- touch target/${{ matrix.arch }}-apple-darwin/CACHEDIR.TAG
181-
182191 - name : Download the artifacts
183192184193 with :
0 commit comments