Installation Test #2
Workflow file for this run
This file contains 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: Installation Test | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: {} | |
jobs: | |
test-unix-install: | |
name: Test Unix Installation | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Clean existing tags | |
shell: bash | |
run: | | |
if [ -d ".git/refs/tags" ]; then | |
rm -rf .git/refs/tags/ | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get install script | |
id: get_linux_install_script | |
shell: bash | |
run: | | |
script=$(awk '/<!-- LINUX_INSTALLATION_BEGIN -->/{p=1;next}/<!-- LINUX_INSTALLATION_END -->/{p=0}p' README.md | grep -v '^```') | |
# Ensure script is not empty | |
if [ -z "$script" ]; then | |
echo "Error: Could not extract Linux installation script from README.md" | |
exit 1 | |
fi | |
# Escape multiline output | |
script="${script//'%'/'%25'}" | |
script="${script//$'\n'/'%0A'}" | |
script="${script//$'\r'/'%0D'}" | |
echo "script=$script" >> $GITHUB_OUTPUT | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build yek | |
shell: bash | |
run: | | |
cargo build --release --target ${{ matrix.target }} --locked | |
# Verify binary exists | |
binary="target/${{ matrix.target }}/release/yek" | |
if [ ! -f "$binary" ]; then | |
echo "Error: Binary not found at: $binary" | |
find target -name "yek" -o -name "yek.exe" | |
exit 1 | |
fi | |
ls -l "$binary" | |
- name: Setup test environment | |
shell: bash | |
run: | | |
# Create test directory | |
sudo mkdir -p /usr/local/bin | |
# Copy binary | |
sudo cp "target/${{ matrix.target }}/release/yek" /usr/local/bin/ | |
# Make executable | |
sudo chmod +x /usr/local/bin/yek | |
# Verify binary is executable | |
if ! which yek; then | |
echo "Error: yek not found in PATH after manual installation" | |
echo "PATH: $PATH" | |
exit 1 | |
fi | |
- name: Test installation script | |
run: ${{ steps.get_linux_install_script.outputs.script }} | |
- name: Verify installation | |
run: | | |
# Ensure yek is in PATH | |
which yek || { | |
echo "Error: yek not found in PATH" | |
echo "PATH: $PATH" | |
exit 1 | |
} | |
# Test version output | |
yek --version || { | |
echo "Error: yek --version failed" | |
exit 1 | |
} | |
# Create test file | |
echo "test content" > test.txt | |
# Test basic functionality | |
yek test.txt || { | |
echo "Error: yek failed to process test file" | |
exit 1 | |
} | |
# Verify output exists | |
test -f repo-serialized/chunk-0.txt || { | |
echo "Error: Output file not found" | |
ls -la repo-serialized/ || true | |
exit 1 | |
} | |
test-windows-install: | |
name: Test Windows Installation | |
runs-on: windows-latest | |
steps: | |
- name: Clean existing tags | |
shell: bash | |
run: | | |
if [ -d ".git/refs/tags" ]; then | |
rm -rf .git/refs/tags/ | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get install script | |
id: get_windows_install_script | |
shell: bash | |
run: | | |
script=$(awk '/<!-- WINDOWS_INSTALLATION_BEGIN -->/{p=1;next}/<!-- WINDOWS_INSTALLATION_END -->/{p=0}p' README.md | grep -v '^```') | |
# Ensure script is not empty | |
if [ -z "$script" ]; then | |
echo "Error: Could not extract Windows installation script from README.md" | |
exit 1 | |
fi | |
# Escape multiline output | |
script="${script//'%'/'%25'}" | |
script="${script//$'\n'/'%0A'}" | |
script="${script//$'\r'/'%0D'}" | |
echo "script=$script" >> $GITHUB_OUTPUT | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-pc-windows-msvc | |
- name: Build yek | |
shell: powershell | |
run: | | |
cargo build --release --target x86_64-pc-windows-msvc --locked | |
# Verify binary exists | |
$binary = "target\x86_64-pc-windows-msvc\release\yek.exe" | |
if (-not (Test-Path $binary)) { | |
Write-Error "Binary not found at: $binary" | |
Get-ChildItem target -Recurse | Where-Object { $_.Name -like "yek.exe" } | |
exit 1 | |
} | |
Write-Host "Binary size: $((Get-Item $binary).Length) bytes" | |
- name: Setup test environment | |
shell: powershell | |
run: | | |
# Create test directory | |
New-Item -ItemType Directory -Path "$env:USERPROFILE\.local\bin" -Force | |
# Add to PATH | |
$env:Path = "$env:USERPROFILE\.local\bin;" + $env:Path | |
# Copy binary | |
Copy-Item "target\x86_64-pc-windows-msvc\release\yek.exe" "$env:USERPROFILE\.local\bin\yek.exe" | |
# Verify binary is executable | |
if (-not (Get-Command yek -ErrorAction SilentlyContinue)) { | |
Write-Error "yek not found in PATH after manual installation" | |
Write-Host "PATH: $env:Path" | |
exit 1 | |
} | |
- name: Test installation script | |
shell: powershell | |
run: ${{ steps.get_windows_install_script.outputs.script }} | |
- name: Verify installation | |
shell: powershell | |
run: | | |
# Ensure yek is in PATH | |
if (-not (Get-Command yek -ErrorAction SilentlyContinue)) { | |
Write-Error "yek not found in PATH" | |
Write-Host "PATH: $env:PATH" | |
exit 1 | |
} | |
# Test version output | |
$version = yek --version | |
if (-not $?) { | |
Write-Error "yek --version failed" | |
exit 1 | |
} | |
Write-Host "Version: $version" | |
# Create test file | |
"test content" | Out-File -FilePath test.txt -Encoding utf8 | |
# Test basic functionality | |
yek test.txt | |
if (-not $?) { | |
Write-Error "yek failed to process test file" | |
exit 1 | |
} | |
# Verify output exists | |
if (-not (Test-Path repo-serialized/chunk-0.txt)) { | |
Write-Error "Output file not found" | |
Get-ChildItem repo-serialized -ErrorAction SilentlyContinue | |
exit 1 | |
} | |
test-install-script: | |
name: Test Install Script | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clean existing tags | |
shell: bash | |
run: | | |
if [ -d ".git/refs/tags" ]; then | |
rm -rf .git/refs/tags/ | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get install script | |
id: get_install_script | |
shell: bash | |
run: | | |
script=$(awk '/<!-- INSTALLATION_SCRIPT_BEGIN -->/{p=1;next}/<!-- INSTALLATION_SCRIPT_END -->/{p=0}p' README.md | grep -v '^```') | |
# Ensure script is not empty | |
if [ -z "$script" ]; then | |
echo "Error: Could not extract installation script from README.md" | |
exit 1 | |
fi | |
# Escape multiline output | |
script="${script//'%'/'%25'}" | |
script="${script//$'\n'/'%0A'}" | |
script="${script//$'\r'/'%0D'}" | |
echo "script=$script" >> $GITHUB_OUTPUT | |
- name: Test installation script | |
run: ${{ steps.get_install_script.outputs.script }} | |
test-cargo-installation: | |
name: Test Cargo Installation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clean existing tags | |
shell: bash | |
run: | | |
if [ -d ".git/refs/tags" ]; then | |
rm -rf .git/refs/tags/ | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get install script | |
id: get_cargo_install_script | |
shell: bash | |
run: | | |
script=$(awk '/<!-- CARGO_INSTALLATION_BEGIN -->/{p=1;next}/<!-- CARGO_INSTALLATION_END -->/{p=0}p' README.md | grep -v '^```') | |
# Ensure script is not empty | |
if [ -z "$script" ]; then | |
echo "Error: Could not extract Cargo installation script from README.md" | |
exit 1 | |
fi | |
# Escape multiline output | |
script="${script//'%'/'%25'}" | |
script="${script//$'\n'/'%0A'}" | |
script="${script//$'\r'/'%0D'}" | |
echo "script=$script" >> $GITHUB_OUTPUT | |
- name: Install via Cargo | |
run: ${{ steps.get_cargo_install_script.outputs.script }} | |
- name: Verify installation | |
run: | | |
# Ensure yek is in PATH | |
which yek || { | |
echo "Error: yek not found in PATH" | |
echo "PATH: $PATH" | |
exit 1 | |
} | |
# Test version output | |
yek --version || { | |
echo "Error: yek --version failed" | |
exit 1 | |
} | |
# Create test file | |
echo "test content" > test.txt | |
# Test basic functionality | |
yek test.txt || { | |
echo "Error: yek failed to process test file" | |
exit 1 | |
} | |
# Verify output exists | |
test -f repo-serialized/chunk-0.txt || { | |
echo "Error: Output file not found" | |
ls -la repo-serialized/ || true | |
exit 1 | |
} |