@@ -0,0 +1,18 @@
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
test:
|
||||
runs-on: docker-ubuntu
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./
|
||||
with:
|
||||
cache_key: ci-run-selftest-${{ github.sha }}
|
||||
cache_restore_keys: ci-run-selftest-
|
||||
command: echo ok
|
||||
@@ -0,0 +1,29 @@
|
||||
# ci-run
|
||||
|
||||
組合 `ci-cache` 與 `ci-env`:先還原快取,再在容器裡執行指令。
|
||||
|
||||
## 用法
|
||||
|
||||
版本由呼叫端的 Gitea Actions 變數決定(例如 `vars.ACTION_CI_RUN_VERSION`),不要用分支名稱:runner 依 ref 重用舊映像檔,改了腳本不會生效,所以每次改動都發新標籤。
|
||||
|
||||
```yaml
|
||||
- uses: https://gitea.jsc.idv.tw/actions/ci-run@${{ vars.ACTION_CI_RUN_VERSION }}
|
||||
with:
|
||||
command: ...
|
||||
cache_key: ...
|
||||
```
|
||||
|
||||
## 輸入
|
||||
|
||||
|名稱|必填|預設|說明|
|
||||
|---|---|---|---|
|
||||
|`command`|是||要在 ci-env 容器裡執行的 shell 指令|
|
||||
|`cache_key`|是||快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}|
|
||||
|`cache_restore_keys`|||找不到完全相同的 key 時,依序嘗試的前綴(每行一個)|
|
||||
|`name`||`ci`|執行指令的步驟名稱|
|
||||
|
||||
## 開發
|
||||
|
||||
`ci.yaml` 跑 ,並用 `uses: ./` 實際執行一次。
|
||||
|
||||
圖示:`icon.svg`(Gitea 儲存庫頭像用 `icon.png`)。
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
name: ci-run
|
||||
description: "跑一個 CI 工作:還原快取(ci-cache)→ 在 ci-env 容器裡執行指令。要在 checkout 之後使用,需要工具鏈時呼叫的工作流要有 env: GO_VERSION、NODE_VERSION"
|
||||
inputs:
|
||||
command:
|
||||
description: "要在 ci-env 容器裡執行的 shell 指令"
|
||||
required: true
|
||||
cache_key:
|
||||
description: "快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}"
|
||||
required: true
|
||||
cache_restore_keys:
|
||||
description: "找不到完全相同的 key 時,依序嘗試的前綴(每行一個)"
|
||||
default: ""
|
||||
name:
|
||||
description: "執行指令的步驟名稱"
|
||||
default: ci
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: https://gitea.jsc.idv.tw/actions/ci-cache@v0.0.1
|
||||
with:
|
||||
key: ${{ inputs.cache_key }}
|
||||
restore_keys: ${{ inputs.cache_restore_keys }}
|
||||
- name: ${{ inputs.name }}
|
||||
uses: https://gitea.jsc.idv.tw/actions/ci-env@v0.0.1
|
||||
with:
|
||||
command: ${{ inputs.command }}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><rect width="512" height="512" rx="104" fill="#16a34a"/><circle fill="none" stroke="#fff" stroke-width="28" stroke-linecap="round" stroke-linejoin="round" cx="256" cy="256" r="150"/><path d="M222 184 330 256 222 328Z" fill="#fff" stroke="#fff" stroke-width="20" stroke-linejoin="round"/></svg>
|
||||
|
After Width: | Height: | Size: 380 B |
Reference in New Issue
Block a user