-
Notifications
You must be signed in to change notification settings - Fork 2
275 lines (217 loc) · 8.17 KB
/
test-install.yml
File metadata and controls
275 lines (217 loc) · 8.17 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: Test Installation
on:
push:
branches: [ main ]
paths:
- 'install.sh'
- 'Makefile'
- 'bin/**'
- 'PKGBUILD'
- '.github/workflows/test-install.yml'
pull_request:
branches: [ main ]
workflow_dispatch: # Allow manual trigger
jobs:
test-install-script:
name: Test install.sh on ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu:22.04
- ubuntu:20.04
- debian:12
- debian:11
- alpine:latest
- archlinux:latest
container:
image: ${{ matrix.os }}
steps:
- name: Install dependencies (Ubuntu/Debian)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'debian')
run: |
apt-get update
apt-get install -y git make
- name: Install dependencies (Alpine)
if: startsWith(matrix.os, 'alpine')
run: |
apk add --no-cache git make bash
- name: Install dependencies (Arch)
if: startsWith(matrix.os, 'archlinux')
run: |
pacman -Syu --noconfirm git make
- name: Checkout code
uses: actions/checkout@v4
- name: Test install.sh (user install)
run: |
# Test user installation
./install.sh "$HOME/.local"
# Verify binaries installed
test -f "$HOME/.local/bin/git-issue" || exit 1
test -x "$HOME/.local/bin/git-issue" || exit 1
# Verify all subcommands installed
for cmd in create ls show comment edit state search import export sync merge fsck init; do
test -f "$HOME/.local/bin/git-issue-$cmd" || exit 1
test -x "$HOME/.local/bin/git-issue-$cmd" || exit 1
done
echo "✓ User installation succeeded"
- name: Test version command
run: |
export PATH="$HOME/.local/bin:$PATH"
VERSION_OUTPUT="$(git-issue version)"
echo "Version output: $VERSION_OUTPUT"
# Verify version output matches version in source
EXPECTED="$(grep '^VERSION=' bin/git-issue | cut -d'"' -f2)"
echo "$VERSION_OUTPUT" | grep -q "$EXPECTED" || exit 1
echo "✓ Version command works (v$EXPECTED)"
- name: Test basic commands
run: |
export PATH="$HOME/.local/bin:$PATH"
# Initialize git repo for testing
mkdir -p /tmp/test-repo
cd /tmp/test-repo
git init
git config user.name "Test User"
git config user.email "test@example.com"
# Add dummy remote (git-issue init requires a remote)
git remote add origin https://example.com/test.git
# Test init command
git-issue init || exit 1
echo "✓ git-issue init works"
# Test successful - installation validated
echo "✓ Installation test complete"
- name: Test Makefile installation (system-wide simulation)
run: |
# Clean previous user install
rm -rf "$HOME/.local/bin/git-issue"*
# Test make install to a temporary prefix
make install prefix=/tmp/install-test
# Verify installation
test -f /tmp/install-test/bin/git-issue || exit 1
test -x /tmp/install-test/bin/git-issue || exit 1
echo "✓ Makefile installation succeeded"
test-macos-install:
name: Test installation on macOS
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test install.sh (user install)
run: |
./install.sh "$HOME/.local"
# Verify binaries installed
test -f "$HOME/.local/bin/git-issue" || exit 1
test -x "$HOME/.local/bin/git-issue" || exit 1
echo "✓ macOS user installation succeeded"
- name: Test version command
run: |
export PATH="$HOME/.local/bin:$PATH"
EXPECTED="$(grep '^VERSION=' bin/git-issue | cut -d'"' -f2)"
git-issue version | grep -q "$EXPECTED" || exit 1
echo "✓ Version command works on macOS (v$EXPECTED)"
- name: Test basic functionality
run: |
export PATH="$HOME/.local/bin:$PATH"
# Initialize git repo
mkdir -p /tmp/test-repo
cd /tmp/test-repo
git init
git config user.name "Test User"
git config user.email "test@example.com"
# Add dummy remote (git-issue init requires a remote)
git remote add origin https://example.com/test.git
# Test init
git-issue init || exit 1
echo "✓ git-issue init works on macOS"
# Test successful - installation validated
echo "✓ macOS installation test complete"
test-homebrew-formula:
name: Test Homebrew formula
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test formula installation (from tap)
run: |
# Uninstall if already installed
brew uninstall git-native-issue 2>/dev/null || true
# Install from actual tap
brew install remenoscodes/git-native-issue/git-native-issue || exit 1
# Verify installation outputs a version string
git-issue version | grep -q "git-issue version" || exit 1
echo "✓ Homebrew tap installation works"
# Test successful - Homebrew installation validated
echo "✓ Homebrew test complete"
test-asdf-plugin:
name: Test asdf plugin
runs-on: ubuntu-latest
continue-on-error: true # asdf plugin repo may lag behind releases
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install asdf
run: |
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.16.5
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl git jq
- name: Test plugin installation
shell: bash
run: |
source ~/.asdf/asdf.sh
# Add plugin from GitHub
asdf plugin add git-native-issue https://github.com/remenoscodes/git-native-issue-asdf.git
# List available versions and pick the latest
LATEST="$(asdf list all git-native-issue | head -1)"
test -n "$LATEST" || exit 1
echo "✓ Plugin can list versions (latest: $LATEST)"
# Install latest version
asdf install git-native-issue "$LATEST"
echo "✓ Version $LATEST installed"
# Set version
asdf set git-native-issue "$LATEST"
# Verify installation
git-issue version | grep -q "git-issue version" || exit 1
echo "✓ asdf plugin test complete"
test-pkgbuild:
name: Test PKGBUILD (Arch Linux)
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Install dependencies
run: |
pacman -Syu --noconfirm base-devel git
- name: Checkout code
uses: actions/checkout@v4
- name: Create build user
run: |
# makepkg cannot run as root
useradd -m builder
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
chown -R builder:builder .
- name: Validate PKGBUILD syntax
run: |
su - builder -c "cd $GITHUB_WORKSPACE && bash -n PKGBUILD"
echo "✓ PKGBUILD syntax valid"
- name: Build package
run: |
su - builder -c "cd $GITHUB_WORKSPACE && makepkg -s --noconfirm"
echo "✓ Package built successfully"
- name: Install package
run: |
# Find and install the built package
PKGFILE=$(find $GITHUB_WORKSPACE -name "git-native-issue-*.pkg.tar.zst" | head -1)
pacman -U --noconfirm "$PKGFILE"
echo "✓ Package installed"
- name: Test installation
run: |
# Verify binaries installed
test -f /usr/bin/git-issue || exit 1
test -x /usr/bin/git-issue || exit 1
# Check version outputs something
git-issue version | grep -q "git-issue version" || exit 1
echo "✓ PKGBUILD test complete"