Skip to content

Commit 5e2fa0d

Browse files
committed
Add CentOS and Amzn CI
1 parent 171226a commit 5e2fa0d

File tree

1 file changed

+190
-1
lines changed

1 file changed

+190
-1
lines changed

.github/workflows/CI.yaml

Lines changed: 190 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,196 @@ jobs:
9494
if [ `which swift` != /usr/* ]
9595
then
9696
echo "::error::swiftbox is not closed correctly."
97-
exit 1
97+
fi
98+
99+
test-centos:
100+
container:
101+
image: centos:8
102+
runs-on: ubuntu-latest
103+
env:
104+
MAINVER: "5.2.4"
105+
defaults:
106+
run:
107+
shell: su - swifter -c "/bin/bash --login -eo pipefail {0}"
108+
working-directory: /home/swifter
109+
steps:
110+
- name: Create a new user
111+
shell: bash
112+
working-directory: /
113+
run: |
114+
yum install sudo usermode -y
115+
useradd swifter
116+
echo "swifter ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
117+
118+
- name: Checkout
119+
uses: actions/checkout@v2
120+
121+
- name: Test swiftbox version
122+
run: |
123+
chmod +x swiftbox.sh
124+
./swiftbox.sh version
125+
126+
- name: Test swiftbox install
127+
run: ./swiftbox.sh install
128+
129+
- name: Test swiftbox lookup
130+
run: swiftbox lookup $MAINVER
131+
132+
- name: Install which
133+
run: sudo yum install which -y
134+
135+
- name: Test swiftbox get with sudo
136+
run: |
137+
sudo swiftbox get $MAINVER
138+
source /etc/environment && source /opt/swiftbox/env.sh
139+
if [ `which swift` != "/opt/swiftbox/toolchain/swift-$MAINVER/usr/bin/swift" ]
140+
then
141+
echo "::error::Swift $MAINVER is not installed correctly."
142+
fi
143+
swiftc -v
144+
145+
- name: Test swiftbox get
146+
run: |
147+
swiftbox get $MAINVER
148+
source /etc/environment && source /opt/swiftbox/env.sh && source $HOME/.swiftbox/env.sh
149+
if [ `which swift` != "$HOME/.swiftbox/toolchain/swift-$MAINVER/usr/bin/swift" ]
150+
then
151+
echo "::error::Swift $ALTVER is not removed correctly."
152+
fi
153+
swiftc -v
154+
155+
- name: Test swiftbox list
156+
run: |
157+
swiftbox list
158+
sudo swiftbox list
159+
160+
- name: Test swiftbox clean
161+
run: |
162+
swiftbox clean
163+
sudo swiftbox clean
164+
165+
- name: Test swiftbox remove
166+
run: sudo swiftbox remove $MAINVER
167+
168+
- name: Test Swift status
169+
run: |
170+
echo "\$PATH=$PATH"
171+
if [ `which swift` != "$HOME/.swiftbox/toolchain/swift-$MAINVER/usr/bin/swift" ]
172+
then
173+
echo "::error::Swift $ALTVER is not removed correctly."
174+
fi
175+
swiftc -v
176+
177+
- name: Test Swift compiler
178+
run: |
179+
swift test.swift
180+
swiftc test.swift -o test && ./test
181+
182+
- name: Test swiftbox close
183+
run: swiftbox close
184+
185+
- name: Test Swift disabled
186+
run: |
187+
if hash swift 2> /dev/null
188+
then
189+
echo "::error::swiftbox is not closed correctly."
190+
fi
191+
192+
test-amzn:
193+
container:
194+
image: amazonlinux:2
195+
runs-on: ubuntu-latest
196+
env:
197+
MAINVER: "5.2.4"
198+
defaults:
199+
run:
200+
shell: su - swifter -c "/bin/bash --login -eo pipefail {0}"
201+
working-directory: /home/swifter
202+
steps:
203+
- name: Create a new user
204+
shell: bash
205+
working-directory: /
206+
run: |
207+
yum install sudo usermode -y
208+
useradd swifter
209+
echo "swifter ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
210+
211+
- name: Install tar and gzip
212+
shell: bash
213+
run: yum install tar gzip -y
214+
215+
- name: Checkout
216+
uses: actions/checkout@v2
217+
218+
- name: Test swiftbox version
219+
run: |
220+
chmod +x swiftbox.sh
221+
./swiftbox.sh version
222+
223+
- name: Test swiftbox install
224+
run: ./swiftbox.sh install
225+
226+
- name: Test swiftbox lookup
227+
run: swiftbox lookup $MAINVER
228+
229+
- name: Install which
230+
run: sudo yum install which -y
231+
232+
- name: Test swiftbox get with sudo
233+
run: |
234+
sudo swiftbox get $MAINVER
235+
source /etc/environment && source /opt/swiftbox/env.sh
236+
if [ `which swift` != "/opt/swiftbox/toolchain/swift-$MAINVER/usr/bin/swift" ]
237+
then
238+
echo "::error::Swift $MAINVER is not installed correctly."
239+
fi
240+
swiftc -v
241+
242+
- name: Test swiftbox get
243+
run: |
244+
swiftbox get $MAINVER
245+
source /etc/environment && source /opt/swiftbox/env.sh && source $HOME/.swiftbox/env.sh
246+
if [ `which swift` != "$HOME/.swiftbox/toolchain/swift-$MAINVER/usr/bin/swift" ]
247+
then
248+
echo "::error::Swift $ALTVER is not removed correctly."
249+
fi
250+
swiftc -v
251+
252+
- name: Test swiftbox list
253+
run: |
254+
swiftbox list
255+
sudo swiftbox list
256+
257+
- name: Test swiftbox clean
258+
run: |
259+
swiftbox clean
260+
sudo swiftbox clean
261+
262+
- name: Test swiftbox remove
263+
run: sudo swiftbox remove $MAINVER
264+
265+
- name: Test Swift status
266+
run: |
267+
echo "\$PATH=$PATH"
268+
if [ `which swift` != "$HOME/.swiftbox/toolchain/swift-$MAINVER/usr/bin/swift" ]
269+
then
270+
echo "::error::Swift $ALTVER is not removed correctly."
271+
fi
272+
swiftc -v
273+
274+
- name: Test Swift compiler
275+
run: |
276+
swift test.swift
277+
swiftc test.swift -o test && ./test
278+
279+
- name: Test swiftbox close
280+
run: swiftbox close
281+
282+
- name: Test Swift disabled
283+
run: |
284+
if hash swift 2> /dev/null
285+
then
286+
echo "::error::swiftbox is not closed correctly."
98287
fi
99288
100289
test-ubuntu-nightly:

0 commit comments

Comments
 (0)