Files
action-ci/README.md
T

29 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# action-ci
action repo 的共用 CI:先 `shellcheck`,再(可選)在 `ci-env` 容器裡跑 Go 腳本測試(`GO_VERSION=go.mod`,用 go.mod 的版本),最後(可選)`docker build` 檢查映像檔。
```yaml
steps:
- uses: actions/checkout@v4
- uses: https://gitea.jsc.idv.tw/actions/action-ci@${{ vars.ACTION_ACTION_CI_VERSION }}
with:
go_test: true
docker_build: true
```
## 輸入
|名稱|預設|說明|
|---|---|---|
|`shellcheck_files`|`*.sh`|shellcheck 要檢查的檔案(空白分隔、可用萬用字元),沒有符合的就略過|
|`go_test`|`false`|`true`=跑 Go 測試|
|`go_test_command`|`go vet ./... && go test ./test/`|Go 測試的指令|
|`docker_build`|`false`|`true`=`docker build` 檢查 Dockerfile,映像檔標籤是 `action-test:<sha>`(唯一,不會撞到 runner 上的舊映像檔)|
|`docker_run_args`||建置後實際執行容器的 entrypoint 參數(每行一個),空=不執行|
|`docker_run_options`||執行容器的 `docker create` 選項(每行一個,例如 `--env=INPUT_TASK=x`)|
|`docker_run_expect`||容器輸出必須包含的字串,空=只檢查結束碼|
不要對 Docker action 用 `uses: ./` 自測:這台 runner 會依名稱重用舊映像檔,可能跑到別的專案的映像檔。內部用的 `shellcheck`、`ci-env` 版本取自呼叫端 repo 的 Gitea 變數 `ACTION_SHELLCHECK_VERSION`、`ACTION_CI_ENV_VERSION`(不寫死在 `action.yml`),所以呼叫端要先設好這兩個變數。
圖示:`icon.svg`(頭像用 `icon.png`)。