Skip to content

Commit 2a6b9cd

Browse files
authored
Create ckb-compatible.yml
1 parent fd3c52f commit 2a6b9cd

File tree

1 file changed

+132
-0
lines changed

1 file changed

+132
-0
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: CKB Start Validation
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
workflow_dispatch:
11+
inputs:
12+
ckb_version:
13+
description: 'CKB Version (e.g., v0.200.0-rc1)'
14+
required: true
15+
default: 'v0.200.0-rc1'
16+
17+
jobs:
18+
ckb-start-validation:
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ macos-13, macos-14, ubuntu-22.04, ubuntu-22.04-arm64, centos-8, windows-latest ]
24+
include:
25+
- os: ubuntu-22.04
26+
arch: x64
27+
- os: ubuntu-22.04-arm64
28+
arch: arm64
29+
runs-on: [ self-hosted, ubuntu-22.04-arm64, ARM64, Linux ]
30+
- os: macos-13
31+
arch: x86
32+
- os: macos-14
33+
arch: arm64
34+
- os: centos-8
35+
arch: x64
36+
runs-on: [ self-hosted, centos8, X64, Linux ]
37+
- os: windows-latest
38+
arch: x64
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v3
43+
44+
- name: Set CKB Release URL
45+
run: |
46+
echo "CKB_RELEASE_URL=https://github.com/nervosnetwork/ckb/releases/download/${{ github.event.inputs.ckb_version }}" >> $GITHUB_ENV
47+
shell: bash # Linux and macOS use bash
48+
49+
- name: Set CKB Release URL for Windows
50+
if: runner.os == 'Windows'
51+
shell: pwsh
52+
run: |
53+
$env:CKB_RELEASE_URL = "https://github.com/nervosnetwork/ckb/releases/download/${{ github.event.inputs.ckb_version }}"
54+
# Ensure GITHUB_ENV is correctly set
55+
if ($env:GITHUB_ENV) {
56+
echo "CKB_RELEASE_URL=$env:CKB_RELEASE_URL" | Out-File -FilePath $env:GITHUB_ENV -Append
57+
} else {
58+
Write-Error "GITHUB_ENV is not set."
59+
}
60+
61+
- name: Download and extract CKB (Linux and macOS)
62+
if: runner.os != 'Windows'
63+
run: |
64+
case "${{ matrix.os }}-${{ matrix.arch }}" in
65+
"ubuntu-22.04-x64")
66+
curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-linux-gnu.tar.gz
67+
tar -xzf ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-linux-gnu.tar.gz
68+
;;
69+
"ubuntu-22.04-arm64-arm64")
70+
curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_aarch64-unknown-linux-gnu.tar.gz
71+
tar -xzf ckb_${{ github.event.inputs.ckb_version }}_aarch64-unknown-linux-gnu.tar.gz
72+
;;
73+
"macos-13-x86")
74+
curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-apple-darwin-portable.zip
75+
unzip ckb_${{ github.event.inputs.ckb_version }}_x86_64-apple-darwin-portable.zip
76+
;;
77+
"macos-14-arm64")
78+
curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_aarch64-apple-darwin-portable.zip
79+
unzip ckb_${{ github.event.inputs.ckb_version }}_aarch64-apple-darwin-portable.zip
80+
;;
81+
"centos-8-x64")
82+
curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-centos-gnu-portable.tar.gz
83+
tar -xzf ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-centos-gnu-portable.tar.gz
84+
;;
85+
*)
86+
echo "Unsupported OS or architecture: ${{ matrix.os }} ${{ matrix.arch }}"
87+
exit 1
88+
;;
89+
esac
90+
91+
- name: Download and extract CKB (Windows)
92+
if: runner.os == 'Windows'
93+
run: |
94+
curl -LO $env:CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-pc-windows-msvc.zip
95+
Expand-Archive -Path ckb_${{ github.event.inputs.ckb_version }}_x86_64-pc-windows-msvc.zip -DestinationPath .
96+
97+
- name: Run CKB node (Linux and macOS)
98+
if: runner.os != 'Windows'
99+
run: |
100+
echo "Current OS: $(uname -s)"
101+
echo "Current Architecture: $(uname -m)"
102+
103+
case "${{ matrix.os }}" in
104+
"ubuntu-22.04")
105+
./ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-linux-gnu/ckb init
106+
;;
107+
"ubuntu-22.04-arm64")
108+
./ckb_${{ github.event.inputs.ckb_version }}_aarch64-unknown-linux-gnu/ckb init
109+
;;
110+
"centos-8")
111+
./ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-centos-gnu-portable/ckb init
112+
;;
113+
"macos-13")
114+
./ckb_${{ github.event.inputs.ckb_version }}_x86_64-apple-darwin-portable/ckb init
115+
;;
116+
"macos-14")
117+
./ckb_${{ github.event.inputs.ckb_version }}_aarch64-apple-darwin-portable/ckb init
118+
;;
119+
*)
120+
echo "Unsupported OS: ${{ matrix.os }}"
121+
exit 1
122+
;;
123+
esac
124+
125+
- name: Run CKB node (Windows)
126+
if: runner.os == 'Windows'
127+
run: |
128+
powershell -Command "./ckb_${{ github.event.inputs.ckb_version }}_x86_64-pc-windows-msvc/ckb.exe init"
129+
if ($LASTEXITCODE -ne 0) {
130+
Write-Error "CKB init failed."
131+
}
132+
shell: pwsh

0 commit comments

Comments
 (0)