Skip to content

Reuse node, ocaml, and rewatch setup between ci.yml and coverage.yml#8506

Merged
cknitt merged 4 commits into
masterfrom
ci-reuse
Jul 13, 2026
Merged

Reuse node, ocaml, and rewatch setup between ci.yml and coverage.yml#8506
cknitt merged 4 commits into
masterfrom
ci-reuse

Conversation

@cknitt

@cknitt cknitt commented Jul 11, 2026

Copy link
Copy Markdown
Member

Summary

Extract repeated CI environment setup into local composite actions shared by the main CI, coverage, and release workflows.

What changed

  • Add a shared Node setup action that:
    • uses the repository’s configured Node version
    • enables Yarn caching
    • configures the public npm registry
    • installs dependencies with yarn install --immutable
  • Add a shared OCaml setup action that:
    • restores or creates the OPAM environment
    • supports different compiler switches and dependency flags
    • reconstructs cached OPAM environments on Linux, macOS, and Windows
    • only creates shared caches during push workflows
  • Add a shared Rewatch build action that:
    • restores or builds the requested Rust target
    • optionally runs Clippy and unit tests
    • copies the resulting executable into the expected package locations
  • Add a shared Linux system-dependency action.
  • Reuse these actions from ci.yml and coverage.yml.
  • Reuse the Node action from the playground and publishing jobs.

Why

The CI and coverage workflows independently implemented nearly identical Node, Rust, Rewatch, OCaml, and OPAM cache setup. Keeping those copies synchronized was error-prone, particularly around:

  • cache keys and paths
  • Rust toolchain versions and targets
  • OPAM environment restoration
  • Windows-specific OPAM configuration
  • dependency installation flags

Centralizing this setup gives those workflows one implementation while retaining their intentional differences, such as coverage’s additional development dependencies and native Rewatch build.

Behavior

This is intended as a structural refactoring. Existing build, test, coverage, artifact, and publishing behavior remains unchanged.

@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8506

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8506

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8506

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8506

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8506

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8506

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8506

commit: 94707d7

@github-actions

Copy link
Copy Markdown

@cknitt

cknitt commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 94707d726a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt cknitt marked this pull request as ready for review July 12, 2026 14:25
Comment on lines +83 to +85
# Caches created by pull_request runs are scoped to that PR's merge ref
# and cannot seed other PRs or branches. Only pushes create shared caches.
if: steps.cache.outputs.cache-hit != 'true' && github.event_name == 'push'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the only annoying thing with gating on push is that it won't cache if you have an open PR that changes this and then add another commit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but PRs changing this are rather rare, so in most cases PR-scoped caches would be created and stored unnecessarily.

@JonoPrest JonoPrest left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, I really like the refactor 🙌🏼

@cknitt cknitt merged commit 84462ad into master Jul 13, 2026
29 checks passed
@cknitt cknitt deleted the ci-reuse branch July 13, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants