diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9803f250..b22e9643 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,8 @@ name: Tests on: - push: pull_request: - branches: - - main + push: env: ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16 @@ -15,12 +13,16 @@ 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 + strategy: fail-fast: false matrix: include: - image: 1.6.6-erlang-21.3.8.24-debian-buster-20210902-slim - - image: 1.17.2-erlang-27.0.1-debian-bookworm-20240701-slim + - image: 1.19.3-erlang-28.1.1-debian-bullseye-20251103-slim runs-on: ubuntu-latest container: @@ -28,7 +30,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Hex and Rebar setup run: | @@ -44,6 +46,7 @@ jobs: 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 diff --git a/test/shared/pubsub_test.exs b/test/shared/pubsub_test.exs index fe1c0091..7697f9e8 100644 --- a/test/shared/pubsub_test.exs +++ b/test/shared/pubsub_test.exs @@ -181,7 +181,7 @@ defmodule Phoenix.PubSubTest do @tag registry_size: 2 test "PubSub pool size can be configured separately from the Registry partitions", config do - assert {:duplicate, 2, _} = :ets.lookup_element(config.pubsub, -2, 2) + assert_ets_duplicate_count(config.pubsub, 2) assert :persistent_term.get(config.adapter_name) == {config.adapter_name, :"#{config.adapter_name}_2", :"#{config.adapter_name}_3", :"#{config.adapter_name}_4"} @@ -190,9 +190,20 @@ defmodule Phoenix.PubSubTest do @tag pool_size: 3 test "Registry partitions are configured with the same pool size as PubSub if not specified", config do - assert {:duplicate, 3, _} = :ets.lookup_element(config.pubsub, -2, 2) + assert_ets_duplicate_count(config.pubsub, 3) assert :persistent_term.get(config.adapter_name) == {config.adapter_name, :"#{config.adapter_name}_2", :"#{config.adapter_name}_3"} end + + defp assert_ets_duplicate_count(pubsub, count) do + result = :ets.lookup_element(pubsub, -2, 2) + + case System.otp_release() do + otp when otp >= "28" -> + assert {{:duplicate, :pid}, ^count, _} = result + _ -> + assert {:duplicate, ^count, _} = result + end + end end