Skip to content

Commit c462b1d

Browse files
authored
Test against the latest Phoenix versions on CI (#111)
In PR #93, it looks like we omitted the Phoenix versions, so it now always tested against version 1.4. This adds back testing against different versions of Phoenix. Fix issues I encountered when adding these different versions.
1 parent 4cd924d commit c462b1d

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626

2727
lint_format:
2828
runs-on: ubuntu-latest
29+
env:
30+
PHOENIX_VERSION: "~> 1.7.0"
2931
steps:
3032
- name: Set up Erlang and Elixir
3133
uses: erlef/setup-beam@v1
@@ -39,6 +41,8 @@ jobs:
3941

4042
lint_credo:
4143
runs-on: ubuntu-latest
44+
env:
45+
PHOENIX_VERSION: "~> 1.7.0"
4246
steps:
4347
- name: Set up Erlang and Elixir
4448
uses: erlef/setup-beam@v1
@@ -54,6 +58,8 @@ jobs:
5458

5559
lint_compile:
5660
runs-on: ubuntu-latest
61+
env:
62+
PHOENIX_VERSION: "~> 1.7.0"
5763
steps:
5864
- name: Set up Erlang and Elixir
5965
uses: erlef/setup-beam@v1
@@ -69,6 +75,8 @@ jobs:
6975

7076
lint_dialyzer:
7177
runs-on: ubuntu-latest
78+
env:
79+
PHOENIX_VERSION: "~> 1.7.0"
7280
steps:
7381
- name: Set up Erlang and Elixir
7482
uses: erlef/setup-beam@v1
@@ -101,23 +109,34 @@ jobs:
101109
- 27.x
102110
- 26.x
103111
- 25.x
112+
phoenix:
113+
- "~> 1.6.0"
114+
- "~> 1.7.0"
104115
include:
105116
- elixir: main
106117
otp: 27.x
118+
phoenix: "~> 1.7.0"
107119
- elixir: latest
108120
otp: 27.x
121+
phoenix: "~> 1.7.0"
109122
- elixir: 1.16.x
110123
otp: 26.x
124+
phoenix: "~> 1.7.0"
111125
- elixir: 1.15.x
112126
otp: 26.x
127+
phoenix: "~> 1.7.0"
113128
- elixir: 1.14.x
114129
otp: 25.x
130+
phoenix: "~> 1.6.0"
115131
- elixir: 1.13.x
116132
otp: 24.x
133+
phoenix: "~> 1.6.0"
117134
- elixir: 1.12.x
118135
otp: 24.x
136+
phoenix: "~> 1.6.0"
119137
- elixir: 1.11.x
120138
otp: 24.x
139+
phoenix: "~> 1.6.0"
121140

122141
steps:
123142
- name: Set up Erlang and Elixir
@@ -129,5 +148,9 @@ jobs:
129148
uses: actions/checkout@v4
130149
- name: Get dependencies
131150
run: mix deps.get
151+
env:
152+
PHOENIX_VERSION: ${{matrix.phoenix}}
132153
- name: Run tests
133154
run: mix test
155+
env:
156+
PHOENIX_VERSION: ${{matrix.phoenix}}

lib/appsignal_phoenix/view.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defmodule Appsignal.Phoenix.View do
2+
require Logger
3+
24
@moduledoc """
35
AppSignal.Phoenix.View instruments template rendering.
46
@@ -40,6 +42,8 @@ defmodule Appsignal.Phoenix.View do
4042

4143
defmacro __before_compile__(_env) do
4244
quote do
45+
require Logger
46+
4347
if Module.defines?(__MODULE__, {:__templates__, 0}) &&
4448
Module.defines?(__MODULE__, {:render, 2}) do
4549
@span Application.compile_env(:appsignal, :appsignal_span, Appsignal.Span)

mix.exs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,19 @@ defmodule Appsignal.Phoenix.MixProject do
5151
_ -> "~> 1.7"
5252
end
5353

54+
phoenix_version =
55+
case {System.get_env("CI"), System.get_env("PHOENIX_VERSION")} do
56+
{"true", nil} ->
57+
raise "PHOENIX_VERSION environment variable must be set on CI"
58+
59+
{_, version} ->
60+
version || "~> 1.7"
61+
end
62+
5463
[
5564
{:appsignal, ">= 2.15.0 and < 3.0.0"},
5665
{:appsignal_plug, ">= 2.1.0 and < 3.0.0"},
57-
{:phoenix, System.get_env("PHOENIX_VERSION", "~> 1.4")},
66+
{:phoenix, phoenix_version},
5867
{:phoenix_html, "~> 2.11 or ~> 3.0 or ~> 4.0", optional: true},
5968
{:phoenix_live_view, phoenix_live_view_version, optional: true},
6069
{:ex_doc, "~> 0.21", only: :dev, runtime: false},

0 commit comments

Comments
 (0)