From cf679cebc89d2a72f2f9c2c11b284d52cbab57fe Mon Sep 17 00:00:00 2001 From: Patrick <65868806+braillescreen@users.noreply.github.com> Date: Mon, 2 Dec 2024 07:58:34 -0600 Subject: [PATCH] CI improvements (#143) Various CI improvements: * The macOS and Linux build scripts now create Python virtual environments. * Fixed extra 'F' at the beginning of the Linux script. * Updated the build documentation. * Ensure libssl-dev is installed on Linux. --- .github/workflows/release.yml | 8 ++++++-- .gitignore | 1 + build/build_linux.sh | 11 +++++++---- build/build_macos.sh | 3 +++ doc/src/advanced/Building NVGT For Linux.md | 10 ++++++---- doc/src/advanced/Building NVGT for MacOS.md | 9 ++++++--- 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b70eee7c..31003738 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v4 - name: build run: | - brew install scons + pip3 install scons cp build/build_macos.sh . sudo chmod +x build_macos.sh ./build_macos.sh ci @@ -24,6 +24,7 @@ jobs: - uses: actions/checkout@v4 - name: build run: | + pip3 install scons sudo chmod +x build/build_linux.sh ./build/build_linux.sh ci cd release @@ -158,8 +159,11 @@ jobs: mkdir windows_release tar -xzf windows_release.tar.gz -C windows_release tar -xzf linux_release.tar.gz -C release + python3 -m venv venv --upgrade-deps + chmod +x venv/bin/activate + source ./venv/bin/activate cd doc - pip3 install --user -r requirements.txt + pip3 install -r requirements.txt cd OSL python3 make_osl_document.py cd .. diff --git a/.gitignore b/.gitignore index be6c3113..ae8c813b 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ lindev macosdev windev deps +venv # website builds web/public_html diff --git a/build/build_linux.sh b/build/build_linux.sh index 11424847..caa48d4b 100644 --- a/build/build_linux.sh +++ b/build/build_linux.sh @@ -1,4 +1,4 @@ -F#!/bin/bash +#!/bin/bash function setup_angelscript { echo Installing Angelscript... @@ -108,8 +108,7 @@ function setup_nvgt { cd .. rm lindev.tar.gz if ! which scons &> /dev/null; then - export PIP_BREAK_SYSTEM_PACKAGES=1 - pip3 install --user scons + pip3 install scons fi scons -s no_upx=0 echo NVGT built. @@ -118,11 +117,14 @@ function setup_nvgt { function main { sudo apt update -y set -e + python3 -m venv venv --upgrade-deps + chmod +x venv/bin/activate + source ./venv/bin/activate mkdir -p deps cd deps # Insure required packages are installed for building. - sudo apt install build-essential gcc g++ make cmake autoconf libtool python3 python3-pip libsystemd-dev libspeechd-dev -y + sudo apt install build-essential gcc g++ make cmake autoconf libtool python3 python3-pip libssl-dev libsystemd-dev libspeechd-dev -y setup_angelscript setup_reactphysics @@ -132,6 +134,7 @@ function main { setup_sdl setup_nvgt echo Success! + deactivate exit 0 } diff --git a/build/build_macos.sh b/build/build_macos.sh index f66f6a1c..6d005dc5 100644 --- a/build/build_macos.sh +++ b/build/build_macos.sh @@ -133,6 +133,9 @@ function setup_nvgt { function main { set -e + python3 -m venv venv --upgrade-deps + chmod +x venv/bin/activate + source ./venv/bin/activate mkdir -p deps cd deps setup_homebrew diff --git a/doc/src/advanced/Building NVGT For Linux.md b/doc/src/advanced/Building NVGT For Linux.md index 7de81b92..fca4405a 100644 --- a/doc/src/advanced/Building NVGT For Linux.md +++ b/doc/src/advanced/Building NVGT For Linux.md @@ -5,11 +5,13 @@ There is a [script to build NVGT on Linux](https://raw.githubusercontent.com/sam Internally, this script is used within our GitHub Actions to make builds of NVGT. It is also used within our local testing environments. -Note that this script will currently only run on systems where apt is installed, and does not support any other package managers. +### Notes +* This script will currently only run on systems where `apt` and `pip` are installed, and does not support any other package managers. +* This script will create and activate a [virtual environment](https://docs.python.org/3/library/venv.html). This script can be ran in two modes: -* Adding `ci` as an argument causes the dependencies to be downloaded in the current working directory inside a `deps` folder (useful if you already are working from within NVGT). -* If `ci` is not present, the script will assume NVGT is not downloaded and will clone NVGT before attempting to build it. +* Adding `ci` as an argument causes the dependencies to be downloaded in the current working directory inside a `deps` folder (useful if you already are working from within NVGT's source directory). +* If `ci` is not present, the script will assume NVGT is not downloaded and will clone NVGT into the current directory before attempting to build it. ### Example of Running the script with the `ci` argument It is assumed you are in a freshly-cloned NVGT, so that your working directory ends with `nvgt`. @@ -28,7 +30,7 @@ chmod +x build_linux.sh ``` ## Building NVGT manually -If you wish to build manually, some slightly older instructions are below. +If you wish to build manually, some rather old instructions are below. At this time, it would probably be much more beneficial to read the `build_linux.sh` script or [readme.md](https://github.com/samtupy/nvgt) for much more updated commands; the below commands are here for reference and aren't updated often. Please keep in mind that this is a very very rough draft, I've only done this once before when I built nvgt's server components for stw. This will attempt to describe, even for a user who doesn't use linux much, how to build nvgt at least on Ubuntu 22.04 LTS. diff --git a/doc/src/advanced/Building NVGT for MacOS.md b/doc/src/advanced/Building NVGT for MacOS.md index d502c3b6..92fc56cf 100644 --- a/doc/src/advanced/Building NVGT for MacOS.md +++ b/doc/src/advanced/Building NVGT for MacOS.md @@ -5,9 +5,12 @@ There is a [script to build NVGT on macOS](https://raw.githubusercontent.com/sam Internally, this script is used within our GitHub Actions to make builds of NVGT. It is also used within our local testing environments. +### Notes +* This script will create and activate a [virtual environment](https://docs.python.org/3/library/venv.html). + This script can be ran in two modes: -* Adding `ci` as an argument causes the dependencies to be downloaded in the current working directory inside a `deps` folder (useful if you already are working from within NVGT). -* If `ci` is not present, the script will assume NVGT is not downloaded and will clone NVGT before attempting to build it. +* Adding `ci` as an argument causes the dependencies to be downloaded in the current working directory inside a `deps` folder (useful if you already are working from within NVGT's source directory). +* If `ci` is not present, the script will assume NVGT is not downloaded and will clone NVGT into the current directory before attempting to build it. ### Example of Running the script with the `ci` argument It is assumed you are in a freshly-cloned NVGT, so that your working directory ends with `nvgt`. @@ -28,7 +31,7 @@ chmod +x build_macos.sh ## Building NVGT manually -Below are some older notes for building NVGT for macOS. +If you wish to build manually, some rather old instructions are below. At this time, it would probably be much more beneficial to read the `build_macos.sh` script or [readme.md](https://github.com/samtupy/nvgt) for much more updated commands; the below commands are here for reference and aren't updated often. Assuming xcode and homebrew are installed: