Skip to content

Install Script Test #195

Install Script Test

Install Script Test #195

Workflow file for this run

name: Install Script Test
on:
schedule:
# Run daily at 6:00 AM UTC
- cron: '0 6 * * *'
workflow_dispatch:
pull_request:
paths:
- 'install-gh-aw.sh'
- 'scripts/test-install-script.sh'
- '.github/workflows/install.yml'
permissions:
contents: read
jobs:
test-install:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-22.04
- macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Test install script detection logic
shell: bash
run: |
chmod +x scripts/test-install-script.sh
./scripts/test-install-script.sh
- name: Test install script (dry run - check platform detection)
shell: bash
run: |
chmod +x install-gh-aw.sh
# Extract just the platform detection part without actually downloading
OS=$(uname -s)
ARCH=$(uname -m)
echo "Testing platform detection:"
echo " OS: $OS"
echo " ARCH: $ARCH"
# Run the script but capture the output before it tries to download
# We'll use a fake version to test URL construction
set +e
# Cross-platform timeout implementation
if command -v timeout > /dev/null 2>&1; then
# Linux has timeout command
timeout 10s ./install-gh-aw.sh v999.999.999 2>&1 | tee install-output.log || true
else
# macOS and others - use Perl-based timeout (available by default on macOS)
perl -e 'alarm shift; exec @ARGV' 10 ./install-gh-aw.sh v999.999.999 2>&1 | tee install-output.log || true
fi
set -e
# Verify platform was detected
if grep -q "Detected OS:" install-output.log; then
echo "✅ OS detection working"
else
echo "❌ OS detection failed"
cat install-output.log
exit 1
fi
if grep -q "Detected architecture:" install-output.log; then
echo "✅ Architecture detection working"
else
echo "❌ Architecture detection failed"
cat install-output.log
exit 1
fi
if grep -q "Platform:" install-output.log; then
echo "✅ Platform string constructed"
else
echo "❌ Platform string construction failed"
cat install-output.log
exit 1
fi
echo ""
echo "Platform detection results:"
grep "Detected OS:" install-output.log || true
grep "Detected architecture:" install-output.log || true
grep "Platform:" install-output.log || true
- name: Upload test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: install-test-${{ matrix.os }}
path: install-output.log
retention-days: 7
if-no-files-found: ignore
- name: Test full install script (without dummy version)
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x install-gh-aw.sh
# Run the full installation script without version to get latest release
echo "Running full installation script to test complete flow..."
./install-gh-aw.sh
# Verify the installation worked
INSTALL_DIR="$HOME/.local/share/gh/extensions/gh-aw"
# Determine expected binary name based on OS
if [[ "$RUNNER_OS" == "Windows" ]]; then
BINARY_NAME="gh-aw.exe"
else
BINARY_NAME="gh-aw"
fi
BINARY_PATH="$INSTALL_DIR/$BINARY_NAME"
# Check if binary exists
if [ ! -f "$BINARY_PATH" ]; then
echo "❌ Binary not found at $BINARY_PATH"
exit 1
fi
echo "✅ Binary found at $BINARY_PATH"
# Check if binary is executable
if [ ! -x "$BINARY_PATH" ]; then
echo "❌ Binary is not executable"
exit 1
fi
echo "✅ Binary is executable"
# Run version command to verify binary works
if "$BINARY_PATH" version; then
echo "✅ Binary version command works"
else
echo "❌ Binary version command failed"
exit 1
fi
# Run help command to verify binary works
if "$BINARY_PATH" --help > /dev/null 2>&1; then
echo "✅ Binary help command works"
else
echo "❌ Binary help command failed"
exit 1
fi
echo ""
echo "✅ Full installation test passed!"
report-failure:
name: Report Installation Failures
runs-on: ubuntu-latest
needs: test-install
if: failure()
permissions:
issues: write
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Create issue on failure
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const workflowUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const title = '🚨 Install Script Test Failed';
const body = `The install script test workflow failed.
**Workflow Run:** ${workflowUrl}
**Triggered by:** ${context.eventName}
**Commit:** ${context.sha.substring(0, 7)}
## Details
The install script testing workflow detected failures when testing the \`install-gh-aw.sh\` script across different platforms.
Please review the workflow logs to identify which platform(s) failed and investigate the issue.
## Affected Platforms
This workflow tests the install script on:
- Ubuntu (latest and 22.04)
- macOS (latest ARM and Intel-based 13)
- Windows (latest)
## Next Steps
1. Check the [workflow run logs](${workflowUrl}) for detailed error messages
2. Review changes to \`install-gh-aw.sh\` that may have caused the failure
3. Test the install script locally on the affected platform(s)
4. Fix the issue and verify with \`scripts/test-install-script.sh\`
---
*This issue was automatically created by the install script test workflow.*`;
// Check if there's already an open issue
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'install-script,automated',
per_page: 10
});
const existingIssue = issues.data.find(issue =>
issue.title === title
);
if (existingIssue) {
// Add a comment to existing issue
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existingIssue.number,
body: `Another failure detected:\n\n${body}`
});
console.log(`Added comment to existing issue #${existingIssue.number}`);
} else {
// Create new issue
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['bug', 'install-script', 'automated']
});
console.log(`Created new issue #${issue.data.number}`);
}