Skip to content

Commit 6bc2415

Browse files
committed
Add Github Actions CI
1 parent 06cbc05 commit 6bc2415

File tree

3 files changed

+78
-18
lines changed

3 files changed

+78
-18
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/test.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Test installer
2+
3+
on:
4+
push:
5+
paths:
6+
- '*.sh'
7+
- 'lua/**'
8+
- 'smax-scripts.service'
9+
- '.github/workflows/test.yml'
10+
11+
jobs:
12+
13+
test:
14+
name: Test on Ubuntu
15+
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: install redis
19+
run: sudo apt-get install redis
20+
21+
- name: Check out smax-server
22+
uses: actions/checkout@v4
23+
24+
- name: Run installer
25+
run: sudo ./install.sh
26+

install.sh

+41-18
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# 09/14/2024
1212
#
1313

14-
if [ $EUID -ne 0 ]
15-
then echo "Please run as root"
14+
if [ $EUID -ne 0 ] ; then
15+
echo "Please run as root"
1616
exit 1
1717
fi
1818

@@ -23,49 +23,72 @@ if [ "$DESTDIR" == "" ] ; then
2323
fi
2424

2525
# Create /usr/share/smax and its lua/ sub-directory
26-
SMAX="$(DESTDIR)/share/smax"
26+
SMAX="$DESTDIR/share/smax"
2727

2828
# Copy LUA script over to /usr/share/smax
29-
mkdir -p $SMAX/lua || exit 1
30-
cp -a lua $SMAX || exit 2
29+
echo ". Creating $SMAX/lua directory"
30+
mkdir -p $SMAX/lua || exit 2
31+
32+
echo ". Copying LUA scripts to $SMAX/lua"
33+
cp -a lua $SMAX || exit 3
3134

3235
# install script loader and systemd unit file
33-
install -m 755 smax-init.sh /usr/bin/ || ( exho exit 3
34-
install -m 644 smax-scripts.service /etc/systemd/system/ || exit 4
36+
echo ". Copying script loader to $DESTDIR/bin"
37+
install -m 755 smax-init.sh $DESTDIR/bin/ || echo exit 4
38+
39+
echo ". Copying script loader to /etc/systemd/system"
40+
install -m 644 smax-scripts.service /etc/systemd/system/ || exit 5
3541

3642
# Register smax-scripts with systemd
37-
systemctl daemon-reload || exit 5
43+
echo ". Reloading systemd daemon"
44+
systemctl daemon-reload || exit 6
3845

3946
# if you call the script with a single argument 'auto', then it will install
4047
# a default without asking any questions. (Without the option, the installer
4148
# will ask you to make some choices.)
4249
if [ "$1" == "auto" ] ; then
43-
# automatic installation
50+
# automatic installation
51+
echo "Automatic installation..."
4452

45-
sed -i '/^.*BEGIN SMA.*/,/^.*END SMA.*$/d' *.lua || exit 6
46-
systemctl restart smax-scripts || exit 7
47-
systemctl enable redis || exit 8
48-
systemctl enable smax-scripts || exit 9
53+
echo ". Removing SMA-specific sections from scripts"
54+
sed -i '/^.*BEGIN SMA.*/,/^.*END SMA.*$/d' *.lua || exit 7
55+
56+
echo ". Starting smax-scripts service"
57+
systemctl restart smax-scripts || exit 8
58+
59+
echo ". Enabling Redis at boot"
60+
systemctl enable redis || exit 9
61+
62+
echo ". Enabling SMA-X at boot"
63+
systemctl enable smax-scripts || exit 10
4964
else
5065
# prompt for choices
66+
echo "Manual installation..."
5167

52-
read -p "Are you going to use SMA-X at the SMA? " -n 1 -r
68+
read -p "Are you going to use SMA-X outside of the SMA? " -n 1 -r
5369
echo # (optional) move to a new line
5470
if [[ $REPLY =~ ^[Yy]$ ]] ; then
55-
sed -i '/^.*BEGIN SMA.*/,/^.*END SMA.*$/d' *.lua || exit 10
71+
echo ". Removing SMA-specific sections from scripts"
72+
sed -i '/^.*BEGIN SMA.*/,/^.*END SMA.*$/d' *.lua || exit 11
5673
fi
5774

5875
read -p "start redis with SMA-X scripts at this time? " -n 1 -r
5976
echo # (optional) move to a new line
6077
if [[ $REPLY =~ ^[Yy]$ ]] ; then
61-
systemctl restart smax-scripts || exit 11
78+
echo ". Starting smax-scripts service"
79+
systemctl restart smax-scripts || exit 12
6280
fi
6381

6482
read -p "Enable and start SMA-X at boot time? " -n 1 -r
6583
echo # (optional) move to a new line
6684
if [[ $REPLY =~ ^[Yy]$ ]] ; then
67-
systemctl enable redis || exit 12
68-
systemctl enable smax-scripts || exit 13
85+
echo ". Enabling Redis at boot"
86+
systemctl enable redis || exit 13
87+
88+
echo ". Enabling SMA-X at boot"
89+
systemctl enable smax-scripts || exit 14
6990
fi
7091
fi
7192

93+
94+
echo "Done!"

0 commit comments

Comments
 (0)