Skip to content

Commit 2a2e861

Browse files
authored
CI housekeeping (#203)
Changes: - bump actions/checkout - do not run duplicated jobs on push/pull request at the same time - update test to handle ets result between OTP 28/27 and earlier
1 parent 086e0af commit 2a2e861

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Tests
22

33
on:
4-
push:
54
pull_request:
6-
branches:
7-
- main
5+
push:
86

97
env:
108
ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION: node16
@@ -15,20 +13,24 @@ jobs:
1513
tests:
1614
name: Run tests (${{ matrix.image }})
1715

16+
# prevent workflow jobs run twice on push and pull_request event
17+
# see https://github.com/orgs/community/discussions/57827
18+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
19+
1820
strategy:
1921
fail-fast: false
2022
matrix:
2123
include:
2224
- image: 1.6.6-erlang-21.3.8.24-debian-buster-20210902-slim
23-
- image: 1.17.2-erlang-27.0.1-debian-bookworm-20240701-slim
25+
- image: 1.19.3-erlang-28.1.1-debian-bullseye-20251103-slim
2426

2527
runs-on: ubuntu-latest
2628
container:
2729
image: hexpm/elixir:${{ matrix.image }}
2830

2931
steps:
3032
- name: Checkout
31-
uses: actions/checkout@v4
33+
uses: actions/checkout@v5
3234

3335
- name: Hex and Rebar setup
3436
run: |
@@ -44,6 +46,7 @@ jobs:
4446
key: deps-${{ runner.os }}-${{ matrix.image }}-${{ hashFiles('**/mix.lock') }}
4547
restore-keys: |
4648
deps-${{ runner.os }}-${{ matrix.image }}
49+
4750
- name: Install dependencies
4851
run: mix deps.get --only test
4952

test/shared/pubsub_test.exs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ defmodule Phoenix.PubSubTest do
181181
@tag registry_size: 2
182182
test "PubSub pool size can be configured separately from the Registry partitions",
183183
config do
184-
assert {:duplicate, 2, _} = :ets.lookup_element(config.pubsub, -2, 2)
184+
assert_ets_duplicate_count(config.pubsub, 2)
185185

186186
assert :persistent_term.get(config.adapter_name) ==
187187
{config.adapter_name, :"#{config.adapter_name}_2", :"#{config.adapter_name}_3", :"#{config.adapter_name}_4"}
@@ -190,9 +190,20 @@ defmodule Phoenix.PubSubTest do
190190
@tag pool_size: 3
191191
test "Registry partitions are configured with the same pool size as PubSub if not specified",
192192
config do
193-
assert {:duplicate, 3, _} = :ets.lookup_element(config.pubsub, -2, 2)
193+
assert_ets_duplicate_count(config.pubsub, 3)
194194

195195
assert :persistent_term.get(config.adapter_name) ==
196196
{config.adapter_name, :"#{config.adapter_name}_2", :"#{config.adapter_name}_3"}
197197
end
198+
199+
defp assert_ets_duplicate_count(pubsub, count) do
200+
result = :ets.lookup_element(pubsub, -2, 2)
201+
202+
case System.otp_release() do
203+
otp when otp >= "28" ->
204+
assert {{:duplicate, :pid}, ^count, _} = result
205+
_ ->
206+
assert {:duplicate, ^count, _} = result
207+
end
208+
end
198209
end

0 commit comments

Comments
 (0)