diff --git a/.drone.yml b/.drone.yml index ea5228a..bdb8953 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,9 +2,36 @@ kind: pipeline type: docker name: default +services: + - name: postgres + image: docker.io/library/postgres:17.2 + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + steps: -- name: greeting - image: alpine - commands: - - echo hello - - echo world + - name: lint & test + image: docker.io/library/elixir:1.18.3-otp-27 + environment: + MIX_ENV: test + TEST_POSTGRES_HOST: postgres + commands: + # Install hex package manager + - mix local.hex --force + # Fetch dependencies + - mix deps.get + # Check for compilation errors & warnings + - mix compile --warnings-as-errors + # Check formatting + - mix format --check-formatted + # Wait for postgres to become available + # TODO: pg_isready is not installed in the elixir image + # - | + # for i in {1..20}; do + # pg_isready -h postgres -p $DATABASE_PORT && break + # sleep 2 + # done + # echo "Postgres did not become available, aborting" + # exit 1 + # Run tests + - mix test diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..867ea98 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*.yml] +indent_size = 2 +indent_style = space \ No newline at end of file diff --git a/Justfile b/Justfile index 3e5fe17..3855809 100644 --- a/Justfile +++ b/Justfile @@ -8,4 +8,8 @@ migrate-database: mix ash.setup reset-database: - mix ash.reset \ No newline at end of file + mix ash.reset + +ci-dev: + mix compile --warnings-as-errors + mix format --check-formatted \ No newline at end of file diff --git a/config/test.exs b/config/test.exs index 6827af6..00a6a7f 100644 --- a/config/test.exs +++ b/config/test.exs @@ -8,7 +8,7 @@ import Config config :mv, Mv.Repo, username: "postgres", password: "postgres", - hostname: "localhost", + hostname: System.get_env("TEST_POSTGRES_HOST", "localhost"), database: "mv_test#{System.get_env("MIX_TEST_PARTITION")}", pool: Ecto.Adapters.SQL.Sandbox, pool_size: System.schedulers_online() * 2 diff --git a/lib/mv_web/components/layouts/root.html.heex b/lib/mv_web/components/layouts/root.html.heex index 2c2230d..9857506 100644 --- a/lib/mv_web/components/layouts/root.html.heex +++ b/lib/mv_web/components/layouts/root.html.heex @@ -1,7 +1,7 @@
- <%= Application.get_env(:live_debugger, :live_debugger_tags) %> + {Application.get_env(:live_debugger, :live_debugger_tags)}