-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
46 lines (40 loc) · 1.48 KB
/
justfile
File metadata and controls
46 lines (40 loc) · 1.48 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
wasm := "python-eval.wasm"
act := env("ACT", "npx @actcore/act")
actbuild := env("ACT_BUILD", "npx @actcore/act-build")
act-build := env("ACT_BUILD", "npx @actcore/act-build")
hurl := env("HURL", "npx @orangeopensource/hurl")
registry := env("OCI_REGISTRY", "ghcr.io/actpkg")
port := `npx get-port-cli`
addr := "[::1]:" + port
baseurl := "http://" + addr
init:
wit-deps
setup: init
prek install
build:
uv run componentize-py -d wit -w component-world componentize app -o {{wasm}}
{{act-build}} pack {{wasm}}
test:
#!/usr/bin/env bash
set -euo pipefail
{{act}} run {{wasm}} --http --listen "{{addr}}" &
trap "kill $!" EXIT
npx wait-on -t 180s {{baseurl}}/info
{{hurl}} --test --variable "baseurl={{baseurl}}" e2e/*.hurl
publish:
#!/usr/bin/env bash
set -euo pipefail
INFO=$({{act}} info {{wasm}} --format json)
NAME=$(echo "$INFO" | jq -r .name)
VERSION=$(echo "$INFO" | jq -r .version)
SOURCE=$(git remote get-url origin 2>/dev/null | sed 's/\.git$//' | sed 's|git@github.com:|https://github.com/|' || echo "")
OUTPUT=$({{actbuild}} push {{wasm}} "{{registry}}/$NAME:$VERSION" \
--skip-if-exists \
--also-tag latest \
--source "$SOURCE" 2>&1) || { echo "$OUTPUT" >&2; exit 1; }
echo "$OUTPUT"
DIGEST=$(echo "$OUTPUT" | grep "^Digest:" | awk '{print $2}' || true)
if [ -n "${GITHUB_OUTPUT:-}" ]; then
echo "image={{registry}}/$NAME" >> "$GITHUB_OUTPUT"
echo "digest=$DIGEST" >> "$GITHUB_OUTPUT"
fi