Skip to content

Commit

Permalink
Mises à jour techniques (Elixir 1.15, packages Hex...) (#3429)
Browse files Browse the repository at this point in the history
* Bump appsginal, ex_phone_number, hackney, sentry

* Bump dialyxir

* Bump more stuff

* Fix broken test

* Bump ymlr (major but apparently passing)

* Bump phoenix_html yarn package

* Bump more stuff

* Bump Elixir & NodeJS

* Try to fix `function Dialyxir.Output.info/1 is undefined (module Dialyxir.Output is not available)`

* Fix warning

* Try to fix dialyzer error

* Try to fix Dialyzer error

See jeremyjh/dialyxir#508 (comment)

* Mix format (1.15)

* Update phoenix_live_view package

* Fix warnings

* Bump jumper

* Bump unsafe

* Bump sweet_xml

* Bump dialyxir

* Go back to mainstream vex (now fixed)

Fix at:
- CargoSense/vex#68
  • Loading branch information
thbar authored Aug 31, 2023
1 parent 85282f8 commit 1e86025
Show file tree
Hide file tree
Showing 24 changed files with 85 additions and 70 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ default_docker: &default_docker
defaults: &defaults
parameters:
base_image:
default: ghcr.io/etalab/transport-ops:elixir-1.14.5-erlang-24.3.4.13-ubuntu-focal-20230126-transport-tools-1.0.7
default: ghcr.io/etalab/transport-ops:elixir-1.15.5-erlang-24.3.4.13-ubuntu-focal-20230126-transport-tools-1.0.7
type: string
# useful to invalidate the build cache manually by bumping the version
build_cache_key:
default: build-v3
default: build-v4
type: string
plt_cache_key:
default: plt-v3
default: plt-v4
type: string
js_cache_key:
default: js-v2
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
# - https://hexdocs.pm/elixir/compatibility-and-deprecations.html
# - https://github.com/elixir-lang/elixir/releases
# - `asdf list all elixir`
elixir 1.14.5-otp-24
elixir 1.15.5-otp-24

# See:
# - https://github.com/erlang/otp/releases
# - https://github.com/erlang/otp/blob/master/otp_versions.table
# - `asdf list all erlang`
erlang 24.3.4.13

nodejs 18.16.1
nodejs 18.17.1
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/etalab/transport-ops:elixir-1.14.5-erlang-24.3.4.13-ubuntu-focal-20230126-transport-tools-1.0.7
FROM ghcr.io/etalab/transport-ops:elixir-1.15.5-erlang-24.3.4.13-ubuntu-focal-20230126-transport-tools-1.0.7

RUN mkdir phoenixapp
WORKDIR /phoenixapp
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/etalab/transport-ops:elixir-1.14.5-erlang-24.3.4.13-ubuntu-focal-20230126-transport-tools-1.0.7
FROM ghcr.io/etalab/transport-ops:elixir-1.15.5-erlang-24.3.4.13-ubuntu-focal-20230126-transport-tools-1.0.7

RUN apt-get install -y git inotify-tools postgresql-client>=11

Expand Down
2 changes: 1 addition & 1 deletion apps/datagouvfr/lib/datagouvfr/client/datasets.ex
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ defmodule Datagouvfr.Client.Datasets do
Enum.any?(
followers,
&(&1["follower"]["id"] == user_id)
) or is_user_in_followers?(page['next_page'], user_id, conn)
) or is_user_in_followers?(page[~c"next_page"], user_id, conn)
end

defp is_user_in_followers?(page_url, user_id, conn) when is_binary(page_url) do
Expand Down
6 changes: 3 additions & 3 deletions apps/datagouvfr/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ defmodule Datagouvfr.MixProject do
{:httpoison, ">= 0.0.0"},
{:plug, ">= 0.0.0"},
{:shared, in_umbrella: true},
# Using master until https://github.com/CargoSense/vex/issues/68 is fixed
{:vex, github: "CargoSense/vex", ref: "328a39f7"},
{:vex, "~> 0.9"},
{:exvcr, "~> 0.13", only: :test},
{:mox, "~> 1.0.0", only: :test},
{:sentry, "~> 8.0"}
{:sentry, "~> 8.1"},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
]
end
end
2 changes: 1 addition & 1 deletion apps/gbfs/lib/gbfs/controllers/vcub_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule GBFS.VCubController do
|> render("gbfs.json")
end

@spec station_aux(Plug.Conn.t(), (() -> {:ok, map()} | {:error, binary()})) :: Plug.Conn.t()
@spec station_aux(Plug.Conn.t(), (-> {:ok, map()} | {:error, binary()})) :: Plug.Conn.t()
defp station_aux(conn, get_info_function) do
case get_info_function.() do
{:ok, data} ->
Expand Down
2 changes: 1 addition & 1 deletion apps/gbfs/lib/gbfs/controllers/vlille_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule GBFS.VLilleController do
|> render("gbfs.json")
end

@spec station_aux(Plug.Conn.t(), (() -> {:ok, map()} | {:error, binary()})) :: Plug.Conn.t()
@spec station_aux(Plug.Conn.t(), (-> {:ok, map()} | {:error, binary()})) :: Plug.Conn.t()
defp station_aux(conn, get_info_function) do
case get_info_function.() do
{:ok, data} ->
Expand Down
5 changes: 3 additions & 2 deletions apps/gbfs/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule GBFS.MixProject do
{:sweet_xml, ">= 0.0.0"},
{:jason, ">= 0.0.0"},
{:cors_plug, "~> 3.0"},
{:sentry, "~> 8.0"},
{:sentry, "~> 8.1"},
# Required for ConditionalJSONEncoder which is referenced by global config,
# otherwise the tests won't run. Not sure if there's a better way for this,
# since the GBFS app itself does not currently rely on conditional encoding.
Expand All @@ -51,7 +51,8 @@ defmodule GBFS.MixProject do
{:mock, "~> 0.3.6", only: :test},
{:bypass, "~> 2.1", only: :test},
{:appsignal, "~> 2.0"},
{:appsignal_phoenix, "~> 2.0"}
{:appsignal_phoenix, "~> 2.0"},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
]
end
end
7 changes: 4 additions & 3 deletions apps/shared/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ defmodule Shared.MixProject do
# otherwise running tests for an individual umbrella sub-app will raise error.
# A better way to achieve this will be to configure it at runtime, like described
# in https://github.com/getsentry/sentry-elixir/pull/472.
{:sentry, "~> 8.0.0"},
{:sentry, "~> 8.1"},
# Similarly, Jason is configured as `json_library` by the main app, so it will
# be required no matter what.
{:jason, ">= 0.0.0"},
{:ex_cldr_numbers, "~> 2.0"},
{:cachex, "~> 3.5"},
{:ex_json_schema, "~> 0.9.1"},
{:ex_json_schema, "~> 0.10"},
# added because of `TransportWeb.Plugs.AppSignalFilter`
{:appsignal, "~> 2.0"},
{:appsignal_phoenix, "~> 2.0"}
{:appsignal_phoenix, "~> 2.0"},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
]
end
end
14 changes: 7 additions & 7 deletions apps/transport/client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001517:
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001517:
version "1.0.30001520"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001520.tgz#62e2b7a1c7b35269594cf296a80bdf8cb9565006"
integrity sha512-tahF5O9EiiTzwTUqAeFjIZbn4Dnqxzz7ktrgGlMYNLH43Ul26IgTMH/zvL3DG0lZxBYnlT04axvInszUsZULdA==
Expand Down Expand Up @@ -2446,7 +2446,7 @@ earcut@^2.2.4:
resolved "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a"
integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==

electron-to-chromium@^1.4.251, electron-to-chromium@^1.4.477:
electron-to-chromium@^1.4.477:
version "1.4.490"
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.490.tgz#d99286f6e915667fa18ea4554def1aa60eb4d5f1"
integrity sha512-6s7NVJz+sATdYnIwhdshx/N/9O6rvMxmhVoDSDFdj6iA45gHR8EQje70+RYsF4GeB+k0IeNSBnP7yG9ZXJFr7A==
Expand Down Expand Up @@ -3289,7 +3289,7 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7:
resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==

is-core-module@^2.12.1, is-core-module@^2.13.0, is-core-module@^2.5.0, is-core-module@^2.9.0:
is-core-module@^2.12.1, is-core-module@^2.13.0, is-core-module@^2.5.0:
version "2.13.0"
resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db"
integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==
Expand Down Expand Up @@ -3779,7 +3779,7 @@ node-fetch@^2.6.7:
dependencies:
whatwg-url "^5.0.0"

node-releases@^2.0.13, node-releases@^2.0.6:
node-releases@^2.0.13:
version "2.0.13"
resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d"
integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==
Expand Down Expand Up @@ -3976,10 +3976,10 @@ path-type@^4.0.0:
version "1.6.16"

"phoenix_html@file:../../../deps/phoenix_html":
version "3.3.1"
version "3.3.2"

"phoenix_live_view@file:../../../deps/phoenix_live_view":
version "0.18.18"
version "0.19.5"

picocolors@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -5059,7 +5059,7 @@ unicode-property-aliases-ecmascript@^2.0.0:
resolved "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz#43d41e3be698bd493ef911077c9b131f827e8ccd"
integrity sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==

update-browserslist-db@^1.0.11, update-browserslist-db@^1.0.9:
update-browserslist-db@^1.0.11:
version "1.0.11"
resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940"
integrity sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==
Expand Down
4 changes: 3 additions & 1 deletion apps/transport/lib/transport_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ defmodule TransportWeb.Router do
"https://doc.transport.data.gouv.fr/presentation-et-mode-demploi-du-pan/conditions-dutilisation-des-donnees/licence-odbl"
)

get("/budget", Redirect, external: "https://doc.transport.data.gouv.fr/le-point-d-acces-national/generalites/budget")
get("/budget", Redirect,
external: "https://doc.transport.data.gouv.fr/le-point-d-acces-national/generalites/budget"
)

# old static pages that have been moved to blog.transport
get("/blog/2019_04_26_interview_my_bus", Redirect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
) %>
<% end %>
<%= if not is_nil(start_date) and is_nil(end_date) do %>
<%= dgettext("page-dataset-details", "From %{start}", start: format_datetime_to_paris(start_date, @locale)) %>
<%= dgettext("page-dataset-details", "From %{start}",
start: format_datetime_to_paris(start_date, @locale)
) %>
<% end %>
<%= if is_nil(start_date) and not is_nil(end_date) do %>
<%= dgettext("page-dataset-details", "Until %{end}", end: format_datetime_to_paris(end_date, @locale)) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<% errors = Map.fetch!(validation.result, "errors") %>
<% errors_error_level = errors |> Enum.filter(&(Map.fetch!(&1, "severity") == "ERROR")) %>
<% errors_warning_level = errors |> Enum.filter(&(Map.fetch!(&1, "severity") == "WARNING")) %>
<%= render("_errors_warnings_count.html", nb_errors: errors_count(validation), nb_warnings: warnings_count(validation)) %>
<%= render("_errors_warnings_count.html",
nb_errors: errors_count(validation),
nb_warnings: warnings_count(validation)
) %>
<p :if={Map.get(validation.result, "ignore_shapes", false)} class="notification">
<%= dgettext("validations", "Shapes present in the GTFS have been ignored, some rules are not enforced.") %>
</p>
Expand Down
2 changes: 1 addition & 1 deletion apps/transport/lib/transport_web/views/dataset_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule TransportWeb.DatasetView do
@doc """
Count the number of discussions if they are available
"""
def count_discussions(nil), do: '-'
def count_discussions(nil), do: ~c"-"
def count_discussions(discussions), do: Enum.count(discussions)

def pagination_links(%{path_info: ["datasets", "region", region]} = conn, datasets) do
Expand Down
13 changes: 7 additions & 6 deletions apps/transport/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ defmodule Transport.Mixfile do
{:phoenix, "~> 1.6.2"},
{:phoenix_html, "~> 3.1"},
{:phoenix_markdown, "~> 1.0"},
{:phoenix_live_view, "~> 0.18.0"},
{:phoenix_live_view, "~> 0.19.0"},
{:html_sanitize_ex, "~> 1.4"},
{:floki, ">= 0.0.0", only: :test},
{:plug_cowboy, "~> 2.3"},
{:recon, "~> 2.4"},
{:quantum, "~> 3.4"},
{:timex, "~> 3.7"},
{:sentry, "~> 8.0"},
{:sentry, "~> 8.1"},
{:scrivener, "~> 2.5"},
{:scrivener_html, git: "https://github.com/mgwidmann/scrivener_html.git", ref: "9224d1"},
{:scrivener_list, "~>2.0"},
Expand Down Expand Up @@ -108,7 +108,7 @@ defmodule Transport.Mixfile do
{:etag_plug, "~> 1.0"},
{:oban, "~> 2.13"},
{:unzip, "~> 0.8"},
{:protobuf, "~> 0.11.0"},
{:protobuf, "~> 0.11"},
{:nimble_csv, "~> 1.2.0"},
{:kino, "~> 0.6", only: :dev},
# db
Expand All @@ -119,18 +119,19 @@ defmodule Transport.Mixfile do
{:ecto_interval, "~> 0.2.5"},
{:scrivener_ecto, "~> 2.7.0"},
{:typed_ecto_schema, ">= 0.1.1"},
{:ymlr, "~> 3.0"},
{:ymlr, "~> 4.0"},
{:ex_machina, "~> 2.4", only: :test},
{:cloak_ecto, "~> 1.2.0"},
{:phoenix_live_dashboard, "~> 0.7"},
{:phoenix_live_dashboard, "~> 0.8"},
{:ecto_psql_extras, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:telemetry_metrics, "~> 0.4"},
{:luhn, "~> 0.3.0"},
{:ex_phone_number, "~> 0.3"},
{:appsignal, "~> 2.0"},
{:appsignal_phoenix, "~> 2.0"},
{:vega_lite, "~> 0.1.7"}
{:vega_lite, "~> 0.1.7"},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
]
end
end
2 changes: 1 addition & 1 deletion apps/transport/test/transport/import_data_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ defmodule Transport.ImportDataTest do

with_mock HTTPoison, get!: mock do
logs =
capture_log([level: :warn], fn ->
capture_log([level: :warning], fn ->
ImportData.import_all_datasets()
end)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ defmodule Transport.Test.Transport.Jobs.ConsolidateLEZsJobTest do
insert(:resource, dataset: dataset, url: "https://example.com/voies.geojson", schema_name: "etalab/schema-zfe")

_zfe_pan =
insert(:resource, dataset: pan_dataset, url: "https://example.com/aires.geojson", schema_name: "etalab/schema-zfe")
insert(:resource,
dataset: pan_dataset,
url: "https://example.com/aires.geojson",
schema_name: "etalab/schema-zfe"
)

assert [zfe_aire.id, zfe_voies.id] == ConsolidateLEZsJob.relevant_resources() |> Enum.map(& &1.id)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Transport.Validators.EXJSONSchemaTest do
import Mox
alias Transport.Validators.EXJSONSchema

@validator_version_regex ~r/^0\.\d\.\d$/
@validator_version_regex ~r/^0\.\d+\.\d$/

setup do
Ecto.Adapters.SQL.Sandbox.checkout(DB.Repo)
Expand Down
7 changes: 4 additions & 3 deletions apps/unlock/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defmodule Unlock.MixProject do
[
{:phoenix, "~> 1.6.2"},
{:phoenix_html, "~> 3.1"},
{:sentry, "~> 8.0"},
{:sentry, "~> 8.1"},
# required indirectly by sentry
{:hackney, "~> 1.8"},
{:jason, "~> 1.1"},
Expand All @@ -47,12 +47,13 @@ defmodule Unlock.MixProject do
{:cors_plug, "~> 3.0"},
{:saxy, "~> 1.5"},
{:mox, "~> 1.0.0", only: :test},
{:ymlr, "~> 3.0", only: :test},
{:ymlr, "~> 4.0", only: :test},
{:ecto, "~> 3.7", only: :test},
# required for `TransportWeb.Plugs.AppSignalFilter`
{:shared, in_umbrella: true},
{:appsignal, "~> 2.0"},
{:appsignal_phoenix, "~> 2.0"}
{:appsignal_phoenix, "~> 2.0"},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
]
end
end
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if File.exists?(extra_config_file) do
else
require Logger

Logger.warn(
Logger.warning(
"Only the most basic features will work. Please create #{extra_config_file} based on config/dev.secret.template.exs for more advanced use."
)
end
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ config :datagouvfr,
config :logger, level: :debug

# ... but show only warnings and up on the console
config :logger, :console, level: :warn
config :logger, :console, level: :warning

# Configure data.gouv.fr authentication
config :oauth2, Authentication,
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ defmodule Transport.MixProject do
# locally, you can use :dialyxir in :dev mode, and we also add
# :test to ensure CI can run it with a single compilation (in test target),
# to reduce build time
{:dialyxir, "~> 1.2.0", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.2", only: [:dev, :test], runtime: false},
{:excoveralls, "~> 0.10", only: :test},
{:saxy, "~> 1.5"},
{:appsignal, "~> 2.0"},
Expand Down
Loading

0 comments on commit 1e86025

Please sign in to comment.