Skip to content

Commit 575860f

Browse files
committed
[cli] internal: add justfile commands to control anti containerization
1 parent bc4c5a2 commit 575860f

File tree

1 file changed

+72
-36
lines changed

1 file changed

+72
-36
lines changed

cli/justfile

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
# shellcheck shell=bash
22

3+
set unstable := true
4+
35
format:
4-
#!/usr/bin/env bash
5-
fourmolu -i src app test test-E2E test-lib CI/rewrite-libs
6-
cabal-fmt -i anti.cabal CI/rewrite-libs/rewrite-libs.cabal
7-
nixfmt *.nix
8-
nixfmt nix/*.nix
9-
nixfmt CI/rewrite-libs/*.nix
10-
nixfmt CI/rewrite-libs/nix/*.nix
6+
#!/usr/bin/env bash
7+
fourmolu -i src app test test-E2E test-lib CI/rewrite-libs
8+
cabal-fmt -i anti.cabal CI/rewrite-libs/rewrite-libs.cabal
9+
nixfmt *.nix
10+
nixfmt nix/*.nix
11+
nixfmt CI/rewrite-libs/*.nix
12+
nixfmt CI/rewrite-libs/nix/*.nix
1113

1214
hlint:
13-
#!/usr/bin/env bash
14-
hlint app src test test-E2E test-lib CI/rewrite-libs
15+
#!/usr/bin/env bash
16+
hlint app src test test-E2E test-lib CI/rewrite-libs
1517

1618
unit match="":
17-
#!/usr/bin/env bash
18-
# shellcheck disable=SC2050
19-
if [[ '{{match}}' == "" ]]; then
20-
cabal test anti-unit-test \
21-
--test-show-details=direct
22-
else
23-
cabal test anti-unit-test\
24-
--test-show-details=direct \
25-
--test-option=--match \
26-
--test-option="{{match}}"
27-
fi
19+
#!/usr/bin/env bash
20+
# shellcheck disable=SC2050
21+
if [[ '{{ match }}' == "" ]]; then
22+
cabal test anti-unit-test \
23+
--test-show-details=direct
24+
else
25+
cabal test anti-unit-test\
26+
--test-show-details=direct \
27+
--test-option=--match \
28+
--test-option="{{ match }}"
29+
fi
30+
2831
build:
2932
#!/usr/bin/env bash
3033
cabal build all --enable-tests
3134

32-
3335
E2E match="":
3436
#!/usr/bin/env bash
3537
mkdir -p tmp/bin
@@ -95,35 +97,69 @@ E2E match="":
9597
owner=$(anti wallet info | jq -r '.owner')
9698
export ANTI_AGENT_PUBLIC_KEY_HASH=$owner
9799
echo "Starting E2E tests..."
98-
just E2E-tests "{{match}}"
100+
just E2E-tests "{{ match }}"
99101

100102
E2E-tests match="":
101103
#!/usr/bin/env bash
102104
# shellcheck disable=SC2050
103-
if [[ '{{match}}' == "" ]]; then
105+
if [[ '{{ match }}' == "" ]]; then
104106
cabal test anti-E2E-test \
105107
--test-show-details=direct
106108
else
107109
cabal test anti-E2E-test \
108110
--test-show-details=direct \
109111
--test-option=--match \
110-
--test-option="{{match}}"
112+
--test-option="{{ match }}"
111113
fi
112114

113115
CI:
114-
#!/usr/bin/env bash
115-
set -euo pipefail
116-
just build
117-
just unit
118-
just E2E
119-
cabal-fmt -c anti.cabal CI/rewrite-libs/rewrite-libs.cabal
120-
fourmolu -m check src app test CI/rewrite-libs
121-
hlint -c src app test CI/rewrite-libs
116+
#!/usr/bin/env bash
117+
set -euo pipefail
118+
just build
119+
just unit
120+
just E2E
121+
cabal-fmt -c anti.cabal CI/rewrite-libs/rewrite-libs.cabal
122+
fourmolu -m check src app test CI/rewrite-libs
123+
hlint -c src app test CI/rewrite-libs
122124

123125
start-mpfs:
124-
#!/usr/bin/env bash
125-
docker compose -p "anti-testing" -f test-E2E/fixtures/docker-compose.yml up -d
126+
#!/usr/bin/env bash
127+
docker compose -p "anti-testing" -f test-E2E/fixtures/docker-compose.yml up -d
126128

127129
stop-mpfs:
128-
#!/usr/bin/env bash
129-
docker compose -p "anti-testing" -f test-E2E/fixtures/docker-compose.yml down
130+
#!/usr/bin/env bash
131+
docker compose -p "anti-testing" -f test-E2E/fixtures/docker-compose.yml down
132+
133+
start-anti-agent bg="false":
134+
#!/usr/bin/env bash
135+
nix build .#anti-agent-docker-image
136+
docker load < result
137+
version=$(nix eval --raw .#version)
138+
docker image tag cardano-foundation/anti-agent:"$version" cardano-foundation/anti-agent:latest
139+
# shellcheck disable=SC2050
140+
if [[ '{{ bg }}' == "true" ]]; then
141+
docker compose -f CD/anti-agent/docker-compose.yaml up -d
142+
else
143+
docker compose -f CD/anti-agent/docker-compose.yaml up
144+
fi
145+
146+
logs-anti-agent:
147+
#!/usr/bin/env bash
148+
docker compose -f CD/anti-agent/docker-compose.yaml logs -f
149+
150+
start-anti-oracle bg="false":
151+
#!/usr/bin/env bash
152+
nix build .#anti-oracle-docker-image
153+
docker load < result
154+
version=$(nix eval --raw .#version)
155+
docker image tag cardano-foundation/anti-oracle:"$version" cardano-foundation/anti-oracle:latest
156+
# shellcheck disable=SC2050
157+
if [[ '{{ bg }}' == "true" ]]; then
158+
docker compose -f CD/anti-oracle/docker-compose.yaml up -d
159+
else
160+
docker compose -f CD/anti-oracle/docker-compose.yaml up
161+
fi
162+
163+
logs-anti-oracle:
164+
#!/usr/bin/env bash
165+
docker compose -f CD/anti-oracle/docker-compose.yaml logs -f

0 commit comments

Comments
 (0)