-
Notifications
You must be signed in to change notification settings - Fork 13
225 lines (194 loc) · 6.62 KB
/
test-install.yml
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
# This workflow tests the various sq install mechanisms.
name: Test Install
on:
workflow_call:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
macos-brew:
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Test brew
shell: bash
run: |
set -e pipefail
brew install neilotoole/sq/sq
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
macos-install-sh:
runs-on: macos-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Test install.sh
shell: bash
run: |
set -e pipefail
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
linux-other:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
container:
- "ubuntu:latest"
- "fedora:latest"
- "rockylinux:9"
# - "opensuse/leap:latest"
container:
image: ${{ matrix.container }}
steps:
- name: Test install.sh
run: |
set pipefail
set +e
# Some images don't have curl installed
if ! command -v curl &> /dev/null ; then
if command -v apt &> /dev/null; then
apt update && apt install -y curl
fi
fi
set -e
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
alpine:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
container: alpine:latest
steps:
- name: Test install
run: |
set -e pipefail
apk add curl
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
archlinux-pacman:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
container: archlinux:latest
steps:
- name: Create non-root user
run: |
set -e pipefail
pacman -Syu --noconfirm
pacman -S --needed --noconfirm sudo base-devel
uname="moi"
useradd $uname
passwd -d $uname
printf '%s ALL=(ALL) ALL\n' $uname | tee -a /etc/sudoers
mkdir -p /home/$uname
chown -R "$uname:$uname" /home/$uname
- name: Test install (pacman)
run: |
set -e pipefail
# Run as non-root user
# sudo -u moi
# Should be installed via pacman
sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
archlinux-yay:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
container: archlinux:latest
steps:
- name: Create non-root user
run: |
set -e pipefail
pacman -Syu --noconfirm
pacman -S --needed --noconfirm sudo base-devel
uname="moi"
useradd $uname
passwd -d $uname
printf '%s ALL=(ALL) ALL\n' $uname | tee -a /etc/sudoers
mkdir -p /home/$uname
chown -R "$uname:$uname" /home/$uname
- name: Install yay
run: |
set -e pipefail
cd /tmp
curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/yay-bin.tar.gz
tar -xf yay-bin.tar.gz
chmod -R 777 yay-bin
cd yay-bin
sudo -u moi makepkg -sri --noconfirm
- name: Test install (yay)
run: |
set -e pipefail
# Should be installed via yay
sudo -u moi /bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
ubuntu-brew:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Test install via brew
shell: bash
run: |
set -e pipefail
brew install neilotoole/sq/sq
if [ "$(sq version | awk '{print $2}')" != "${{github.ref_name}}" ]; then
echo "Expected sq ${{github.ref_name}} but got: $(sq version)"
exit 1
fi
void-linux:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
container: ghcr.io/void-linux/void-glibc:latest
steps:
- name: Test install
run: |-
set -e
(xbps-install -Syu || true) && xbps-install -yu xbps curl
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
if [ "$(sq version | awk '{print $1}')" != "sq" ]; then
# NOTE: The Void package release is a manual process.
# Thus, the released version will not match this particular
# workflow release. We'll just do a simple test here.
echo "FAIL: sq install not working for some reason"
exit 1
fi
windows-scoop:
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Test install (scoop)
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
scoop bucket add sq https://github.com/neilotoole/sq
scoop install sq
$gotVersion = sq version
echo "-------- sq version --------"
echo $gotVersion
echo "----------------------------"
if ($gotVersion -ne "sq ${{github.ref_name}}") {
echo "Wanted: sq ${{github.ref_name}}"
echo "Actual: $gotVersion"
echo "Incorrect version number"
exit 1
}