From 7324e3bf58f2620dfc216720f1dc97f70d83c76b Mon Sep 17 00:00:00 2001 From: Derek Kraan Date: Fri, 29 Sep 2023 11:21:20 +0200 Subject: [PATCH] Move from CircleCI to Github Actions Disable prevent_overlapping_partitions because it conflicts with Schism. (see https://github.com/elixir-toniq/schism/issues/41) --- .circleci/config.yml | 21 --------------- .github/workflows/ci.yml | 33 ++++++++++++++++++++++++ lib/horde/processes_supervisor.ex | 3 ++- lib/horde/supervisor_telemetry_poller.ex | 2 +- mix.exs | 2 +- test/local_cluster_test.exs | 2 +- test/network_partition_test.exs | 10 +++---- 7 files changed, 43 insertions(+), 30 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index c50f2129..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,21 +0,0 @@ -# Elixir CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-elixir/ for more details -version: 2 -jobs: - build: - docker: - - image: cimg/elixir:1.13 - - working_directory: ~/repo - environment: - MIX_ENV: test - steps: - - checkout - - run: mix local.hex --force - - run: mix local.rebar --force - - - run: mix deps.get - - run: mix compile --warnings-as-errors - - run: mix format --check-formatted - - run: mix test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..be57ae69 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +on: push + +env: + ELIXIR_ERL_OPTIONS: -kernel prevent_overlapping_partitions false + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + elixir-version: [1.15, 1.14, 1.13] + otp-version: [26, 25, 24] + exclude: + - elixir-version: 1.13 + otp-version: 26 + + name: Tests + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir-version }} + otp-version: ${{ matrix.otp-version }} + + - run: mix deps.get + + - run: mix compile --warnings-as-errors + if: matrix.elixir-version == 1.15 && matrix.otp-version == 26 + + - run: mix format --check-formatted + if: matrix.elixir-version == 1.15 && matrix.otp-version == 26 + + - run: mix test diff --git a/lib/horde/processes_supervisor.ex b/lib/horde/processes_supervisor.ex index 8fddaa16..327a2d06 100644 --- a/lib/horde/processes_supervisor.ex +++ b/lib/horde/processes_supervisor.ex @@ -822,7 +822,8 @@ defmodule Horde.ProcessesSupervisor do end def handle_info(msg, state) do - :error_logger.error_msg('Horde.ProcessesSupervisor received unexpected message: ~p~n', [msg]) + :error_logger.error_msg(~c"Horde.ProcessesSupervisor received unexpected message: ~p~n", [msg]) + {:noreply, state} end diff --git a/lib/horde/supervisor_telemetry_poller.ex b/lib/horde/supervisor_telemetry_poller.ex index 9766d56d..c5d0eb0d 100644 --- a/lib/horde/supervisor_telemetry_poller.ex +++ b/lib/horde/supervisor_telemetry_poller.ex @@ -34,7 +34,7 @@ defmodule Horde.DynamicSupervisorTelemetryPoller do }) catch :exit, reason -> - Logger.warn(""" + Logger.warning(""" Exit while fetching metrics from #{inspect(supervisor_impl_name)}. Skip poll action. Reason: #{inspect(reason)}. """) diff --git a/mix.exs b/mix.exs index 651c24dc..53b76a8c 100644 --- a/mix.exs +++ b/mix.exs @@ -38,7 +38,7 @@ defmodule Horde.MixProject do {:stream_data, "~> 0.4", only: :test}, {:local_cluster, "~> 1.1", only: :test}, {:schism, "~> 1.0.1", only: :test}, - {:dialyxir, "~> 1.0.0-rc.6", only: [:dev, :test], runtime: false}, + {:dialyxir, "~> 1.0.0-rc.6", only: [:dev], runtime: false}, {:test_app, path: "test_app", only: [:test]} ] end diff --git a/test/local_cluster_test.exs b/test/local_cluster_test.exs index abcebce3..430eb6c3 100644 --- a/test/local_cluster_test.exs +++ b/test/local_cluster_test.exs @@ -101,7 +101,7 @@ defmodule LocalClusterTest do nodes = rpc(target, Node, :list, []) Logger.info( - "found #{inspect(pid)} on node: #{inspect(node(pid))}, target #{inspect(node)}, nodes: #{inspect(nodes)}" + "found #{inspect(pid)} on node: #{inspect(node(pid))}, target #{inspect(node())}, nodes: #{inspect(nodes)}" ) Process.sleep(200) diff --git a/test/network_partition_test.exs b/test/network_partition_test.exs index 4c3f21f7..d3a6f85a 100644 --- a/test/network_partition_test.exs +++ b/test/network_partition_test.exs @@ -2,7 +2,7 @@ defmodule NetworkPartitionTest do use ExUnit.Case setup do - nodes = LocalCluster.start_nodes("cluster-#{:rand.uniform(9_999_999)}", 2) + nodes = LocalCluster.start_nodes("cluster#{:erlang.unique_integer()}", 2) for n <- nodes do :rpc.call(n, Application, :ensure_all_started, [:test_app]) @@ -12,13 +12,13 @@ defmodule NetworkPartitionTest do end test "recovers as expected in case of network partition", %{nodes: [n1, n2] = nodes} do - assert {:ok, pid1} = + assert {:ok, _pid1} = Horde.DynamicSupervisor.start_child( {TestSup, n1}, {IgnoreWorker, {:via, Horde.Registry, {TestReg, IgnoreWorker}}} ) - assert {:ok, pid2} = + assert {:ok, _pid2} = Horde.DynamicSupervisor.start_child( {TestSup, n2}, {IgnoreWorker, {:via, Horde.Registry, {TestReg, IgnoreWorker}}} @@ -48,13 +48,13 @@ defmodule NetworkPartitionTest do end test "recovers as expected in case of node stopping", %{nodes: [n1, n2] = nodes} do - assert {:ok, pid1} = + assert {:ok, _pid1} = Horde.DynamicSupervisor.start_child( {TestSup, n1}, {IgnoreWorker, {:via, Horde.Registry, {TestReg, IgnoreWorker}}} ) - assert {:ok, pid2} = + assert {:ok, _pid2} = Horde.DynamicSupervisor.start_child( {TestSup, n2}, {IgnoreWorker, {:via, Horde.Registry, {TestReg, IgnoreWorker}}}