diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c508341 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: Build GNUstep (CI) + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build using stock script + runs-on: ubuntu-latest + timeout-minutes: 180 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Running only the non-dev version for now, as the dev version assumes + # ssh keys are set up. This should be possible to set up with GitHub + # Actions, but let's keep it simple for now. + - name: Run the script per README instructions (non-dev version) + shell: bash + run: | + # Sourcing so we get the pipefail propagate. + (set -euo pipefail ; export MANAGE_SUDO=no ; . gnustep-web-install) | tee /tmp/gs-build.log + # We should process the log here to see if we can recognize critical + # errors. + + # Otherwise let's see if some expected binaries are present. + if [ ! -x "/usr/local/GNUstep/bin/gnustep-config" ] ; then + echo "gnustep-config not found!" + exit 1 + fi + if [ ! -x "/usr/local/GNUstep/bin/gorm" ] ; then + echo "gorm not found!" + exit 1 + fi diff --git a/gnustep-web-install b/gnustep-web-install index 48b42fa..7be2b92 100755 --- a/gnustep-web-install +++ b/gnustep-web-install @@ -33,14 +33,29 @@ export KERNEL=`uname -s | sed "s/\-.*//g" | awk '{print(tolower($0))}'` echo "Begin setup for ${KERNEL}" export USER=`whoami` -curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL} -. ./setup-${KERNEL} -rm ./setup-${KERNEL} +if [ ! -f ./setup-${KERNEL} ] ; then + # Download the setup script only if not already present (e.g. CI). + curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL} + . ./setup-${KERNEL} + rm ./setup-${KERNEL} +else + # Assume inside CI. + # For CI purposes, default to failing. Using bashism is fine here, for now. + set -euo pipefail + . ./setup-${KERNEL} +fi echo "======== Create gnustep build directories ========" -mkdir -p gnustep -cd gnustep -git clone https://github.com/gnustep/tools-scripts +if [ ! -e .git ] ; then + # Default outside CI. + mkdir -p gnustep + cd gnustep + git clone https://github.com/gnustep/tools-scripts +else + # Inside CI we are already in the repo. + # Just go to the parent directory, tools-scripts will exist. + cd .. +fi ./tools-scripts/clone-essential-repos-https echo "================ Install Dependencies ================" diff --git a/gnustep-web-install-dev b/gnustep-web-install-dev index ff3dd09..c6959be 100755 --- a/gnustep-web-install-dev +++ b/gnustep-web-install-dev @@ -35,20 +35,34 @@ echo " " export KERNEL=`uname -s | sed "s/\-.*//g" | awk '{print(tolower($0))}'` echo "Begin setup for ${KERNEL}" -export USER=`whoami` -if [ "X${KERNEL}" == "Xopenbsd" ];then - ftp -o ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL} +if [ ! -f ./setup-${KERNEL} ] ; then + # Download the setup script only if not already present (e.g. CI). + export USER=`whoami` + if [ "X${KERNEL}" == "Xopenbsd" ];then + ftp -o ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL} + else + curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL} + fi + ./setup-${KERNEL} + rm ./setup-${KERNEL} else - curl -fsSL > ./setup-${KERNEL} https://raw.githubusercontent.com/gnustep/tools-scripts/master/setup-${KERNEL} + # Else, assume inside CI. + # For CI purposes, default to failing. Using bashism is fine here, for now. + set -euo pipefail + ./setup-${KERNEL} fi -./setup-${KERNEL} -rm ./setup-${KERNEL} - echo "======== Create gnustep build directories ========" -mkdir -p gnustep -cd gnustep -git clone git@github.com:gnustep/tools-scripts.git +if [ ! -e .git ] ; then + # Default outside CI. + mkdir -p gnustep + cd gnustep + git clone git@github.com:gnustep/tools-scripts.git +else + # Inside CI we are already in the repo. + # Just go to the parent directory, tools-scripts will exist. + cd .. +fi ./tools-scripts/clone-all-repos echo "================ Install Dependencies ================" diff --git a/setup-linux b/setup-linux index b44dd56..d14f098 100755 --- a/setup-linux +++ b/setup-linux @@ -6,37 +6,43 @@ COMMAND="apt" # Add distro specific variables... . /etc/lsb-release -# Install SUDO if needed... -if [ ! -e /usr/bin/sudo ]; then - echo "Installing sudo..." - if [ -e /usr/bin/apt ]; then - su -c "apt install sudo" - +MANAGE_SUDO="${MANAGE_SUDO:-yes}" +if [ "X${MANAGE_SUDO}" != "Xyes" ]; then + # Either CI or user does not want to adjust whether sudo is installed, + # whether root password is set or not, etc. + echo "Skipping sudo management" +else + # Install SUDO if needed... + if [ ! -e /usr/bin/sudo ]; then + echo "Installing sudo..." + if [ -e /usr/bin/apt ]; then + su -c "apt install sudo" + else + su -c "rpm install sudo" + COMMAND="rpm" + fi else - su -c "rpm install sudo" - COMMAND="rpm" + echo "sudo command is already present." fi -else - echo "sudo command is already present." -fi -# Update root password... -echo "Checking if root password is not set, please set it..." -if [ "${DISTRIB_ID}" = "Ubuntu" ]; then - STATUS=`sudo passwd root --status | cut -f2 -d' '` - if [ "${STATUS}" = "L" ]; then - sudo passwd root + # Update root password... + echo "Checking if root password is not set, please set it..." + if [ "${DISTRIB_ID}" = "Ubuntu" ]; then + STATUS=`sudo passwd root --status | cut -f2 -d' '` + if [ "${STATUS}" = "L" ]; then + sudo passwd root + fi fi -fi -# Add to sudoers -if [ "${DISTRIB_ID}" != "Ubuntu" ]; then - if [ ! -e /etc/sudoers.d/${USER} ]; then - echo "Adding ${USER} to sudoers..." - echo "Please enter the root user's password." - su -c 'echo "${USER} ALL=(ALL:ALL) ALL" > /etc/sudoers.d/${USER}' - else - echo "${USER} is already a member of sudo users." + # Add to sudoers + if [ "${DISTRIB_ID}" != "Ubuntu" ]; then + if [ ! -e /etc/sudoers.d/${USER} ]; then + echo "Adding ${USER} to sudoers..." + echo "Please enter the root user's password." + su -c 'echo "${USER} ALL=(ALL:ALL) ALL" > /etc/sudoers.d/${USER}' + else + echo "${USER} is already a member of sudo users." + fi fi fi