mirror of
https://github.com/nzp-team/quakec.git
synced 2025-04-26 11:30:55 +00:00
Merge pull request #112 from nzp-team/cypress_prbuilds
GIT: Update build script, do test builds for Pull Requests
This commit is contained in:
commit
e46c19bc5f
2 changed files with 60 additions and 23 deletions
12
.github/workflows/compile-and-release.yml
vendored
12
.github/workflows/compile-and-release.yml
vendored
|
@ -1,9 +1,9 @@
|
|||
name: Compile QuakeC and Publish Release
|
||||
on: [push]
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
Compile-QC:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main'
|
||||
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'pull_request' }}
|
||||
steps:
|
||||
- name: Install Python and Libraries
|
||||
run: |
|
||||
|
@ -17,16 +17,18 @@ jobs:
|
|||
run: |
|
||||
sudo -i
|
||||
./qc-compiler-gnu.sh
|
||||
echo "QC COMPILE STATUS - ${{ job.status }}."
|
||||
- name: Zip Progs
|
||||
if: github.ref == 'refs/heads/main'
|
||||
working-directory: ./build
|
||||
run: |
|
||||
zip -r -j fte-nzp-qc.zip fte/*
|
||||
zip -r -j standard-nzp-qc.zip standard/*
|
||||
- name: Generate Build Date
|
||||
if: github.ref == 'refs/heads/main'
|
||||
id: date
|
||||
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M-%S')"
|
||||
- name: Delete Old Release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
||||
with:
|
||||
delete_release: true
|
||||
|
@ -34,6 +36,7 @@ jobs:
|
|||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create Release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
|
@ -50,6 +53,7 @@ jobs:
|
|||
draft: true
|
||||
prerelease: false
|
||||
- name: Upload STANDARD QC
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -59,6 +63,7 @@ jobs:
|
|||
asset_name: standard-nzp-qc.zip
|
||||
asset_content_type: application/zip
|
||||
- name: Upload FTE QC
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -68,6 +73,7 @@ jobs:
|
|||
asset_name: fte-nzp-qc.zip
|
||||
asset_content_type: application/zip
|
||||
- name: Publish Release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: StuYarrow/publish-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -1,31 +1,62 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e errexit
|
||||
|
||||
FTEQCC=fteqcc-cli-lin
|
||||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
|
||||
QUAKEC_ROOT=$(dirname "${SCRIPT_DIR}")
|
||||
QUAKEC_LOG="/tmp/qc.log"
|
||||
|
||||
FTEQCC="fteqcc-cli-lin"
|
||||
RC="0"
|
||||
|
||||
# Switch to macOS fteqcc binary if on that platform.
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
FTEQCC=fteqcc-cli-mac
|
||||
if [[ "${OSTYPE}" == "darwin"* ]]; then
|
||||
FTEQCC="fteqcc-cli-mac"
|
||||
fi
|
||||
|
||||
cd ../
|
||||
function setup()
|
||||
{
|
||||
cd "${QUAKEC_ROOT}"
|
||||
echo "[INFO]: Generating Hash Table"
|
||||
local command="python3 bin/qc_hash_generator.py -i tools/asset_conversion_table.csv -o source/server/hash_table.qc"
|
||||
echo "[${command}]"
|
||||
$command
|
||||
echo "---------------"
|
||||
|
||||
# generate hash table
|
||||
echo "Generating Hash Table.."
|
||||
python3 bin/qc_hash_generator.py -i tools/asset_conversion_table.csv -o source/server/hash_table.qc
|
||||
mkdir -p build/{fte,standard}
|
||||
}
|
||||
|
||||
# create build directories
|
||||
mkdir -p build/{fte,standard}
|
||||
function compile_progs()
|
||||
{
|
||||
local src_file="$1"
|
||||
local name="$2"
|
||||
local flags="$3"
|
||||
local failure="1"
|
||||
|
||||
cd bin/
|
||||
echo "[INFO]: Compiling using [${src_file}] (${name}).."
|
||||
local command="bin/${FTEQCC} ${flags} -srcfile progs/${src_file}.src"
|
||||
echo "[${command}]"
|
||||
$command 2>&1 | tee -a "${QUAKEC_LOG}" > /dev/null
|
||||
local return_code=$?
|
||||
|
||||
# build..
|
||||
echo "Compiling FTE CSQC.."
|
||||
./$FTEQCC -srcfile ../progs/csqc.src | grep -E -i "warning |error |defined |not |unknown |branches"
|
||||
echo "Compiling FTE SSQC.."
|
||||
./$FTEQCC -O3 -DFTE -srcfile ../progs/ssqc.src | grep -E -i "warning |error |defined |not |unknown |branches"
|
||||
echo "Compiling FTE MenuQC.."
|
||||
./$FTEQCC -O3 -DFTE -srcfile ../progs/menu.src | grep -E -i "warning |error |defined |not |unknown |branches"
|
||||
echo "Compiling Standard/Id SSQC.."
|
||||
./$FTEQCC -O3 -srcfile ../progs/ssqc.src | grep -E -i "warning |error |defined |not |unknown |branches"
|
||||
sed 's/^.\{16\}//' "${QUAKEC_LOG}" | grep -E "warning|error|defined|not|unknown|branches" || failure="0"
|
||||
rm -rf "${QUAKEC_LOG}"
|
||||
|
||||
echo "End of script."
|
||||
if [[ "${failure}" -ne "0" ]]; then
|
||||
echo "[ERROR]: FAILED to build!"
|
||||
RC="1"
|
||||
fi
|
||||
|
||||
echo "---------------"
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
setup;
|
||||
compile_progs "csqc" "FTE CSQC" "-DFTE"
|
||||
compile_progs "ssqc" "FTE SSQC" "-O3 -DFTE"
|
||||
compile_progs "menu" "FTE MenuQC" "-O3 -DFTE"
|
||||
compile_progs "ssqc" "Vril SSQC" "-O3"
|
||||
exit ${RC}
|
||||
}
|
||||
|
||||
main;
|
Loading…
Reference in a new issue