forked from openclaw/openclaw
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (112 loc) 路 4.2 KB
/
Copy pathnode22-compat.yml
File metadata and controls
122 lines (112 loc) 路 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Node 22 Compat
on:
schedule:
- cron: "23 5 * * 1"
workflow_dispatch:
permissions:
actions: read
contents: read
jobs:
compat:
if: github.repository == 'openclaw/openclaw' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node environment
uses: ./.github/actions/setup-node-env
with:
cache-mode: restore
node-version: "22.23.2"
install-bun: "false"
- name: Resolve trusted declaration cache artifact
id: declaration_cache
env:
ARTIFACT_NAME: build-all-cache-v1-Linux-X64-node-22.23.2
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
set -euo pipefail
if ! runs_json="$(
gh api \
"repos/${GITHUB_REPOSITORY}/actions/workflows/node22-compat.yml/runs?branch=main&status=success&per_page=5" \
2>/dev/null
)"; then
echo "::warning::Unable to list trusted Node 22 runs; continuing cold."
exit 0
fi
while IFS=$'\t' read -r run_id source_sha; do
[[ "$run_id" =~ ^[1-9][0-9]*$ && "$source_sha" =~ ^[0-9a-f]{40}$ ]] || continue
if ! artifacts_json="$(
gh api \
"repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/artifacts?per_page=10" \
2>/dev/null
)"; then
continue
fi
artifact_id="$(
jq -r \
--arg name "$ARTIFACT_NAME" \
--arg run_id "$run_id" \
'first(.artifacts[] | select(
.expired == false and
.name == $name and
(.workflow_run.id | tostring) == $run_id
) | .id) // empty' \
<<<"$artifacts_json"
)"
if [[ ! "$artifact_id" =~ ^[1-9][0-9]*$ ]]; then
continue
fi
echo "artifact_id=$artifact_id" >> "$GITHUB_OUTPUT"
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
echo "source_sha=$source_sha" >> "$GITHUB_OUTPUT"
exit 0
done < <(
jq -r '
.workflow_runs[] |
select(
.status == "completed" and
.conclusion == "success" and
.head_branch == "main" and
(.path | split("@")[0]) == ".github/workflows/node22-compat.yml" and
(.event == "schedule" or .event == "workflow_dispatch")
) |
[.id, .head_sha] |
@tsv
' <<<"$runs_json"
)
- name: Restore trusted declaration cache artifact
if: steps.declaration_cache.outputs.artifact_id != ''
continue-on-error: true
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
artifact-ids: ${{ steps.declaration_cache.outputs.artifact_id }}
github-token: ${{ github.token }}
merge-multiple: true
path: .artifacts/build-all-cache
repository: ${{ github.repository }}
run-id: ${{ steps.declaration_cache.outputs.run_id }}
- name: Configure Node test resources
run: echo "OPENCLAW_VITEST_MAX_WORKERS=2" >> "$GITHUB_ENV"
- name: Run Node 22 compatibility
env:
NODE_OPTIONS: --max-old-space-size=8192
run: |
pnpm build
pnpm ui:build
node openclaw.mjs --help
node openclaw.mjs status --json --timeout 1
pnpm test:build:singleton
- name: Publish trusted declaration cache artifact
if: success() && github.repository == 'openclaw/openclaw' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
compression-level: 1
if-no-files-found: error
include-hidden-files: true
name: build-all-cache-v1-${{ runner.os }}-${{ runner.arch }}-node-22.23.2
overwrite: true
path: .artifacts/build-all-cache
retention-days: 14