Repository navigation
189 lines (159 loc) · 6.46 KB
/
Copy pathinstall.yml
File metadata and controls
189 lines (159 loc) · 6.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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
- macos-13 # Intel-based macOS
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- 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
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@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
- name: Create issue on failure
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
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}`);
}