34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
name: action-ci
|
||
description: "action repo 的共用 CI:shellcheck → Go 腳本測試(在 ci-env 容器裡,Go 版本取 go.mod)→ 建置映像檔。要在 checkout 之後使用,各步驟用輸入開關"
|
||
inputs:
|
||
shellcheck_files:
|
||
description: "shellcheck 要檢查的檔案(空白分隔,可用萬用字元);沒有符合的檔案就略過"
|
||
default: "*.sh"
|
||
go_test:
|
||
description: "true=跑 Go 測試"
|
||
default: "false"
|
||
go_test_command:
|
||
description: "go_test 為 true 時執行的指令"
|
||
default: "go vet ./... && go test ./test/"
|
||
docker_build:
|
||
description: "true=用 docker build 檢查 Dockerfile 建得起來"
|
||
default: "false"
|
||
runs:
|
||
using: composite
|
||
steps:
|
||
- name: shellcheck
|
||
uses: https://gitea.jsc.idv.tw/actions/shellcheck@v0.0.1
|
||
with:
|
||
files: ${{ inputs.shellcheck_files }}
|
||
- name: Go 測試
|
||
if: ${{ inputs.go_test == 'true' }}
|
||
uses: https://gitea.jsc.idv.tw/actions/ci-env@v0.0.2
|
||
env:
|
||
GO_VERSION: go.mod
|
||
with:
|
||
command: ${{ inputs.go_test_command }}
|
||
- name: 建置映像檔
|
||
if: ${{ inputs.docker_build == 'true' }}
|
||
shell: bash
|
||
run: docker build -t "action-test:$GITHUB_SHA" .
|