-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
136 lines (101 loc) · 6.03 KB
/
Copy pathjustfile
File metadata and controls
136 lines (101 loc) · 6.03 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
132
133
134
135
136
set shell := ["bash", "-euo", "pipefail", "-c"]
docker-image := env_var_or_default("GITHUB_ACTIONSPEC_DOCKER_IMAGE", "github-actionspec-rs-dev:local")
runtime-image := env_var_or_default("GITHUB_ACTIONSPEC_RUNTIME_IMAGE", "github-actionspec-rs:local")
docker-runner := "./scripts/docker/run.sh"
docker-runtime-runner := "./scripts/docker/run-runtime.sh"
host-runner := "mise exec --"
cue-go-version := `version="$(sed -n 's/^"asdf:asdf-community\/asdf-cue" = "\(.*\)"$/\1/p' .mise.toml | head -n1)"; if [ -z "$version" ]; then echo "failed to resolve CUE version from .mise.toml" >&2; exit 1; fi; case "$version" in v*) printf '%s' "$version" ;; *) printf 'v%s' "$version" ;; esac`
default:
@just --list
install:
mise install
docker-build:
CUE_VERSION={{cue-go-version}} IMAGE_TAG={{docker-image}} docker buildx bake --load dev
docker-build-runtime:
CUE_VERSION={{cue-go-version}} RUNTIME_IMAGE_TAG={{runtime-image}} docker buildx bake --load runtime
docker-smoke-runtime:
{{docker-runtime-runner}} --help
docker-run-runtime:
just docker-build-runtime
just docker-smoke-runtime
docker-push-runtime image="docker.io/valproik/github-actionspec-rs:latest":
CUE_VERSION={{cue-go-version}} RUNTIME_IMAGE_TAG={{image}} docker buildx bake --push runtime
runtime-ci:
just docker-build-runtime
just docker-smoke-runtime
fmt:
just docker-build
{{docker-runner}} cargo fmt
fmt-check:
just docker-build
{{docker-runner}} cargo fmt --check
build:
just docker-build
{{docker-runner}} cargo build --locked
check:
just docker-build
{{docker-runner}} cargo check --locked
clippy:
just docker-build
{{docker-runner}} cargo clippy --all-targets --all-features --locked -- -D warnings
lint:
just docker-build
{{docker-runner}} cargo fmt --check
{{docker-runner}} cargo clippy --all-targets --all-features --locked -- -D warnings
{{docker-runner}} cargo run -- validate-callers --repo .
test:
just docker-build
{{docker-runner}} cargo test --locked
bench-bootstrap:
just docker-build
{{docker-runner}} cargo test --release --locked --test bootstrap_benchmark -- --ignored --nocapture
coverage:
just docker-build
{{docker-runner}} cargo llvm-cov --all-features --workspace --html
coverage-summary:
just docker-build
{{docker-runner}} cargo llvm-cov --all-features --workspace --summary-only
coverage-ci:
just docker-build
# `cargo llvm-cov --output-path` does not create the parent directory for us.
mkdir -p target/llvm-cov
{{docker-runner}} cargo llvm-cov --all-features --workspace --lcov --output-path target/llvm-cov/lcov.info
ci:
just docker-build
{{docker-runner}} cargo build --locked
{{docker-runner}} cargo fmt --check
{{docker-runner}} cargo clippy --all-targets --all-features --locked -- -D warnings
{{docker-runner}} cargo run -- validate-callers --repo .
{{docker-runner}} cargo test --locked
pr-create base="main":
{{host-runner}} gh pr create --base {{base}} --fill
pr-create-draft base="main":
{{host-runner}} gh pr create --base {{base}} --fill --draft
discover repo=".":
{{host-runner}} cargo run -- discover --repo {{repo}}
bootstrap-actionspec repo workflow actual="" force="false":
actual_arg=""; if [ -n "{{actual}}" ]; then actual_arg=" --actual {{actual}}"; fi; force_arg=""; if [ "{{force}}" = "true" ]; then force_arg=" --force"; fi; eval "{{host-runner}} cargo run -- bootstrap --repo {{repo}} --workflow {{workflow}}$actual_arg$force_arg"
emit-fragment job result file:
{{host-runner}} cargo run -- emit-fragment --job {{job}} --result {{result}} --file {{file}}
capture workflow output job_file ref="":
if [ -n "{{ref}}" ]; then {{host-runner}} cargo run -- capture --workflow {{workflow}} --ref {{ref}} --job-file {{job_file}} --output {{output}}; else {{host-runner}} cargo run -- capture --workflow {{workflow}} --job-file {{job_file}} --output {{output}}; fi
validate-callers repo=".":
{{host-runner}} cargo run -- validate-callers --repo {{repo}}
validate-callers-report repo report:
{{host-runner}} cargo run -- validate-callers --repo {{repo}} --report-file {{report}} --dry-run
validate-repo repo workflow actual:
{{host-runner}} cargo run -- validate-repo --repo {{repo}} --workflow {{workflow}} --actual {{actual}}
validate-repo-report repo workflow actual report:
just docker-build
{{docker-runner}} cargo run -- validate-repo --repo {{repo}} --workflow {{workflow}} --actual {{actual}} --report-file {{report}}
validate-repo-report-dry repo workflow actual report:
just docker-build
{{docker-runner}} cargo run -- validate-repo --repo {{repo}} --workflow {{workflow}} --actual {{actual}} --report-file {{report}} --dry-run
validate-repo-dashboard repo workflow actual report dashboard baseline="" output_keys="" dry="false":
just docker-build
status=0; dry_arg=""; if [ "{{dry}}" = "true" ]; then dry_arg=" --dry-run"; fi; if ! eval "{{docker-runner}} cargo run -- validate-repo --repo {{repo}} --workflow {{workflow}} --actual {{actual}} --report-file {{report}}$dry_arg"; then status=$?; fi; if [ -f "{{report}}" ]; then output_key_args="$(printf '%s\n' '{{output_keys}}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | awk 'NF {printf " --output-key %s", $0}')"; if [ -n "{{baseline}}" ]; then eval "{{docker-runner}} cargo run -- dashboard --current {{report}} --baseline {{baseline}} --output {{dashboard}}$output_key_args"; else eval "{{docker-runner}} cargo run -- dashboard --current {{report}} --output {{dashboard}}$output_key_args"; fi; fi; exit "$status"
dashboard-report current output baseline="" output_keys="":
just docker-build
output_key_args="$(printf '%s\n' '{{output_keys}}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | awk 'NF {printf " --output-key %s", $0}')"; if [ -n "{{baseline}}" ]; then eval "{{docker-runner}} cargo run -- dashboard --current {{current}} --baseline {{baseline}} --output {{output}}$output_key_args"; else eval "{{docker-runner}} cargo run -- dashboard --current {{current}} --output {{output}}$output_key_args"; fi
validate schema contract actual:
{{host-runner}} cargo run -- validate --schema {{schema}} --contract {{contract}} --actual {{actual}}