@@ -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:
|
||||||
|
key: ci-cache-selftest-${{ github.sha }}
|
||||||
|
restore_keys: ci-cache-selftest-
|
||||||
|
path: .ci-home
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# ci-cache
|
||||||
|
|
||||||
|
包一層 `actions/cache`,預設快取 workspace 的 `.ci-home`(Go 模組與建置快取、npm、工具鏈、rod 下載的 Chromium)。key 由呼叫端用 `hashFiles` 算好傳入。
|
||||||
|
|
||||||
|
## 用法
|
||||||
|
|
||||||
|
版本由呼叫端的 Gitea Actions 變數決定(例如 `vars.ACTION_CI_CACHE_VERSION`),不要用分支名稱:runner 依 ref 重用舊映像檔,改了腳本不會生效,所以每次改動都發新標籤。
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: https://gitea.jsc.idv.tw/actions/ci-cache@${{ vars.ACTION_CI_CACHE_VERSION }}
|
||||||
|
with:
|
||||||
|
key: ...
|
||||||
|
```
|
||||||
|
|
||||||
|
## 輸入
|
||||||
|
|
||||||
|
|名稱|必填|預設|說明|
|
||||||
|
|---|---|---|---|
|
||||||
|
|`key`|是||快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}|
|
||||||
|
|`restore_keys`|||找不到完全相同的 key 時,依序嘗試的前綴(每行一個),例如 ci-home-|
|
||||||
|
|`path`||`.ci-home`|要快取的路徑|
|
||||||
|
|
||||||
|
## 開發
|
||||||
|
|
||||||
|
`ci.yaml` 跑 ,並用 `uses: ./` 實際執行一次。
|
||||||
|
|
||||||
|
圖示:`icon.svg`(Gitea 儲存庫頭像用 `icon.png`)。
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
name: ci-cache
|
||||||
|
description: "還原與儲存 CI 的快取目錄(預設 workspace 的 .ci-home:Go 模組與建置快取、npm、工具鏈、rod 下載的 Chromium)。包一層 actions/cache,要在 checkout 之後使用;key 由呼叫端用 hashFiles 算好傳入"
|
||||||
|
inputs:
|
||||||
|
key:
|
||||||
|
description: "快取 key,例如 ci-home-${{ hashFiles('go.sum', 'web/package-lock.json') }}"
|
||||||
|
required: true
|
||||||
|
restore_keys:
|
||||||
|
description: "找不到完全相同的 key 時,依序嘗試的前綴(每行一個),例如 ci-home-"
|
||||||
|
default: ""
|
||||||
|
path:
|
||||||
|
description: "要快取的路徑"
|
||||||
|
default: .ci-home
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.path }}
|
||||||
|
key: ${{ inputs.key }}
|
||||||
|
restore-keys: ${{ inputs.restore_keys }}
|
||||||
@@ -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="#059669"/><ellipse fill="none" stroke="#fff" stroke-width="28" stroke-linecap="round" stroke-linejoin="round" cx="256" cy="150" rx="116" ry="44"/><path fill="none" stroke="#fff" stroke-width="28" stroke-linecap="round" stroke-linejoin="round" d="M140 150v212c0 24 52 44 116 44s116-20 116-44V150"/><path fill="none" stroke="#fff" stroke-width="28" stroke-linecap="round" stroke-linejoin="round" d="M140 256c0 24 52 44 116 44s116-20 116-44"/></svg>
|
||||||
|
After Width: | Height: | Size: 579 B |
Reference in New Issue
Block a user