From 8f281f2040c03890b026c982432dbf695046f45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20C=C3=A1rdenas?= Date: Wed, 24 Jan 2018 12:43:41 -0600 Subject: [PATCH] Fix CircleCI build CircleCI changed the way it runs tests for elixir. This change updates our current configuration to keep up to date with CircleCI 2.0. --- .circleci/config.yml | 12 ++++++++++++ circle.yml | 17 ----------------- circle_pre_build.sh | 36 ----------------------------------- elixir_buildpack.config | 2 -- lib/bamboo/postmark_helper.ex | 22 ++++++++++----------- 5 files changed, 23 insertions(+), 66 deletions(-) create mode 100644 .circleci/config.yml delete mode 100644 circle.yml delete mode 100755 circle_pre_build.sh delete mode 100644 elixir_buildpack.config diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..1a23f3f --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,12 @@ +version: 2 +jobs: + build: + working_directory: ~/bamboo_postmark + docker: + - image: elixir:1.5.3 + steps: + - checkout + - run: mix local.hex --force + - run: mix local.rebar + - run: mix deps.get + - run: mix test diff --git a/circle.yml b/circle.yml deleted file mode 100644 index fa35921..0000000 --- a/circle.yml +++ /dev/null @@ -1,17 +0,0 @@ -machine: - environment: - PATH: "$HOME/.asdf/bin:$HOME/.asdf/shims:$PATH" - -dependencies: - cache_directories: - - ~/.asdf - - deps - - _build - pre: - - ./circle_pre_build.sh - - mix deps.compile - - mix compile - -test: - override: - - mix test diff --git a/circle_pre_build.sh b/circle_pre_build.sh deleted file mode 100755 index 5eb51aa..0000000 --- a/circle_pre_build.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# Ensure exit codes other than 0 fail the build -set -e - -# Check for asdf -if ! asdf | grep version; then - git clone https://github.com/HashNuke/asdf.git ~/.asdf; -fi - -# Add plugins for asdf -if ! asdf plugin-list | grep erlang; then - asdf plugin-add erlang https://github.com/HashNuke/asdf-erlang.git -fi - -if ! asdf plugin-list | grep elixir; then - asdf plugin-add elixir https://github.com/HashNuke/asdf-elixir.git -fi - -# Extract vars from elixir_buildpack.config -. elixir_buildpack.config - -# Write .tool-versions -echo "erlang $erlang_version" >> .tool-versions -echo "elixir $elixir_version" >> .tool-versions - -# Install erlang/elixir -asdf install erlang $erlang_version -asdf install elixir $elixir_version - -# Get dependencies -yes | mix deps.get -yes | mix local.rebar - -# Exit successfully -exit 0 diff --git a/elixir_buildpack.config b/elixir_buildpack.config deleted file mode 100644 index c9939ad..0000000 --- a/elixir_buildpack.config +++ /dev/null @@ -1,2 +0,0 @@ -erlang_version=19.0 -elixir_version=1.3.2 diff --git a/lib/bamboo/postmark_helper.ex b/lib/bamboo/postmark_helper.ex index 97f7e04..5e85c51 100644 --- a/lib/bamboo/postmark_helper.ex +++ b/lib/bamboo/postmark_helper.ex @@ -28,8 +28,8 @@ defmodule Bamboo.PostmarkHelper do ## Example - template(email, "9746128") - template(email, "9746128", %{"name" => "Name", "content" => "John"}) + template(email, "9746128") + template(email, "9746128", %{"name" => "Name", "content" => "John"}) """ def template(email, template_id, template_model \\ %{}) do email @@ -43,15 +43,15 @@ defmodule Bamboo.PostmarkHelper do ## Example - put_param(email, "TrackLinks", "HtmlAndText") - put_param(email, "TrackOpens", true) - put_param(email, "Attachments", [ - %{ - Name: "file.txt", - Content: "/some/file.txt" |> File.read!() |> Base.encode64(), - ContentType: "txt" - } - ]) + put_param(email, "TrackLinks", "HtmlAndText") + put_param(email, "TrackOpens", true) + put_param(email, "Attachments", [ + %{ + Name: "file.txt", + Content: "/some/file.txt" |> File.read!() |> Base.encode64(), + ContentType: "txt" + } + ]) """ def put_param(%Email{private: %{message_params: _}} = email, key, value) do put_in(email.private[:message_params][key], value)