Skip to content

Commit 863ae79

Browse files
committed
Add basic CI via GitHub actions.
1 parent 1cf5402 commit 863ae79

4 files changed

Lines changed: 116 additions & 42 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build GNUstep (CI)
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
name: Build using stock script
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 180
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
# Running only the non-dev version for now, as the dev version assumes
21+
# ssh keys are set up. This should be possible to set up with GitHub
22+
# Actions, but let's keep it simple for now.
23+
- name: Run the script per README instructions (non-dev version)
24+
shell: bash
25+
run: |
26+
# Sourcing so we get the pipefail propagate.
27+
(set -euo pipefail ; export MANAGE_SUDO=no ; . gnustep-web-install) | tee /tmp/gs-build.log
28+
# We should process the log here to see if we can recognize critical
29+
# errors.
30+
31+
# Otherwise let's see if some expected binaries are present.
32+
if [ ! -x "/usr/local/GNUstep/bin/gnustep-config" ] ; then
33+
echo "gnustep-config not found!"
34+
exit 1
35+
fi
36+
if [ ! -x "/usr/local/GNUstep/bin/gorm" ] ; then
37+
echo "gorm not found!"
38+
exit 1
39+
fi

gnustep-web-install

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,29 @@ export KERNEL=`uname -s | sed "s/\-.*//g" | awk '{print(tolower($0))}'`
3333
echo "Begin setup for ${KERNEL}"
3434

3535
export USER=`whoami`
36-
curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL}
37-
. ./setup-${KERNEL}
38-
rm ./setup-${KERNEL}
36+
if [ ! -f ./setup-${KERNEL} ] ; then
37+
# Download the setup script only if not already present (e.g. CI).
38+
curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL}
39+
. ./setup-${KERNEL}
40+
rm ./setup-${KERNEL}
41+
else
42+
# Assume inside CI.
43+
# For CI purposes, default to failing. Using bashism is fine here, for now.
44+
set -euo pipefail
45+
. ./setup-${KERNEL}
46+
fi
3947

4048
echo "======== Create gnustep build directories ========"
41-
mkdir -p gnustep
42-
cd gnustep
43-
git clone https://github.com/gnustep/tools-scripts
49+
if [ ! -e .git ] ; then
50+
# Default outside CI.
51+
mkdir -p gnustep
52+
cd gnustep
53+
git clone https://github.com/gnustep/tools-scripts
54+
else
55+
# Inside CI we are already in the repo.
56+
# Just go to the parent directory, tools-scripts will exist.
57+
cd ..
58+
fi
4459
./tools-scripts/clone-essential-repos-https
4560

4661
echo "================ Install Dependencies ================"

gnustep-web-install-dev

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,34 @@ echo " "
3535
export KERNEL=`uname -s | sed "s/\-.*//g" | awk '{print(tolower($0))}'`
3636
echo "Begin setup for ${KERNEL}"
3737

38-
export USER=`whoami`
39-
if [ "X${KERNEL}" == "Xopenbsd" ];then
40-
ftp -o ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL}
38+
if [ ! -f ./setup-${KERNEL} ] ; then
39+
# Download the setup script only if not already present (e.g. CI).
40+
export USER=`whoami`
41+
if [ "X${KERNEL}" == "Xopenbsd" ];then
42+
ftp -o ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL}
43+
else
44+
curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL}
45+
fi
46+
./setup-${KERNEL}
47+
rm ./setup-${KERNEL}
4148
else
42-
curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL}
49+
# Else, assume inside CI.
50+
# For CI purposes, default to failing. Using bashism is fine here, for now.
51+
set -euo pipefail
52+
./setup-${KERNEL}
4353
fi
4454

45-
./setup-${KERNEL}
46-
rm ./setup-${KERNEL}
47-
4855
echo "======== Create gnustep build directories ========"
49-
mkdir -p gnustep
50-
cd gnustep
51-
git clone git@github.com:gnustep/tools-scripts.git
56+
if [ ! -e .git ] ; then
57+
# Default outside CI.
58+
mkdir -p gnustep
59+
cd gnustep
60+
git clone git@github.com:gnustep/tools-scripts.git
61+
else
62+
# Inside CI we are already in the repo.
63+
# Just go to the parent directory, tools-scripts will exist.
64+
cd ..
65+
fi
5266
./tools-scripts/clone-all-repos
5367

5468
echo "================ Install Dependencies ================"

setup-linux

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,43 @@ COMMAND="apt"
66
# Add distro specific variables...
77
. /etc/lsb-release
88

9-
# Install SUDO if needed...
10-
if [ ! -e /usr/bin/sudo ]; then
11-
echo "Installing sudo..."
12-
if [ -e /usr/bin/apt ]; then
13-
su -c "apt install sudo"
14-
9+
MANAGE_SUDO="${MANAGE_SUDO:-yes}"
10+
if [ "X${MANAGE_SUDO}" != "Xyes" ]; then
11+
# Either CI or user does not want to adjust whether sudo is installed,
12+
# whether root password is set or not, etc.
13+
echo "Skipping sudo management"
14+
else
15+
# Install SUDO if needed...
16+
if [ ! -e /usr/bin/sudo ]; then
17+
echo "Installing sudo..."
18+
if [ -e /usr/bin/apt ]; then
19+
su -c "apt install sudo"
20+
else
21+
su -c "rpm install sudo"
22+
COMMAND="rpm"
23+
fi
1524
else
16-
su -c "rpm install sudo"
17-
COMMAND="rpm"
25+
echo "sudo command is already present."
1826
fi
19-
else
20-
echo "sudo command is already present."
21-
fi
2227

23-
# Update root password...
24-
echo "Checking if root password is not set, please set it..."
25-
if [ "${DISTRIB_ID}" = "Ubuntu" ]; then
26-
STATUS=`sudo passwd root --status | cut -f2 -d' '`
27-
if [ "${STATUS}" = "L" ]; then
28-
sudo passwd root
28+
# Update root password...
29+
echo "Checking if root password is not set, please set it..."
30+
if [ "${DISTRIB_ID}" = "Ubuntu" ]; then
31+
STATUS=`sudo passwd root --status | cut -f2 -d' '`
32+
if [ "${STATUS}" = "L" ]; then
33+
sudo passwd root
34+
fi
2935
fi
30-
fi
3136

32-
# Add to sudoers
33-
if [ "${DISTRIB_ID}" != "Ubuntu" ]; then
34-
if [ ! -e /etc/sudoers.d/${USER} ]; then
35-
echo "Adding ${USER} to sudoers..."
36-
echo "Please enter the root user's password."
37-
su -c 'echo "${USER} ALL=(ALL:ALL) ALL" > /etc/sudoers.d/${USER}'
38-
else
39-
echo "${USER} is already a member of sudo users."
37+
# Add to sudoers
38+
if [ "${DISTRIB_ID}" != "Ubuntu" ]; then
39+
if [ ! -e /etc/sudoers.d/${USER} ]; then
40+
echo "Adding ${USER} to sudoers..."
41+
echo "Please enter the root user's password."
42+
su -c 'echo "${USER} ALL=(ALL:ALL) ALL" > /etc/sudoers.d/${USER}'
43+
else
44+
echo "${USER} is already a member of sudo users."
45+
fi
4046
fi
4147
fi
4248

0 commit comments

Comments
 (0)