Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Waz committed Sep 15, 2022
1 parent 91d5d9a commit 00cbc4d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 55 deletions.
93 changes: 45 additions & 48 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

Expand All @@ -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:
Expand Down Expand Up @@ -234,21 +229,22 @@ 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 }}
- restore_cache:
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
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion test/support/mix/tasks/test_env/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00cbc4d

Please sign in to comment.