diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7d6aa3f..c30921f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -113,5 +113,9 @@ jobs: - name: Run tests run: mix test --color + - name: Run Node Sync E2E tests + if: ${{ matrix.main }} + run: mix test.node_sync_e2e + - name: Run Marmot E2E tests run: mix test.marmot_e2e diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c00ad21..d7f1f2d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -89,6 +89,17 @@ jobs: if: steps.deps-cache.outputs.cache-hit != 'true' run: mix deps.get + - name: Check tag matches Mix version + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + run: | + TAG_VERSION="${GITHUB_REF_NAME#v}" + MIX_VERSION="$(mix run --no-start -e 'IO.puts(Mix.Project.config()[:version])' | tail -n 1)" + + if [ "$TAG_VERSION" != "$MIX_VERSION" ]; then + echo "Tag version $TAG_VERSION does not match mix.exs version $MIX_VERSION" + exit 1 + fi + - name: Compile run: mix compile --warnings-as-errors @@ -101,6 +112,9 @@ jobs: - name: Run tests run: mix test --color + - name: Run Node Sync E2E + run: mix test.node_sync_e2e + - name: Run Marmot E2E run: mix test.marmot_e2e diff --git a/README.md b/README.md index 7a55d5d..1f764a8 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,28 @@ ws://localhost:4413/relay --- +## Test suites + +Primary test entrypoints: + +- `mix test` for the ExUnit suite +- `mix test.marmot_e2e` for the Marmot client end-to-end suite +- `mix test.node_sync_e2e` for the two-node relay sync end-to-end suite +- `mix test.node_sync_docker_e2e` for the release-image Docker two-node relay sync suite + +The node-sync harnesses are driven by: + +- [`scripts/run_node_sync_e2e.sh`](./scripts/run_node_sync_e2e.sh) +- [`scripts/run_node_sync_docker_e2e.sh`](./scripts/run_node_sync_docker_e2e.sh) +- [`scripts/node_sync_e2e.exs`](./scripts/node_sync_e2e.exs) +- [`compose.node-sync-e2e.yaml`](./compose.node-sync-e2e.yaml) + +`mix test.node_sync_e2e` runs two real Parrhesia nodes against separate PostgreSQL databases, verifies catch-up and live sync, restarts one node, and verifies persisted resume behavior. `mix test.node_sync_docker_e2e` runs the same scenario against the release Docker image. + +GitHub CI currently runs the non-Docker node-sync e2e on the main Linux matrix job. The Docker node-sync e2e remains an explicit/manual check because it depends on release-image build/runtime fidelity and a working Docker host. + +--- + ## Production configuration ### Minimal setup @@ -283,10 +305,10 @@ mix compile mix release _build/prod/rel/parrhesia/bin/parrhesia eval "Parrhesia.Release.migrate()" -_build/prod/rel/parrhesia/bin/parrhesia foreground +_build/prod/rel/parrhesia/bin/parrhesia start ``` -For systemd/process managers, run the release command in foreground mode. +For systemd/process managers, run the release command with `start`. ### Option B: Nix release package (`default.nix`) diff --git a/mix.exs b/mix.exs index 439d27e..75a3c0d 100644 --- a/mix.exs +++ b/mix.exs @@ -62,6 +62,8 @@ defmodule Parrhesia.MixProject do test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], "test.nak_e2e": ["cmd ./scripts/run_nak_e2e.sh"], "test.marmot_e2e": ["cmd ./scripts/run_marmot_e2e.sh"], + "test.node_sync_e2e": ["cmd ./scripts/run_node_sync_e2e.sh"], + "test.node_sync_docker_e2e": ["cmd ./scripts/run_node_sync_docker_e2e.sh"], bench: ["cmd ./scripts/run_bench_compare.sh"], # cov: ["cmd mix coveralls.lcov"], lint: ["format --check-formatted", "credo"],