開始使用

快速開始

在 Windows 專案根目錄建立 watt.yaml,先檢查設定與環境,再執行你的第一個 pipeline。

1. 安裝 Watt

在 Windows PowerShell 5.1 或 PowerShell 7+ 執行這一行,安裝器會安裝最新官方 snapshot 預發布版到 %LOCALAPPDATA%\Programs\Watt\watt.exe,並只安全地更新你的 User PATH:

PowerShell
irm https://raw.githubusercontent.com/bext1998/WattCIAutomationEngine/main/install.ps1 | iex

安裝器會先在暫存位置下載 watt.exe 和 watt.exe.sha256,確認 SHA-256 後才寫入正式位置;不需要系統管理員權限、不修改 Machine PATH,也不會呼叫 Unblock-File,或主動移除/繞過 Windows 已附加的安全識別資訊。其他已開啟的終端請重新啟動。

想先看過再執行,請先下載並檢視腳本(閱讀 install.ps1 原始碼):

PowerShell
irm https://raw.githubusercontent.com/bext1998/WattCIAutomationEngine/main/install.ps1 -OutFile .\install.ps1
notepad .\install.ps1
.\install.ps1

手動下載也可以:從同一個 Release 取得 watt.exe 與 watt.exe.sha256,自行驗證後放進你選擇的資料夾並加入 User PATH。checksum 只能檢查下載完整性,不是數位簽章,也不能單獨證明發布者身分。

完成後,確認指令可用:

PowerShell
watt --version
watt --help

2. 建立第一份 pipeline

在要驗證的專案根目錄建立 watt.yaml。以下範例會執行 Go 測試;請替換成你的專案實際指令。

watt.yaml
version: 1

pipelines:
  default:
    steps:
      - name: Test
        exec: go
        args: ["test", "./..."]

3. 先檢查,再執行

watt check 只驗證 YAML 結構與欄位規則,不會啟動任何 step。加上 --env 後,Watt 也會確認 pipeline 使用的 command 與 shell 是否可在 PATH 找到。

PowerShell
watt check --env
watt run

執行成功後,Watt 會在專案的 .watt/result.json 寫入結果。需要挑選其他具名 pipeline 時,使用 watt run <名稱>。

提示:watt check 不會寫入 result.json;只有通過載入與靜態驗證後的 watt run 才會產生結果檔(不保證寫入一定成功,寫入失敗時會以結束碼 5 回報)。

下一步

繼續閱讀 watt.yaml Pipeline 撰寫手冊,加入更多 steps、工作目錄或專案專屬環境變數。