Skip to content

Caching tailwind build assets in CI #539

Closed
@searls

Description

@searls

I'm here with a simple question: "is it possible to cache the tailwind build in CI?" My brand new app's Tailwind 4 build is quite slow in GitHub Actions and I would like to find a way to avoid paying the piper on every build (actually, twice on every build).

I was just scrutinizing my build time in GitHub Actions and came across this:

$ bin/rails db:test:prepare test test:system
≈ tailwindcss v4.1.4

Done in 9s
Running 47 tests in a single process (parallelization threshold is 50)
Run options: --seed 32133

# Running:

...............................................

Finished in 6.400974s, 7.3426 runs/s, 36.0883 assertions/s.
47 runs, 231 assertions, 0 failures, 0 errors, 0 skips
≈ tailwindcss v4.1.4

Done in 8s
Running 1 tests in a single process (parallelization threshold is 50)
Run options: --seed 604
# Running:
Capybara starting Puma...
* Version 6.6.0, codename: Return to Forever
* Min threads: 0, max threads: 4
* Listening on http://127.0.0.1:39819/
.
Finished in 2.022590s, 0.4944 runs/s, 0.4944 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips

Because both rails test and rails test:system each precompile assets (something I feel like is a bug when the same process is invoking them), I'm getting hit with a particularly expensive compilation step of 9s and then another of 8s. So that's 17 seconds for a test suite that doesn't depend on styles. It stood out to me because locally each build takes on the order of 380ms.

I was thinking that build results might be cached someplace like tmp/cache, but it appears they aren't cached anywhere in development or test? @flavorjones could you shed any light on what my options might be?

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