j4rs icon indicating copy to clipboard operation
j4rs copied to clipboard

Using j4rs in Github Actions

Open dickermoshe opened this issue 2 weeks ago • 4 comments

This is most likely not a bug in j4rs, however I'm wondering what can be done to solve this.

Using the default actions-rust-lang/setup-rust-toolchain@v1 github action provides a caching layer which significantly improves the speed of subsequent Github Action runs. This caching is enabled by default

It seems that the jassets folder is not included in this cache. However, this does not trigger a rebuild of the crate. Therefor I'm seeing this error on subsequent runs of CI:

called `Result::unwrap()` on an `Err` value: GeneralError("Can not find jassets directory")

There are 2 approaches here:

  1. Force a rebuild of j4rs if the jassets folder is not found
  2. Manually include the jassets folder in caching.

This has been a pain to debug, so at least this issue will help someone else trying to figure out why their CI is failing. But only after the 2nd run.

dickermoshe avatar Dec 10 '25 14:12 dickermoshe

The relevant caching action https://github.com/Swatinem/rust-cache

dickermoshe avatar Dec 10 '25 14:12 dickermoshe

I believe a good solution would be a small improvement in the j4rs build script, to use the rerun-if-env-changed instruction.

This way, we could force j4rs rebuilding on demand. You could have on your Github action something like:

export J4RS_FORCE_BUILD=$(date)

and the j4rs would be rebuilt and the jassets folder would be recreated.

How does this sound to you?

astonbitecode avatar Dec 12 '25 08:12 astonbitecode

Please, give it a try using the master and let me know.

astonbitecode avatar Dec 12 '25 09:12 astonbitecode

That sounds excellent

On Fri, Dec 12, 2025 at 4:02 AM aston @.***> wrote:

astonbitecode left a comment (astonbitecode/j4rs#156) https://github.com/astonbitecode/j4rs/issues/156#issuecomment-3645568281

Please, give it a try using the master and let me know.

— Reply to this email directly, view it on GitHub https://github.com/astonbitecode/j4rs/issues/156#issuecomment-3645568281, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASDJ626N3L2L5V7CI2GPUHT4BKADLAVCNFSM6AAAAACOT3J2FGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNBVGU3DQMRYGE . You are receiving this because you authored the thread.Message ID: @.***>

dickermoshe avatar Dec 12 '25 13:12 dickermoshe