diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d4cb30..f221f2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,11 @@ on: required: true type: number default: 0 + riscv64_count: + description: 'Number of riscv64 (QEMU) runners' + required: true + type: number + default: 0 defaults: run: @@ -46,8 +51,14 @@ jobs: run: | X86=$(seq 1 "${{ github.event.inputs.x86_64_count }}" | jq -cs '[.[] | {"os":"ubuntu-latest", "runner_id":.}]') ARM=$(seq 1 "${{ github.event.inputs.aarch64_count }}" | jq -cs '[.[] | {"os":"ubuntu-24.04-arm", "runner_id":.}]') - echo "matrix=$(jq -cn --argjson a "$X86" --argjson b "$ARM" '{include: ($a + $b)}')" >> $GITHUB_OUTPUT - echo "matrix_count=$(( ${{ github.event.inputs.x86_64_count }} + ${{ github.event.inputs.aarch64_count }} ))" >> $GITHUB_OUTPUT + RISCV=$(seq 1 "${{ github.event.inputs.riscv64_count }}" | jq -cs '[.[] | {"os":"ubuntu-latest", "runner_id":., "riscv":true}]') + #echo "matrix=$(jq -cn --argjson a "$X86" --argjson b "$ARM" '{include: ($a + $b)}')" >> $GITHUB_OUTPUT + #echo "matrix_count=$(( ${{ github.event.inputs.x86_64_count }} + ${{ github.event.inputs.aarch64_count }} ))" >> $GITHUB_OUTPUT + echo "matrix=$(jq -cn --argjson a "$X86" --argjson b "$ARM" --argjson c "$RISCV" '{include: ($a + $b + $c)}')" >> $GITHUB_OUTPUT + echo "matrix_count=$(( \ + ${{ github.event.inputs.x86_64_count }} + \ + ${{ github.event.inputs.aarch64_count }} + \ + ${{ github.event.inputs.riscv64_count }} ))" >> $GITHUB_OUTPUT WINX86=$(seq 1 "${{ github.event.inputs.win_x86_64_count }}" | jq -cs '[.[] | {"os":"windows-latest", "runner_id":.}]') echo "matrix_win=$(jq -cn --argjson a "$WINX86" '{include: ($a)}')" >> $GITHUB_OUTPUT echo "matrix_win_count=$(( ${{ github.event.inputs.win_x86_64_count }} ))" >> $GITHUB_OUTPUT @@ -95,7 +106,11 @@ jobs: chmod +x runner - name: Register Runner run: | - if [[ "$(uname -m)" == "aarch64" ]]; then + #if [[ "${{ matrix.riscv }}" == "true" ]]; then + if [[ "${{ matrix.riscv || false }}" == "true" ]]; then + printf '%s\n' '${{ secrets.RUNNER_REGISTRATION_X86_64 }}' > .runner + mv config_riscv64.yaml config.yaml + elif [[ "$(uname -m)" == "aarch64" ]]; then printf '%s\n' '${{ secrets.RUNNER_REGISTRATION_AARCH64 }}' > .runner mv config_aarch64.yaml config.yaml else @@ -122,6 +137,7 @@ jobs: - name: Get Internal Env-Vars uses: crazy-max/ghaction-github-runtime@v3 - name: Start Cacheproxy + if: ${{ !env.ACT }} run: | ./cacheproxy/genconfig.sh docker network create runnernet @@ -129,6 +145,7 @@ jobs: echo "ACTIONS_CACHE_URL_V2=http://cacheproxy:8080/" >> .env echo "ACTIONS_CACHE_SERVICE_V2=1" >> .env - name: Run Runner + if: ${{ !env.ACT }} id: runner run: | RUNNER_RET=0 diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000..f2f8ba8 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,12 @@ +extends: default + +rules: + document-start: disable + truthy: + allowed-values: ['true', 'false'] + check-keys: false + line-length: + max: 300 + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: true + diff --git a/config_riscv64.yaml b/config_riscv64.yaml new file mode 100644 index 0000000..d7904ff --- /dev/null +++ b/config_riscv64.yaml @@ -0,0 +1,52 @@ +--- +# RISC-V CI runner configuration +# +# Host platform: linux/amd64 +# Target platform: linux/riscv64 (emulated) +# +# Purpose: +# - Enable RISC-V (riscv64) CI builds on x86_64 hosts +# - Uses Docker + cross-compilation + QEMU (no native RISC-V hardware required) +# +# How it works: +# - Runner executes inside an amd64 Docker container +# - RISC-V binaries are cross-compiled using riscv64-linux-gnu toolchain +# - Smoke tests are executed using qemu-riscv64 +# +# Docker image: +# - while1skothadiya/ffmpeg-riscv-docker:latest +# (contains toolchain, QEMU, and a statically-built FFmpeg) +# - FFmpeg binary is statically linked to avoid runtime loader dependencies +# Notes: +# - This runner is NOT a native RISC-V environment +# - Label "linux-riscv64" is logical and used for job routing only +# - Privileged mode and host binfmt are intentionally avoided + +log: + level: info + job_level: info + +runner: + file: .runner + env_file: .env + capacity: 1 + timeout: 3h + shutdown_timeout: 1h + insecure: false + fetch_timeout: 5s + labels: + - "linux-riscv64:docker://while1skothadiya/ffmpeg-riscv-docker:latest" + +cache: + enabled: true + dir: /var/actcache + +host: + workdir_parent: /var/act + +container: + network: "runnernet" + enable_ipv6: false + privileged: false + force_pull: true + force_rebuild: false diff --git a/docs/ci-riscv64.md b/docs/ci-riscv64.md new file mode 100644 index 0000000..869cf30 --- /dev/null +++ b/docs/ci-riscv64.md @@ -0,0 +1,21 @@ +# RISC-V CI Support + +## Overview +This project supports RISC-V (riscv64) builds using cross-compilation +and QEMU emulation on x86_64 CI runners. + +## Architecture +- Host: x86_64 +- Toolchain: riscv64-linux-gnu +- Emulation: qemu-riscv64 +- Execution: Docker container + +## What this CI validates +- Successful RISC-V compilation +- Correct ELF architecture +- Runtime smoke test via QEMU + +## What this CI does NOT do +- Performance benchmarking +- Native RISC-V validation + diff --git a/event.json b/event.json new file mode 100644 index 0000000..a4c5a91 --- /dev/null +++ b/event.json @@ -0,0 +1,9 @@ +{ + "inputs": { + "x86_64_count": "0", + "riscv64_count": "1", + "aarch64_count": "0", + "win_x86_64_count": "0", + "osx_count": "0" + } +}