Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mise à jour Erlang OTP (22->23) #1590

Merged
merged 17 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 12 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: 2
version: 2.1

# useful information at https://circleci.com/docs/2.0/language-elixir/
# and https://circleci.com/docs/2.0/reusing-config/#using-the-parameters-declaration

default_docker: &default_docker
image: betagouv/transport:0.4.5
image: << parameters.base_image >>
environment:
MIX_ENV: test
PG_URL_TEST: ecto://[email protected]/transport_test
Expand All @@ -13,6 +14,10 @@ default_docker: &default_docker
SECRET_KEY_BASE: "SOME-SECRET-KEY-BASE-FOR-TESTING-SOME-SECRET-KEY-BASE-FOR-TESTING"

defaults: &defaults
parameters:
base_image:
default: betagouv/transport:elixir-1.10.4-erlang-23.2.7.2-alpine-3.13.3
type: string
working_directory: ~/transport
docker:
- *default_docker
Expand All @@ -21,7 +26,7 @@ defaults_with_postgres: &defaults_with_postgres
<<: *defaults
docker:
- *default_docker
- image: mdillon/postgis:11-alpine
- image: circleci/postgres:12.0-alpine-postgis
environment:
POSTGRES_USER: root
POSTGRES_DB: transport_test
Expand All @@ -33,14 +38,9 @@ jobs:
steps:
- checkout

# TODO: remove this once https://github.com/etalab/transport-ops/issues/19 is solved
- run:
name: Install git (required if we use git-hosted hex packages)
command: apk add --update git

- restore_cache:
keys:
- elixir-v9-build-{{ checksum "mix.lock" }}
- elixir-<< parameters.base_image >>-{{ checksum "mix.lock" }}

- run:
name: Install hex
Expand All @@ -67,7 +67,7 @@ jobs:
command: mix deps.compile

- save_cache:
key: elixir-v9-build-{{ checksum "mix.lock" }}
key: elixir-<< parameters.base_image >>-{{ checksum "mix.lock" }}
paths:
- ~/transport/_build
- ~/transport/deps
Expand All @@ -87,7 +87,7 @@ jobs:

- restore_cache:
keys:
- elixir-v8-plt-{{ checksum "mix.lock" }}
- elixir-<< parameters.base_image >>-plt-{{ checksum "mix.lock" }}

- run:
name: Build PLT
Expand All @@ -97,7 +97,7 @@ jobs:
no_output_timeout: 20m

- save_cache:
key: elixir-v8-plt-{{ checksum "mix.lock" }}
key: elixir-<< parameters.base_image >>-plt-{{ checksum "mix.lock" }}
paths:
- ~/transport/dialyzer-plt

Expand All @@ -113,10 +113,6 @@ jobs:
- attach_workspace:
at: ~/transport

- run:
name: Install git (required if we use git-hosted hex packages)
command: apk add --update git

- run:
name: Run linters
command: |
Expand All @@ -142,10 +138,6 @@ jobs:
- attach_workspace:
at: ~/transport

- run:
name: Install git (required if we use git-hosted hex packages)
command: apk add --update git

- run:
name: Run dialyzer (static analysis)
command: MIX_ENV=dev mix dialyzer
Expand All @@ -156,10 +148,6 @@ jobs:
- attach_workspace:
at: ~/transport

- run:
name: Install git (required if we use git-hosted hex packages)
command: apk add --update git

- run:
name: Run tests
command: |
Expand All @@ -173,10 +161,6 @@ jobs:
- attach_workspace:
at: ~/transport

- run:
name: Install git (required if we use git-hosted hex packages)
command: apk add --update git

- run:
name: Run tests
command: |
Expand Down
6 changes: 3 additions & 3 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.10.4-otp-22
elixir 1.10.4-otp-23

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

nodejs 12.15.0
nodejs 14.16.1
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM betagouv/transport:0.4.5
FROM betagouv/transport:elixir-1.10.4-erlang-23.2.7.2-alpine-3.13.3

RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ gnu-libiconv-dev
RUN apk add git

RUN mkdir phoenixapp
WORKDIR /phoenixapp
Expand Down
2 changes: 1 addition & 1 deletion apps/shared/test/http_stream_v2_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule HTTPStreamV2.Test do
assert result.hash == :sha256 |> :crypto.hash("Contenu éphémère") |> Base.encode16 |> String.downcase
assert result.body_byte_size == ("Contenu éphémère" |> byte_size())
headers = result.headers
|> Enum.filter(fn({a, b}) -> a == "hello" end)
|> Enum.filter(fn({key, _val}) -> key == "hello" end)

assert headers == [{"hello", "header"}]
end
Expand Down
10 changes: 10 additions & 0 deletions apps/transport/test/build_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ defmodule TransportWeb.BuildTest do
assert output |> String.trim() == "v" <> asdf_nodejs_release()
end

test "make sure Docker image is same for production & CI" do
content = File.read!("../../Dockerfile")
[[_, production_version]] = Regex.scan(~r/FROM (.*)/, content)

content = File.read!("../../.circleci/config.yml")
[[_, ci_version]] = Regex.scan(~r/(betagouv\/transport.*)/, content)

assert ci_version == production_version
end

# figuring out you have forgotten to upgrade the assets can be tricky, so we add a little reminder here
test "make sure LiveView client assets are up to date" do
{output, 0} = System.cmd("yarn", ["list", "--pattern", "phoenix_live_view"], cd: "client")
Expand Down