CKB Start Validation #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CKB Start Validation | |
| on: | |
| push: | |
| branches: | |
| - ckb-compatible | |
| pull_request: | |
| branches: | |
| - ckb-compatible | |
| workflow_dispatch: | |
| inputs: | |
| ckb_version: | |
| description: 'CKB Version (e.g., v0.201.0)' | |
| required: true | |
| default: 'v0.201.0' | |
| jobs: | |
| ckb-start-validation: | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runner: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04-arm, ubuntu-latest, windows-latest] | |
| include: | |
| - runner: ubuntu-22.04 | |
| arch: x64 | |
| os: ubuntu-22.04 | |
| - runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| os: ubuntu-24.04-arm | |
| - runner: macos-13 | |
| arch: x86 | |
| os: macos-13 | |
| - runner: macos-14 | |
| arch: arm64 | |
| os: macos-14 | |
| - runner: ubuntu-latest | |
| arch: x64 | |
| os: centos-8 | |
| - runner: windows-latest | |
| arch: x64 | |
| os: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set CKB Release URL | |
| run: | | |
| echo "CKB_RELEASE_URL=https://github.com/nervosnetwork/ckb/releases/download/${{ github.event.inputs.ckb_version }}" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Set CKB Release URL for Windows | |
| if: matrix.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| $env:CKB_RELEASE_URL = "https://github.com/nervosnetwork/ckb/releases/download/${{ github.event.inputs.ckb_version }}" | |
| if ($env:GITHUB_ENV) { | |
| echo "CKB_RELEASE_URL=$env:CKB_RELEASE_URL" | Out-File -FilePath $env:GITHUB_ENV -Append | |
| } else { | |
| Write-Error "GITHUB_ENV is not set." | |
| } | |
| - name: Download CKB (Linux and macOS) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| case "${{ matrix.os }}-${{ matrix.arch }}" in | |
| "ubuntu-22.04-x64") | |
| curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-linux-gnu.tar.gz | |
| ;; | |
| "ubuntu-24.04-arm-arm64") | |
| curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_aarch64-unknown-linux-gnu.tar.gz | |
| ;; | |
| "macos-13-x86") | |
| curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-apple-darwin-portable.zip | |
| ;; | |
| "macos-14-arm64") | |
| curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_aarch64-apple-darwin-portable.zip | |
| ;; | |
| "centos-8-x64") | |
| curl -LO $CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-centos-gnu-portable.tar.gz | |
| ;; | |
| *) | |
| echo "Unsupported OS or architecture: ${{ matrix.os }} ${{ matrix.arch }}" | |
| exit 1 | |
| ;; | |
| esac | |
| shell: bash | |
| - name: Extract and run CKB in CentOS 8 container | |
| if: matrix.os == 'centos-8' | |
| run: | | |
| tar -xzf ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-centos-gnu-portable.tar.gz | |
| docker run --rm -i -w /ckb -v $(pwd):/ckb docker.io/jiangxianliang/centos:centos8 bash -c "cd ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-centos-gnu-portable && ./ckb init" | |
| shell: bash | |
| - name: Extract and run CKB (Linux and macOS, non-CentOS) | |
| if: matrix.os != 'windows-latest' && matrix.os != 'centos-8' | |
| run: | | |
| echo "Current OS: $(uname -s)" | |
| echo "Current Architecture: $(uname -m)" | |
| case "${{ matrix.os }}" in | |
| "ubuntu-22.04") | |
| tar -xzf ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-linux-gnu.tar.gz | |
| ./ckb_${{ github.event.inputs.ckb_version }}_x86_64-unknown-linux-gnu/ckb init | |
| ;; | |
| "ubuntu-24.04-arm") | |
| tar -xzf ckb_${{ github.event.inputs.ckb_version }}_aarch64-unknown-linux-gnu.tar.gz | |
| ./ckb_${{ github.event.inputs.ckb_version }}_aarch64-unknown-linux-gnu/ckb init | |
| ;; | |
| "macos-13") | |
| unzip ckb_${{ github.event.inputs.ckb_version }}_x86_64-apple-darwin-portable.zip | |
| ./ckb_${{ github.event.inputs.ckb_version }}_x86_64-apple-darwin-portable/ckb init | |
| ;; | |
| "macos-14") | |
| unzip ckb_${{ github.event.inputs.ckb_version }}_aarch64-apple-darwin-portable.zip | |
| ./ckb_${{ github.event.inputs.ckb_version }}_aarch64-apple-darwin-portable/ckb init | |
| ;; | |
| *) | |
| echo "Unsupported OS: ${{ matrix.os }}" | |
| exit 1 | |
| ;; | |
| esac | |
| shell: bash | |
| - name: Download and extract CKB (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| curl -LO $env:CKB_RELEASE_URL/ckb_${{ github.event.inputs.ckb_version }}_x86_64-pc-windows-msvc.zip | |
| Expand-Archive -Path ckb_${{ github.event.inputs.ckb_version }}_x86_64-pc-windows-msvc.zip -DestinationPath . | |
| shell: pwsh | |
| - name: Run CKB node (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| powershell -Command "./ckb_${{ github.event.inputs.ckb_version }}_x86_64-pc-windows-msvc/ckb.exe init" | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "CKB init failed." | |
| } | |
| shell: pwsh |