From 3f9841a434ebbc04fe72dddf0e2fd2956d9d5539 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 5 Feb 2026 16:25:14 -0500 Subject: [PATCH 1/6] fix: use :peer for cluster tests This is logging a warning on Elixir 1.19.3 --- test/support/cluster.ex | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/test/support/cluster.ex b/test/support/cluster.ex index 85892854..b1bae093 100644 --- a/test/support/cluster.ex +++ b/test/support/cluster.ex @@ -9,17 +9,23 @@ defmodule Phoenix.PubSub.Cluster do # Turn node into a distributed node with the given long name :net_kernel.start([:"primary@127.0.0.1"]) - # Allow spawned nodes to fetch all code from this node - :erl_boot_server.start([]) - allow_boot to_charlist("127.0.0.1") - nodes |> Enum.map(&Task.async(fn -> spawn_node(&1) end)) |> Enum.map(&Task.await(&1, 30_000)) end defp spawn_node({node_host, opts}) do - {:ok, node} = :slave.start(to_charlist("127.0.0.1"), node_name(node_host), inet_loader_args()) + cookie = :erlang.get_cookie() + + {:ok, _peer, node} = + :peer.start(%{ + name: node_name(node_host), + host: ~c"127.0.0.1", + env: [{~c"ERL_AFLAGS", ~c"-setcookie #{cookie}"}] + }) + + # Ensure bidirectional connection + true = Node.connect(node) add_code_paths(node) transfer_configuration(node) ensure_applications_started(node) @@ -34,15 +40,6 @@ defmodule Phoenix.PubSub.Cluster do :rpc.block_call(node, module, function, args) end - defp inet_loader_args do - to_charlist("-loader inet -hosts 127.0.0.1 -setcookie #{:erlang.get_cookie()}") - end - - defp allow_boot(host) do - {:ok, ipv4} = :inet.parse_ipv4_address(host) - :erl_boot_server.add_slave(ipv4) - end - defp add_code_paths(node) do rpc(node, :code, :add_paths, [:code.get_path()]) end From a9d5d957ee3c39dc4b6238ba451e81cae949b053 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 5 Feb 2026 16:45:47 -0500 Subject: [PATCH 2/6] Apply suggestion from @davydog187 --- test/support/cluster.ex | 1 - 1 file changed, 1 deletion(-) diff --git a/test/support/cluster.ex b/test/support/cluster.ex index b1bae093..67741e44 100644 --- a/test/support/cluster.ex +++ b/test/support/cluster.ex @@ -24,7 +24,6 @@ defmodule Phoenix.PubSub.Cluster do env: [{~c"ERL_AFLAGS", ~c"-setcookie #{cookie}"}] }) - # Ensure bidirectional connection true = Node.connect(node) add_code_paths(node) transfer_configuration(node) From 1d763aeeaf1cefbf83c6f903d243f0134d6a16a8 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 5 Feb 2026 17:41:32 -0500 Subject: [PATCH 3/6] update CI --- .github/workflows/ci.yml | 111 ++++++++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b22e9643..a1ee3479 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,56 +1,83 @@ -name: Tests +name: CI on: - pull_request: push: - -env: - ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16 - ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + pull_request: + branches: + - main jobs: - tests: - name: Run tests (${{ matrix.image }}) - - # prevent workflow jobs run twice on push and pull_request event - # see https://github.com/orgs/community/discussions/57827 - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + mix_test: + name: mix test (OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}}) strategy: fail-fast: false matrix: include: - - image: 1.6.6-erlang-21.3.8.24-debian-buster-20210902-slim - - image: 1.19.3-erlang-28.1.1-debian-bullseye-20251103-slim + - elixir: 1.15.4 + otp: 25.3 + + - elixir: 1.16.3 + otp: 26.2 + + - elixir: 1.18.4 + otp: 27.3 + + - elixir: 1.19.4 + otp: 28.1 + lint: lint + + # run against latest Elixir to catch warnings early + - elixir: main-otp-28 + otp: maint-28 runs-on: ubuntu-latest - container: - image: hexpm/elixir:${{ matrix.image }} steps: - - name: Checkout - uses: actions/checkout@v5 - - - name: Hex and Rebar setup - run: | - mix local.hex --force - mix local.rebar --force - - - name: Restore deps and _build cache - uses: actions/cache@v4 - with: - path: | - deps - _build - key: deps-${{ runner.os }}-${{ matrix.image }}-${{ hashFiles('**/mix.lock') }} - restore-keys: | - deps-${{ runner.os }}-${{ matrix.image }} - - - name: Install dependencies - run: mix deps.get --only test - - - name: Run tests - run: | - epmd -daemon - mix test + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Restore deps and _build cache + uses: actions/cache@v4 + with: + path: | + deps + _build + key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} + + - name: Install dependencies + run: mix deps.get + + - name: Remove compiled application files + run: mix clean + + - name: Compile dependencies + run: mix compile + if: ${{ !matrix.lint }} + env: + MIX_ENV: test + + - name: Compile & lint dependencies + run: mix compile --warnings-as-errors + if: ${{ matrix.lint }} + env: + MIX_ENV: test + + - name: Check if formatted + run: mix format --check-formatted + if: ${{ matrix.lint }} + env: + MIX_ENV: test + + - name: Run tests + run: | + epmd -daemon + mix test From d6bee323dbc3152e33fc9542001dc8f4a3b42d28 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 5 Feb 2026 17:43:43 -0500 Subject: [PATCH 4/6] remove formatter --- .github/workflows/ci.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1ee3479..fcfee0fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,12 +71,6 @@ jobs: env: MIX_ENV: test - - name: Check if formatted - run: mix format --check-formatted - if: ${{ matrix.lint }} - env: - MIX_ENV: test - - name: Run tests run: | epmd -daemon From 2a83f3af067b91d4cdf201e2b796d444d7e30809 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 5 Feb 2026 18:22:59 -0500 Subject: [PATCH 5/6] Update .github/workflows/ci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Valim --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcfee0fd..b44b9576 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: include: - - elixir: 1.15.4 + - elixir: 1.13.4 otp: 25.3 - elixir: 1.16.3 From 5c388c329012477a6aa31de7721659fb6a9b9d26 Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 5 Feb 2026 18:23:32 -0500 Subject: [PATCH 6/6] 1.13 or higher --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index ab932c8d..bf6cf3df 100644 --- a/mix.exs +++ b/mix.exs @@ -7,7 +7,7 @@ defmodule Phoenix.PubSub.Mixfile do [ app: :phoenix_pubsub, version: @version, - elixir: "~> 1.6", + elixir: "~> 1.13", name: "Phoenix.PubSub", description: "Distributed PubSub and Presence platform", homepage_url: "http://www.phoenixframework.org",