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

Add CI using GH Actions #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add CI using GH Actions #1

wants to merge 1 commit into from

Conversation

progval
Copy link
Contributor

@progval progval commented Feb 26, 2023

I hoped to test for older OTP versions with:

          - otp: '21'
            elixir: '1.11'
            os: 'ubuntu-20.04'
          - otp: '22'
            elixir: '1.13'
            os: 'ubuntu-20.04'

(with Ubuntu 20.04 instead of 22.04, because of https://github.com/erlef/setup-beam#compatibility-between-operating-system-and-erlangotp )

Unfortunately, they fail with:

Generated thurim app
** (Mix) Could not start application thurim: Thurim.Application.start(:normal, []) returned an error: shutdown: failed to start child: Thurim.Federation.KeyServer
    ** (EXIT) an exception was raised:
        ** (FunctionClauseError) no function clause matching in :crypto.generate_key/3
            (crypto 4.4.2.3) crypto.erl:1037: :crypto.generate_key(:eddsa, :ed25519, :undefined)
Warning:             (thurim 0.1.0) lib/thurim/federation/key_server.ex:11: Thurim.Federation.KeyServer.init/1
            (stdlib 3.8.2.4) gen_server.erl:374: :gen_server.init_it/2
Warning:             (stdlib 3.8.2.4) gen_server.erl:342: :gen_server.init_it/6
            (stdlib 3.8.2.4) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

My guess is this is caused by the openssl version in ubuntu 20.04, but I didn't look into it.

Tests are flaky, occasionally failing with these errors I don't really understand:

  1) test register/available returns false when the username is not available (ThurimWeb.UserControllerTest)
     test/thurim_web/controllers/user_controller_test.exs:47
     ** (ArgumentError) errors were found at the given arguments:
     
       * 1st argument: the table identifier does not refer to an existing ETS table
     
     code: create_user(conn, username, password)
     stacktrace:
       (stdlib 4.2) :ets.lookup(ThurimWeb.Endpoint, :render_errors)
       (thurim 0.1.0) lib/phoenix/endpoint.ex:515: ThurimWeb.Endpoint.config/2
       (thurim 0.1.0) lib/thurim_web/endpoint.ex:1: ThurimWeb.Endpoint.call/2
       (phoenix 1.6.8) lib/phoenix/test/conn_test.ex:225: Phoenix.ConnTest.dispatch/5
       test/thurim_web/controllers/user_controller_test.exs:2: ThurimWeb.UserControllerTest.create_user/3
       test/thurim_web/controllers/user_controller_test.exs:50: (test)



  2) test account/password succeeds when authenticated, logging out of all other devices (ThurimWeb.UserControllerTest)
     test/thurim_web/controllers/user_controller_test.exs:102
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/user_controller_test.exs:1: ThurimWeb.UserControllerTest.__ex_unit__/2



  3) test registration with username and password provided (ThurimWeb.UserControllerTest)
     test/thurim_web/controllers/user_controller_test.exs:399
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/user_controller_test.exs:1: ThurimWeb.UserControllerTest.__ex_unit__/2



  4) test PUT /presence/{user_id}/status updates Presence with params (ThurimWeb.PresenceControllerTest)
     test/thurim_web/controllers/presence_controller_test.exs:37
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/presence_controller_test.exs:1: ThurimWeb.PresenceControllerTest.__ex_unit__/2



  5) test PUT /presence/{user_id}/status can only update logged in user's presence (ThurimWeb.PresenceControllerTest)
     test/thurim_web/controllers/presence_controller_test.exs:26
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/presence_controller_test.exs:1: ThurimWeb.PresenceControllerTest.__ex_unit__/2



  6) test PUT /presence/{user_id}/status it returns a 200 response (ThurimWeb.PresenceControllerTest)
     test/thurim_web/controllers/presence_controller_test.exs:15
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/presence_controller_test.exs:1: ThurimWeb.PresenceControllerTest.__ex_unit__/2



  7) test GET /presence/:user_id/status returns user presence when found (ThurimWeb.PresenceControllerTest)
     test/thurim_web/controllers/presence_controller_test.exs:68
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/presence_controller_test.exs:1: ThurimWeb.PresenceControllerTest.__ex_unit__/2



  8) test GET /presence/:user_id/status returns M_NOT_FOUND when presence has not been established (ThurimWeb.PresenceControllerTest)
     test/thurim_web/controllers/presence_controller_test.exs:58
     ** (MatchError) no match of right hand side value: {:error, {%RuntimeError{message: "could not lookup Ecto repo Thurim.Repo because it was not started or it does not exist"}, [{Ecto.Repo.Registry, :lookup, 1, [file: 'lib/ecto/repo/registry.ex', line: 22, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL.Sandbox, :lookup_meta!, 1, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 571]}, {Ecto.Adapters.SQL.Sandbox, :checkout, 2, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 484]}, {Ecto.Adapters.SQL.Sandbox, :"-start_owner!/2-fun-0-", 3, [file: 'lib/ecto/adapters/sql/sandbox.ex', line: 406]}, {Agent.Server, :init, 1, [file: 'lib/agent/server.ex', line: 8]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 851]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 814]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
     stacktrace:
       (ecto_sql 3.8.1) lib/ecto/adapters/sql/sandbox.ex:403: Ecto.Adapters.SQL.Sandbox.start_owner!/2
       (thurim 0.1.0) test/support/data_case.ex:39: Thurim.DataCase.setup_sandbox/1
       (thurim 0.1.0) test/support/conn_case.ex:67: ThurimWeb.ConnCase.__ex_unit_setup_0/1
       (thurim 0.1.0) test/support/conn_case.ex:1: ThurimWeb.ConnCase.__ex_unit__/2
       test/thurim_web/controllers/presence_controller_test.exs:1: ThurimWeb.PresenceControllerTest.__ex_unit__/2

On both GH Actions and my own computer, though it's rarer on my computer.

@serra-allgood
Copy link
Owner

CI is something I'd like to get to, but I've been bad about writing actual tests, so I'm not too concerned with CI yet. I appreciate you looking into it though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants