Skip to content

Conversation

@alco
Copy link
Member

@alco alco commented Dec 12, 2025

Instead of duplicating caching and compilation logic for Electric in TS tests, build a Docker image from sync-service's source code and run it as a Docker container.

In a followup PR I'm going to also use the sync-service Docker container when running Lux integration tests.

One positive outcome from this is that we no longer need a dummy workflow to test that sync-service works when running in a Docker container. It is now implicitly verified by running it in a Docker container in existing workflows.

  • Replace the stub image tag derivation with a proper one that takes into account all files relevant for the Docker image build of sync-service

@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (73d18ec) to head (e6fce26).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3594   +/-   ##
=======================================
  Coverage   88.13%   88.13%           
=======================================
  Files          18       18           
  Lines        1635     1635           
  Branches      411      407    -4     
=======================================
  Hits         1441     1441           
  Misses        192      192           
  Partials        2        2           
Flag Coverage Δ
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/typescript-client 93.80% <ø> (ø)
packages/y-electric 55.66% <ø> (ø)
typescript 88.13% <ø> (ø)
unit-tests 88.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alco alco changed the title Build a Docker image for sync-service to reuse in CI workflows ci: Build a Docker image for sync-service to reuse in CI workflows Dec 13, 2025
@alco alco force-pushed the alco/ci-sync-service-docker-image branch from 88ad47f to 91b6337 Compare December 13, 2025 04:59
@alco alco changed the base branch from main to alco/ci-preconfigured-postgres-image December 13, 2025 05:00
@alco alco force-pushed the alco/ci-sync-service-docker-image branch 8 times, most recently from 2cc21be to 57e1dd1 Compare December 15, 2025 11:49
@alco alco force-pushed the alco/ci-preconfigured-postgres-image branch from c05f543 to 9229b8a Compare December 15, 2025 11:49
alco added a commit that referenced this pull request Dec 15, 2025
Simplify starting a Postgres database on CI. Having a [preconfigured
image available](#3588)
eliminates the need for manual configuration steps inside the CI job.
This will also work great together with
#3594.
Base automatically changed from alco/ci-preconfigured-postgres-image to main December 15, 2025 15:54
alco added a commit that referenced this pull request Dec 15, 2025
…use in CI workflows (#3588)

This serves multiple goals:
- avoid repeating configuration code between CI workflows
- get rid of the need to run `psql` or `docker exec` commands in
addition to defining Postgres as a service in those CI workflows that
need it. See #3600.
- #3594 packages up
sync-service as a Docker image for use in CI. However, it cannot be
easily started as a service if the postgres service needs to be
configured afterwards

In other words, this together with building a Docker image for sync
service to use in CI workflows from the other PR helps avoid redoing
some of the build steps between different CI workflows.
@alco alco force-pushed the alco/ci-sync-service-docker-image branch 3 times, most recently from d7b8cbc to 0cba86a Compare December 15, 2025 23:34
@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit d7b8cbc
🔍 Latest deploy log https://app.netlify.com/projects/electric-next/deploys/69409a940d911e0008f4af48
😎 Deploy Preview https://deploy-preview-3594--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Dec 15, 2025

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit 4eef5c9
🔍 Latest deploy log https://app.netlify.com/projects/electric-next/deploys/6940a1edfd9a8800086d9f52
😎 Deploy Preview https://deploy-preview-3594--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@alco alco force-pushed the alco/ci-sync-service-docker-image branch 6 times, most recently from d5acd25 to 4d08030 Compare December 16, 2025 00:53
@alco alco force-pushed the alco/ci-sync-service-docker-image branch from 4d08030 to 046776c Compare December 16, 2025 00:57
@alco alco force-pushed the alco/ci-sync-service-docker-image branch 2 times, most recently from c8a3975 to a7af5e1 Compare December 16, 2025 10:07
@alco alco force-pushed the alco/ci-sync-service-docker-image branch from a7af5e1 to 143b44e Compare December 16, 2025 10:08
@alco alco marked this pull request as ready for review December 16, 2025 10:13
@alco
Copy link
Member Author

alco commented Dec 16, 2025

I've finished doing CI updates for this PR but there are three TS tests that keep failing consistently. Currently not sure what's causing that.

alco added 2 commits December 16, 2025 11:16
I've already missed the Dockerfile itself by trying to be overly
specific with the paths touched by a commit. Better be safe and take all
the entire contents of the package directory into account when deciding
on rebuilding the Docker image. After all, we have the Docker build
cache to avoid unnecessary rebuilds.
…r in CI

This solves the discrepancy between running Electric from source and via
docker compose.
@alco
Copy link
Member Author

alco commented Dec 16, 2025

I've finished doing CI updates for this PR but there are three TS tests that keep failing consistently. Currently not sure what's causing that.

Figured it out: had to include packages/sync-service/.env.dev in the compose file for Electric because it defines bespoke caching config for the dev env which TS tests rely on.

Copy link
Contributor

@msfstef msfstef left a comment

Choose a reason for hiding this comment

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

Interesting! Is this faster than running it from the Elixir source?

@alco
Copy link
Member Author

alco commented Dec 16, 2025

@msfstef I think performance difference will be negligible.

What this approach gives us is:

  • less book-keeping of sync-service source and deps in TypeScript tests
  • verifying that the Electric runs fine as a Docker container (we had issue with it in the past, that was the reason for creating the "Docker Image Smoketest" workflow)
  • with a few upcoming customizations, the workflow that builds the image can also be used for building public Docker images for Electric

@alco alco merged commit 2cd0210 into main Dec 16, 2025
45 checks passed
@alco alco deleted the alco/ci-sync-service-docker-image branch December 16, 2025 11:19
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.

3 participants