-
-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathjustfile
More file actions
131 lines (107 loc) · 3.9 KB
/
justfile
File metadata and controls
131 lines (107 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
os := if os() == "macos" { "darwin" } else { os() }
arch := if arch() =~ "(arm|aarch64)" { "arm64" } else { if arch() =~ "(x86|x86_64)" { "amd64" } else { "unsupported" } }
local_target := if os =~ "(darwin|linux|windows)" { os + "_" + arch } else { "unsupported" }
apps := "expert engine forge expert_credo"
expert_erl_flags := "-start_epmd false -epmd_module Elixir.Forge.EPMD"
engine_erl_flags := "-start_epmd false -epmd_module Elixir.Forge.EPMD"
[doc('Run mix deps.get for the given project')]
deps project="all" *args="":
@just mix {{ project }} deps.get {{ args }}
[doc('Run an arbitrary command inside the given project directory')]
run project +ARGS:
#!/usr/bin/env bash
set -euo pipefail
cd apps/{{ project }}
eval "{{ ARGS }}"
[doc('Compile the given project.')]
compile project *args="": (deps project)
cd apps/{{ project }} && mix compile {{ args }}
[doc('Run tests in the given project')]
test project="all" *args="":
@just mix {{ project }} test {{args}}
[doc('Run a mix command in one or all projects. Use `just test` to run tests.')]
mix project="all" *args="":
#!/usr/bin/env bash
set -euxo pipefail
case {{ project }} in
all)
for proj in {{ apps }}; do
case $proj in
expert)
(cd "apps/$proj" && elixir --erl "{{ expert_erl_flags }}" -S mix {{args}})
;;
engine)
(cd "apps/$proj" && elixir --erl "{{ engine_erl_flags }}" -S mix {{args}})
;;
*)
(cd "apps/$proj" && mix {{args}})
;;
esac
done
;;
expert)
(cd "apps/expert" && elixir --erl "{{ expert_erl_flags }}" -S mix {{args}})
;;
engine)
(cd "apps/engine" && elixir --erl "{{ engine_erl_flags }}" -S mix {{args}})
;;
*)
(cd "apps/{{ project }}" && mix {{args}})
;;
esac
[doc('Lint all projects or just a single project')]
lint *project="all":
#!/usr/bin/env bash
set -euxo pipefail
just mix {{ project }} format --check-formatted
just mix {{ project }} credo
just mix {{ project }} dialyzer
[doc('Build a burrito release for the local system')]
[unix]
burrito-local: (deps "engine") (deps "expert")
#!/usr/bin/env bash
cd apps/expert
set -euxo pipefail
if [ "{{ local_target }}" == "unsupported" ]; then
echo "unsupported OS/Arch combination: {{ local_target }}"
exit 1
fi
MIX_ENV={{ env('MIX_ENV', 'prod')}} EXPERT_RELEASE_MODE=burrito BURRITO_TARGET="{{ local_target }}" mix release --overwrite
[windows]
burrito-local: (deps "engine") (deps "expert")
export EXPERT_RELEASE_MODE=burrito && \
export BURRITO_TARGET="windows_amd64" && \
export MIX_ENV={{ env('MIX_ENV', 'prod')}} && \
cd apps/expert && \
mix release --overwrite
[doc('Build releases for all target platforms')]
burrito: (deps "engine") (deps "expert")
#!/usr/bin/env bash
cd apps/expert
set -euxo pipefail
EXPERT_RELEASE_MODE=burrito MIX_ENV={{ env('MIX_ENV', 'prod')}} mix release --overwrite
[doc('Build a plain release for the local system')]
[unix]
release: (deps "engine") (deps "expert")
#!/usr/bin/env bash
cd apps/expert
MIX_ENV={{ env('MIX_ENV', 'prod')}} mix release plain --overwrite
[windows]
release: (deps "engine") (deps "expert")
cd apps/expert && export MIX_ENV={{ env('MIX_ENV', 'prod')}} && mix release plain --overwrite
[doc('Compiles .github/matrix.json')]
compile-ci-matrix:
elixir matrix.exs
[doc('Build and install binary locally')]
[unix]
install: burrito-local
#!/usr/bin/env bash
set -euxo pipefail
mkdir -p ~/.local/bin
cp ./apps/expert/burrito_out/expert_{{ local_target }} ~/.local/bin/expert
chmod +x ~/.local/bin/expert
clean-engine:
elixir -e ':filename.basedir(:user_cache, "expert") |> File.rm_rf!() |> IO.inspect()'
start *args="":
./apps/expert/_build/{{ env('MIX_ENV', 'prod')}}/rel/plain/bin/start_expert {{ args }}
default: burrito-local