Skip to content

Commit 4966202

Browse files
committed
docs(cli): clarifier usage CI/CD et workspace apply
1 parent 80b9f6f commit 4966202

1 file changed

Lines changed: 70 additions & 24 deletions

File tree

docs/ci_cd_ark_cli.md

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ This page provides a practical and reproducible CI/CD flow using `pycompiler_ark
66

77
Automate the following steps for a workspace:
88

9-
1. Initialize workspace base files
10-
2. Detect/configure the entrypoint
11-
3. Run a strict precheck gate
12-
4. Compile with a selected engine
9+
1. Apply workspace setup in one deterministic step
10+
2. Run a strict precheck gate
11+
3. Compile with a selected engine
1312

1413
## Prerequisites
1514

@@ -30,17 +29,20 @@ ARK_BIN="python3 /path/to/PyCompiler_ARK/pycompiler_ark.py"
3029
WORKSPACE_DIR="/path/to/workspace"
3130
ENGINE_ID="pyinstaller"
3231

33-
$ARK_BIN init "$WORKSPACE_DIR" --with-venv --json > "$WORKSPACE_DIR/.ark_init.json"
34-
$ARK_BIN cfg-auto "$WORKSPACE_DIR" --json > "$WORKSPACE_DIR/.ark_cfg_auto.json"
32+
# Single-step workspace flow (init + auto-config + inspect)
33+
$ARK_BIN workspace apply "$WORKSPACE_DIR" --with-venv --strict --json > "$WORKSPACE_DIR/.ark_workspace_apply.json"
34+
35+
# Optional explicit gate (kept in many teams for readability in CI logs)
3536
$ARK_BIN check "$WORKSPACE_DIR" --json --strict > "$WORKSPACE_DIR/.ark_check.json"
3637

3738
ENTRYPOINT_REL="$(python3 - <<'PY'
3839
import json, os
3940
from pathlib import Path
4041
ws = os.environ["WORKSPACE_DIR"]
41-
cfg = Path(ws) / ".ark_cfg_auto.json"
42-
data = json.loads(cfg.read_text(encoding="utf-8"))
43-
print(data.get("entrypoint") or "main.py")
42+
report = Path(ws) / ".ark_workspace_apply.json"
43+
data = json.loads(report.read_text(encoding="utf-8"))
44+
inspect_payload = data.get("inspect") or {}
45+
print(inspect_payload.get("entrypoint") or "main.py")
4446
PY
4547
)"
4648
ENTRYPOINT_FILE="$WORKSPACE_DIR/$ENTRYPOINT_REL"
@@ -51,14 +53,11 @@ $ARK_BIN engine compile "$ENGINE_ID" "$ENTRYPOINT_FILE" --workspace "$WORKSPACE_
5153

5254
## Command Breakdown
5355

54-
- `init --with-venv`
55-
- prepares workspace
56-
- creates `ARK_Main_Config.yml`, `bcasl.yml`, `.ark/pref.json`
57-
- creates/reuses a local virtual environment
58-
59-
- `cfg-auto`
60-
- detects an entrypoint
61-
- updates workspace configuration
56+
- `workspace apply --with-venv --strict`
57+
- applies full workspace setup in one command
58+
- creates/reuses `ARK_Main_Config.yml`, `bcasl.yml`, `.ark/pref.json`
59+
- runs auto-config (unless disabled)
60+
- can fail with strict precheck semantics when entrypoint is required
6261

6362
- `check --strict`
6463
- CI/CD gate
@@ -67,6 +66,43 @@ $ARK_BIN engine compile "$ENGINE_ID" "$ENTRYPOINT_FILE" --workspace "$WORKSPACE_
6766
- `engine compile`
6867
- compiles the resolved entrypoint with the selected engine
6968

69+
## Workspace Apply Options (CI-focused)
70+
71+
`workspace apply` (and alias `workspace select`) supports options designed for pipelines:
72+
73+
- `--with-venv`
74+
- create/reuse workspace virtual environment
75+
- `--entrypoint <path>`
76+
- force entrypoint instead of relying on detection
77+
- `--no-auto-config`
78+
- skip auto-configuration stage (useful for fully pre-committed config flows)
79+
- `--no-inspect-files`
80+
- skip recursive `.py` workspace scan
81+
- `--no-apply-venv-pref`
82+
- skip applying `.ark/pref.json` workspace venv preference
83+
- `--no-apply-engine-configs`
84+
- skip loading `.ark/<engine_id>/config.json` workspace engine configs
85+
- `--strict`
86+
- fail when required checks are missing
87+
- `--require-entrypoint`
88+
- explicit entrypoint requirement (also implied by `--strict`)
89+
- `--json`
90+
- machine-readable output for pipeline parsing
91+
92+
Examples:
93+
94+
```bash
95+
# Strict default for CI
96+
python3 /path/to/PyCompiler_ARK/pycompiler_ark.py workspace apply /path/to/workspace --with-venv --strict --json
97+
98+
# Explicit entrypoint override
99+
python3 /path/to/PyCompiler_ARK/pycompiler_ark.py workspace apply /path/to/workspace --entrypoint src/main.py --json
100+
101+
# Alias forms
102+
python3 /path/to/PyCompiler_ARK/pycompiler_ark.py workspace select /path/to/workspace --json
103+
python3 /path/to/PyCompiler_ARK/pycompiler_ark.py ws apply /path/to/workspace --json
104+
```
105+
70106
## Choosing an Engine
71107
72108
List available engines:
@@ -89,23 +125,23 @@ Common choices:
89125
- `4`: invalid workspace
90126
- `5`: engine not found
91127
92-
## Ready-to-use Script
128+
## Reusable Shell Wrapper (optional)
93129
94-
A concrete validated example can be run with:
130+
If your team prefers a checked-in shell wrapper, create a script that chains:
95131
96-
```bash
97-
./ci_cd_ark.sh
98-
```
132+
1. `workspace apply ... --json`
133+
2. `check ... --json --strict`
134+
3. `engine compile ... --json`
99135
100-
This script chains `init`, `cfg-auto`, `check`, and `engine compile`, and writes JSON reports.
136+
Then archive JSON outputs as CI artifacts for troubleshooting.
101137
102138
## GitHub Actions Dogfooding Workflow
103139
104140
This repository includes a workflow where ARK compiles itself using ARK CLI:
105141
106142
- Workflow file: `.github/workflows/ark-self-build.yml`
107143
- Engine used: `nuitka`
108-
- Flow: `init` -> `cfg-auto` -> `check --strict` -> `engine compile`
144+
- Flow: `workspace apply` (or `init` + `cfg-auto`) -> `check --strict` -> `engine compile`
109145
- Uploaded artifacts:
110146
- build output (`dist/`, `build/` when available)
111147
- ARK workspace reports (`.ark_ci_artifacts/*.json`)
@@ -121,6 +157,16 @@ This repository includes a workflow where ARK compiles itself using ARK CLI:
121157
- Keep `.ark_*.json` files as CI artifacts for debugging.
122158
- Start with `pyinstaller`, then evaluate `nuitka` if you want runtime performance optimization.
123159
160+
## GUI Selection Equivalent in CLI
161+
162+
When users say "select workspace" in GUI terms, the CI/CD equivalent is:
163+
164+
```bash
165+
python3 /path/to/PyCompiler_ARK/pycompiler_ark.py workspace apply /path/to/workspace --with-venv --strict
166+
```
167+
168+
This gives a deterministic, scriptable workflow that mirrors the practical setup steps usually performed after selecting a workspace in the GUI.
169+
124170
## Reproducibility Note for Engine Options
125171
126172
For full reproducibility, engine-specific options should be configured from the GUI first.

0 commit comments

Comments
 (0)