2023-08-10 08:30:20 +00:00
|
|
|
defmodule MashConfig do
|
2023-08-10 09:14:45 +00:00
|
|
|
@behaviour Mash.Config
|
|
|
|
|
2023-08-10 08:30:20 +00:00
|
|
|
import Mash.Helpers
|
|
|
|
|
|
|
|
def jobs do
|
|
|
|
[
|
2023-08-10 09:48:57 +00:00
|
|
|
%{
|
|
|
|
name: :restore_cache,
|
2023-08-17 20:13:47 +00:00
|
|
|
if: fn _jobs ->
|
|
|
|
System.get_env("CI")
|
|
|
|
end,
|
2023-08-10 09:48:57 +00:00
|
|
|
run: restore_cache()
|
|
|
|
},
|
2023-08-10 10:55:27 +00:00
|
|
|
%{
|
|
|
|
name: :compile_dev,
|
2023-08-17 20:13:47 +00:00
|
|
|
needs: [restore_cache: :optional],
|
2023-08-10 22:59:25 +00:00
|
|
|
run: mix("do", ["deps.compile,", "compile"], env: [{"MIX_ENV", "dev"}])
|
2023-08-10 10:55:27 +00:00
|
|
|
},
|
2023-08-10 08:30:20 +00:00
|
|
|
%{
|
|
|
|
name: :test,
|
2023-08-17 20:13:47 +00:00
|
|
|
needs: [restore_cache: :optional],
|
2023-08-10 08:30:20 +00:00
|
|
|
run: mix("test")
|
|
|
|
},
|
2023-08-10 09:48:57 +00:00
|
|
|
%{
|
|
|
|
name: :credo,
|
2023-08-17 20:13:47 +00:00
|
|
|
needs: [restore_cache: :optional],
|
2023-08-10 09:48:57 +00:00
|
|
|
run: mix("credo", ["--all"])
|
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: :save_cache,
|
2023-08-17 20:13:47 +00:00
|
|
|
needs: [:test, :compile_dev],
|
2023-08-10 09:48:57 +00:00
|
|
|
run: save_cache()
|
2023-08-10 10:55:27 +00:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
name: :function_test,
|
|
|
|
run: fn _io_pid ->
|
|
|
|
IO.puts("This line should be captured.")
|
|
|
|
end
|
2023-08-17 20:13:47 +00:00
|
|
|
},
|
|
|
|
%{
|
|
|
|
if: false,
|
|
|
|
run: fn _io_pid ->
|
|
|
|
{:error, "This job should not run."}
|
|
|
|
end
|
2023-08-10 09:48:57 +00:00
|
|
|
}
|
2023-08-10 08:30:20 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|