Base: codex-main originale (prima del fork aKode)
This commit is contained in:
85
third_party/voice/cargo-ci/produce/action.yml
vendored
Normal file
85
third_party/voice/cargo-ci/produce/action.yml
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
name: Build Cargo voice inputs
|
||||
description: Build and upload same-commit native voice SDK and runtime inputs.
|
||||
inputs:
|
||||
target:
|
||||
description: Native target triple matching the runner
|
||||
required: true
|
||||
windows-tools:
|
||||
description: Directory containing the public Windows voice bootstrap
|
||||
default: .github/scripts
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
architecture: ${{ contains(inputs.target, 'aarch64') && 'arm64' || 'x64' }}
|
||||
- uses: ./.github/actions/prepare-bazel-ci
|
||||
with:
|
||||
target: ${{ inputs.target }}
|
||||
cache-scope: cargo-voice-native
|
||||
- name: Set up Windows voice build tools
|
||||
if: runner.os == 'Windows'
|
||||
uses: ./.github/actions/setup-bazel-windows
|
||||
with:
|
||||
target: ${{ inputs.target }}
|
||||
windows-tools: ${{ inputs.windows-tools }}
|
||||
- name: Build and stage native dependencies
|
||||
shell: bash
|
||||
env:
|
||||
TARGET: ${{ inputs.target }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
arch="${TARGET%%-*}"
|
||||
case "$RUNNER_OS" in
|
||||
Windows) prefix="windows_$arch"; temp="$(cygpath -u "$RUNNER_TEMP")" ;;
|
||||
macOS) prefix="macos_$arch"; temp="$RUNNER_TEMP" ;;
|
||||
Linux) prefix="linux_$arch"; temp="$RUNNER_TEMP" ;;
|
||||
*) echo "Unsupported runner OS: $RUNNER_OS" >&2; exit 1 ;;
|
||||
esac
|
||||
wrapper=(--remote-download-toplevel --print-failed-action-summary)
|
||||
flags=(--config=release --build_metadata="COMMIT_SHA=$GITHUB_SHA")
|
||||
if [[ "$RUNNER_OS" == Windows ]]; then
|
||||
wrapper+=(--windows-msvc-host-platform)
|
||||
flags+=(--platforms=//:local_windows_msvc
|
||||
--extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows,@local_config_cc//:cc-toolchain-arm64_windows,//third_party/voice:windows_pkg_config_toolchain,//third_party/voice:windows_cmake_toolchain
|
||||
--repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=0 --repo_env=BAZEL_MSVC_RUNTIME_VISUAL_STUDIO_EULA=1
|
||||
--inject_repository="voice_windows_tools=$VOICE_WINDOWS_BAZEL_REPOSITORY"
|
||||
--//third_party/voice:windows_installed_tools=@voice_windows_tools//:tools
|
||||
--action_env="SystemRoot=$VOICE_WINDOWS_SYSTEM_ROOT" --host_action_env="SystemRoot=$VOICE_WINDOWS_SYSTEM_ROOT"
|
||||
--action_env="PROCESSOR_ARCHITECTURE=$VOICE_WINDOWS_HOST_ARCH" --host_action_env="PROCESSOR_ARCHITECTURE=$VOICE_WINDOWS_HOST_ARCH"
|
||||
--workspace_status_command=./scripts/workspace-status.cmd)
|
||||
elif [[ "$RUNNER_OS" == macOS ]]; then
|
||||
flags+=(--macos_minimum_os=14.0)
|
||||
fi
|
||||
./.github/scripts/run-bazel-ci.sh "${wrapper[@]}" -- build "${flags[@]}" -- \
|
||||
//third_party/voice:native_sdk //third_party/voice:native_runtime
|
||||
runtime="bazel-bin/third_party/voice/native_runtime_${prefix}"
|
||||
output="$temp/cargo-voice-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT"
|
||||
python third_party/voice/cargo_ci.py stage --sdk "${runtime}_sdk" --runtime "$runtime" --output "$output" --target "$TARGET"
|
||||
tar -czf "$temp/cargo-voice.tar.gz" -C "$output" sdk runtime
|
||||
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
with:
|
||||
name: cargo-voice-${{ inputs.target }}
|
||||
path: ${{ runner.temp }}/cargo-voice.tar.gz
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
- name: Stage verified native pkgconf, support DLLs, and license
|
||||
if: runner.os == 'Windows'
|
||||
id: pkgconf
|
||||
shell: pwsh
|
||||
run: |
|
||||
$directory = Split-Path -Parent $env:VOICE_PKG_CONFIG
|
||||
$license = Join-Path $directory "COPYING"
|
||||
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/pkgconf/pkgconf/d97cae4e2a169916f77d9ee8a46c011b69e42a7b/COPYING" -OutFile $license
|
||||
if ((Get-FileHash $license -Algorithm SHA256).Hash.ToLowerInvariant() -ne "055a265b839672a62f590869b0a1f8e4f5147e8f073c9ba77b17b8d7ad653966") {
|
||||
throw "Pinned pkgconf license mismatch"
|
||||
}
|
||||
"directory=$directory" | Out-File $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
if: runner.os == 'Windows'
|
||||
with:
|
||||
name: cargo-voice-pkgconf-${{ runner.arch }}
|
||||
path: ${{ steps.pkgconf.outputs.directory }}
|
||||
if-no-files-found: error
|
||||
overwrite: true
|
||||
62
third_party/voice/cargo-ci/setup/action.yml
vendored
Normal file
62
third_party/voice/cargo-ci/setup/action.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Set up Cargo voice inputs
|
||||
description: Use the target SDK and prepared runtime from this workflow run.
|
||||
inputs:
|
||||
target:
|
||||
description: Cargo target triple
|
||||
required: true
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: Ensure CMake is available for the Opus build
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: command -v cmake || sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cmake
|
||||
- name: Ensure host pkg-config is available
|
||||
if: runner.os == 'macOS'
|
||||
shell: bash
|
||||
run: command -v pkg-config || brew install pkgconf
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: cargo-voice-${{ inputs.target }}
|
||||
path: ${{ runner.temp }}/cargo-voice-inputs
|
||||
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
if: runner.os == 'Windows'
|
||||
with:
|
||||
# The x64 archive builder must execute x64 pkgconf even for ARM64.
|
||||
name: cargo-voice-pkgconf-${{ runner.arch }}
|
||||
path: ${{ runner.temp }}/cargo-voice-pkgconf
|
||||
- name: Configure target libraries for Cargo
|
||||
env:
|
||||
VOICE_TARGET: ${{ inputs.target }}
|
||||
shell: python
|
||||
run: |
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
|
||||
temp = Path(os.environ["RUNNER_TEMP"])
|
||||
target_dir = Path(os.environ["CARGO_TARGET_DIR"])
|
||||
root = Path(tempfile.mkdtemp(prefix="cargo-voice-", dir=target_dir))
|
||||
with tarfile.open(temp / "cargo-voice-inputs/cargo-voice.tar.gz") as archive:
|
||||
archive.extractall(root, filter="data")
|
||||
if os.name == "nt":
|
||||
os.environ["VOICE_PKG_CONFIG"] = str(temp / "cargo-voice-pkgconf/pkgconf.exe")
|
||||
script = Path(os.environ["GITHUB_WORKSPACE"]) / "third_party/voice/cargo_ci.py"
|
||||
subprocess.run([sys.executable, str(script), "configure", "--root", str(root),
|
||||
"--target", os.environ["VOICE_TARGET"]], check=True)
|
||||
# nextest collects linked libraries itself. Include the runtime manifest
|
||||
# and plugins too so the whole runtime can move with the test binaries.
|
||||
relative = (root / "runtime").relative_to(target_dir).as_posix()
|
||||
config = root / "nextest.toml"
|
||||
config.write_text('[profile.default]\narchive.include = [{ path = ' + json.dumps(relative)
|
||||
+ ', relative-to = "target", on-missing = "error" }]\n')
|
||||
with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as env:
|
||||
print(f"CODEX_VOICE_NEXTEST_CONFIG={config}", file=env)
|
||||
print(f"CODEX_VOICE_RUNTIME_RELATIVE={relative}", file=env)
|
||||
Reference in New Issue
Block a user