From 00cbc4dae3ed1085c55533eed9084ce03a02f30d Mon Sep 17 00:00:00 2001 From: Kamil Waz Date: Wed, 14 Sep 2022 15:24:08 +0200 Subject: [PATCH] Fix CI --- .circleci/config.yml | 93 ++++++++++++------------ Dockerfile | 16 ++-- mix.exs | 2 +- test/support/mix/tasks/test_env/utils.ex | 4 +- 4 files changed, 60 insertions(+), 55 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 203d65ea..945b9236 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,15 +26,15 @@ executors: parameters: erlang_version: type: string - default: "22.0" + default: "24.3.4.5" elixir_version: type: string - default: "1.9" + default: "1.13.4" env: type: string default: test docker: - - image: mongooseim/beam-builder:erlang-<< parameters.erlang_version >>_elixir-<< parameters.elixir_version >> + - image: hexpm/elixir:<< parameters.elixir_version >>-erlang-<< parameters.erlang_version >>-ubuntu-focal-20211006 - image: mongooseim/fcm-mock-server - image: kamilwaz/apns-mock-server working_directory: ~/app @@ -45,6 +45,16 @@ commands: test: steps: - checkout + - run: + name: Install dockerize + command: | + apt-get update && apt-get install -y wget && \ + wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && \ + chmod +x dockerize-linux-amd64-v0.6.1.tar.gz && \ + tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz && \ + chmod +x /usr/local/bin/dockerize && \ + rm dockerize-linux-amd64-v0.6.1.tar.gz + - run: apt-get update && apt-get install -y git - restore_cache: keys: - mix-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }} @@ -74,6 +84,7 @@ jobs: steps: - checkout + - run: apt-get update && apt-get install -y git - run: mix local.hex --force - run: mix local.rebar --force - run: mix deps.get @@ -89,6 +100,7 @@ jobs: executor: elixir-builder steps: - checkout + - run: apt-get update && apt-get install -y git - run: echo "$OTP_VERSION $ELIXIR_VERSION" > .version_file - restore_cache: keys: @@ -111,21 +123,12 @@ jobs: name: Execute dialyzer command: mix deps.get && mix dialyzer --halt-exit-status - test-erlang-22_elixir-1-9: - executor: - name: elixir-builder - env: test - erlang_version: "22.0" - elixir_version: "1.9" - steps: - - test - build-dev-certs: executor: name: elixir-builder env: dev - erlang_version: "22.0" - elixir_version: "1.9" + erlang_version: "24.3" + elixir_version: "1.13" steps: - checkout - restore_cache: @@ -142,48 +145,39 @@ jobs: paths: - priv - test-erlang-22_elixir-1-8: + test-erlang-24_elixir-1-13: executor: name: elixir-builder env: test - erlang_version: "22.0" - elixir_version: "1.8" + erlang_version: "24.3.4.5" + elixir_version: "1.13.4" steps: - test - test-erlang-22_elixir-1-7: + test-erlang-24_elixir-1-12: executor: name: elixir-builder env: test - erlang_version: "22.0" - elixir_version: "1.7" + erlang_version: "24.3.4.5" + elixir_version: "1.13.4" steps: - test - test-erlang-21_elixir-1-9: + test-erlang-23_elixir-1-13: executor: name: elixir-builder env: test - erlang_version: "21.3" - elixir_version: "1.9" + erlang_version: "23.3.4.17" + elixir_version: "1.12.3" steps: - test - test-erlang-21_elixir-1-8: + test-erlang-23_elixir-1-12: executor: name: elixir-builder env: test - erlang_version: "21.3" - elixir_version: "1.8" - steps: - - test - - test-erlang-21_elixir-1-7: - executor: - name: elixir-builder - env: test - erlang_version: "21.3" - elixir_version: "1.7" + erlang_version: "23.3.4.17" + elixir_version: "1.12.3" steps: - test @@ -203,6 +197,7 @@ jobs: env: prod steps: - checkout + - run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io - setup_remote_docker: docker_layer_caching: true - restore_cache: @@ -234,14 +229,14 @@ jobs: sudo apt-key add erlang_solutions.asc && \ echo 'deb https://packages.erlang-solutions.com/ubuntu focal contrib' | sudo tee /etc/apt/sources.list.d/esl.list && \ sudo apt-get update && \ - sudo apt-get install -y esl-erlang=1:21.3.8.17-1 && \ - sudo apt-get install -y elixir=1.10.2-1 + sudo apt-get install -y esl-erlang=1:24.3.3-1 && \ + sudo apt-get install -y elixir=1.13.0-1 wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz && \ sudo chmod +x dockerize-linux-amd64-v0.6.1.tar.gz && \ sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz && \ sudo chmod +x /usr/local/bin/dockerize && \ sudo rm dockerize-linux-amd64-v0.6.1.tar.gz - + - run: docker-compose -v - restore_cache: keys: - mix-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }} @@ -249,6 +244,7 @@ jobs: keys: - certs-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }} - run: *DOCKER_TAGS + - run: mix local.hex --force && mix local.rebar --force - run: name: Compile mix deps command: MIX_ENV=integration mix do deps.get, deps.compile @@ -289,17 +285,18 @@ jobs: gh-pages-deploy: machine: - image: ubuntu-1604:201903-01 + image: ubuntu-2004:2022.07.1 steps: - checkout - run: name: Install elixir command: | - wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && \ - sudo dpkg -i erlang-solutions_1.0_all.deb && \ + wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc && \ + sudo apt-key add erlang_solutions.asc && \ + echo 'deb https://packages.erlang-solutions.com/ubuntu focal contrib' | sudo tee /etc/apt/sources.list.d/esl.list && \ sudo apt-get update && \ - sudo apt-get install -y esl-erlang=1:21.0 && \ - sudo apt-get install -y elixir=1.8.0-1 + sudo apt-get install -y esl-erlang=1:24.3.3-1 && \ + sudo apt-get install -y elixir=1.13.0-1 - restore_cache: keys: - mix-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ .Revision }} @@ -343,19 +340,19 @@ workflows: requires: - pre-build filters: *all_tags - - test-erlang-22_elixir-1-9: + - test-erlang-24_elixir-1-13: requires: - pre-build filters: *all_tags - - test-erlang-22_elixir-1-8: + - test-erlang-24_elixir-1-12: requires: - pre-build filters: *all_tags - - test-erlang-21_elixir-1-9: + - test-erlang-23_elixir-1-13: requires: - pre-build filters: *all_tags - - test-erlang-21_elixir-1-8: + - test-erlang-23_elixir-1-12: requires: - pre-build filters: *all_tags @@ -373,7 +370,7 @@ workflows: requires: - integration-tests - build-docker-image - - test-erlang-22_elixir-1-9 + - test-erlang-23_elixir-1-13 filters: *all_tags - gh-pages-deploy: diff --git a/Dockerfile b/Dockerfile index 9ee0f635..f00a1556 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,11 @@ -FROM rslota/beam-builder:erlang-22.0_elixir-1.9 AS builder +ARG ELIXIR_VERSION=1.13.4 +ARG OTP_VERSION=24.3.4.5 + +FROM hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-ubuntu-focal-20211006 as builder + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ + git \ + software-properties-common USER root @@ -8,7 +15,7 @@ ENV MIX_ENV=prod COPY mix.exs mix.lock ./ COPY config config -COPY asn.1 asn.1 +COPY asn1 asn1 COPY rel rel COPY lib lib COPY priv priv @@ -23,7 +30,7 @@ RUN mix do certs.dev, distillery.release RUN tar -czf mongoose_push.tar.gz -C _build/prod/rel/mongoose_push . -FROM debian:stretch-slim +FROM ubuntu:20.04 # set locales @@ -37,14 +44,13 @@ ENV LANGUAGE en_US.UTF-8 ENV LC_ALL en_US.UTF-8 # required packages -RUN echo 'deb http://deb.debian.org/debian jessie main' >> /etc/apt/sources.list RUN apt-get update && apt-get upgrade -y && apt-get install --no-install-recommends -y \ bash \ bash-completion \ curl \ dnsutils \ + libtinfo6 \ libssl1.1 \ - libssl1.0.0 \ vim && \ apt-get clean diff --git a/mix.exs b/mix.exs index b1d8a63e..d8e988f2 100644 --- a/mix.exs +++ b/mix.exs @@ -63,7 +63,7 @@ defmodule MongoosePush.Mixfile do {:telemetry_metrics_prometheus_core, "~> 0.4"}, {:telemetry_poller, "~> 0.5"}, {:logfmt, "~> 3.3"}, - {:stream_data, "~> 0.5", only: :test} + {:stream_data, "~> 0.5", only: [:test, :integration]} ] end diff --git a/test/support/mix/tasks/test_env/utils.ex b/test/support/mix/tasks/test_env/utils.ex index 2b8025b0..e7a074da 100644 --- a/test/support/mix/tasks/test_env/utils.ex +++ b/test/support/mix/tasks/test_env/utils.ex @@ -77,7 +77,9 @@ defmodule Mix.Tasks.Test.Env.Utils do defp try_connect(proto, host, port) do url = "#{proto}://#{host}:#{port}/" - with {:ok, _} <- HTTPoison.get(url, [], hackney: [:insecure]) do + # TODO remove once we're on OTP >= 24.3.4.5, workaround for https://github.com/erlang/otp/issues/6241 + with {:ok, _} <- + HTTPoison.get(url, [], ssl: [middlebox_comp_mode: false, verify: :verify_none]) do :ok end end