From 4e4efa43cae38bfbb3a825648c8b813a0f449702 Mon Sep 17 00:00:00 2001 From: Jian Date: Tue, 21 Apr 2026 05:01:53 +0500 Subject: [PATCH 01/11] feat: add gmqcc as submodule --- .gitignore | 1 - .gitmodules | 3 +++ gmqcc | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 160000 gmqcc diff --git a/.gitignore b/.gitignore index 0ebc74bfc..383c8acf1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ compiled/ -gmqcc/ *.dat *.lno .cache/ diff --git a/.gitmodules b/.gitmodules index 23fe43be3..770d3127f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = xonotic url = https://gitlab.com/smbxon/xonotic-data.pk3dir.git branch = main +[submodule "gmqcc"] + path = gmqcc + url = https://gitlab.com/xonotic/gmqcc.git diff --git a/gmqcc b/gmqcc new file mode 160000 index 000000000..b2a319efb --- /dev/null +++ b/gmqcc @@ -0,0 +1 @@ +Subproject commit b2a319efb41069b9a250e76991dbe505ff8d030d From 774f0cbb608ee2f147560e5441daa144fcf95185 Mon Sep 17 00:00:00 2001 From: Jian Date: Wed, 22 Apr 2026 00:09:08 +0500 Subject: [PATCH 02/11] build: refactor build system and optimize CI workflow - Add centralized build script (build.sh) - Optimize GitHub Actions using caching and partial clones - Update .gitignore and move output directory from 'compiled/' to 'build/' - Remove redundant daily.yml workflow - Remove update.sh and integrate gmqcc compilation into build.sh --- .github/workflows/build.yml | 78 +++++++++---------- .github/workflows/daily.yml | 31 -------- .gitignore | 4 +- build.sh | 144 ++++++++++++++++++++++++++---------- update.sh | 28 ------- 5 files changed, 144 insertions(+), 141 deletions(-) delete mode 100644 .github/workflows/daily.yml delete mode 100755 update.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71f22006c..4c08de39d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,47 +1,49 @@ -name: Build +name: Build Progs Artifacts on: + workflow_dispatch: + inputs: + reason: + description: "Reason for running" + required: false + default: "Manual check" push: jobs: - build: - + build-artifacts: runs-on: ubuntu-latest - steps: - - - name: Checkout + - name: Checkout Repository uses: actions/checkout@v4 - - - name: Prepare - run: ./update.sh - env: - CI: true - ARCHIVE: 1 - - - name: Build - run: ./build.sh - env: - TERM: xterm - ARCHIVE: 1 - - - name: Set artifact name - run: | - git fetch --tags - echo "ARTIFACT_NAME=progs-$(git describe --tags --dirty='~' --always)" >> $GITHUB_ENV - - - name: Store artifacts - uses: actions/upload-artifact@v4 with: - name: ${{ env.ARTIFACT_NAME }} - path: | - compiled/* - if-no-files-found: error - # retention-days: 14 + # Create partial clone + # See: https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---filterfilter-spec + filter: blob:none + submodules: false + fetch-depth: 0 + fetch-tags: true + + - name: Initialize Sumbodules + # Create a small clone, with full history to improve workflow speed. + # For example, original size of xonotic-data.pk3dir is ~4GB + # with: git submodules update --init --filter=blob:none xonotic + # The size is reduced to ~700MB + # https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---filterfilter-spec + run: git submodule update --init --filter=blob:none gmqcc xonotic + + - name: Get gmqcc Commit ID + id: get-gmqcc-commit-id + run: echo "GMQCC_SHA=$(git rev-parse :gmqcc)" >> "$GITHUB_OUTPUT" + + - name: Cache gmqcc Binary + id: cache-gmqcc + uses: actions/cache@v4 + with: + path: gmqcc/gmqcc + key: ${{ runner.os }}-gmqcc-bin-${{ steps.get-gmqcc-commit-id.outputs.GMQCC_SHA }} + + - if: steps.cache-gmqcc.outputs.cache-hit != 'true' + name: Compile gmqcc Binary + run: make -C gmqcc -j$(nproc) - - name: Publish a release - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - files: | - compiled/* + - name: Build Progs + run: ./build.sh -a diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml deleted file mode 100644 index a80ecdcd2..000000000 --- a/.github/workflows/daily.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: QC Master Daily -on: - schedule: - - cron: '19 0 * * *' - workflow_dispatch: - -jobs: - qc-master-daily: - - runs-on: ubuntu-latest - - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: Prepare - run: ./update.sh - env: - CI: true - ARCHIVE: 1 - - - name: Checkout xonotic-data master - run: | - git -C xonotic checkout master - - - name: Build - run: ./build.sh - env: - TERM: xterm - ARCHIVE: 1 diff --git a/.gitignore b/.gitignore index 383c8acf1..af83a810a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -compiled/ -*.dat -*.lno +build/ .cache/ .DS_Store diff --git a/build.sh b/build.sh index 692980d92..5963e65f9 100755 --- a/build.sh +++ b/build.sh @@ -1,60 +1,122 @@ #!/usr/bin/env bash -if [ -n "${ZIP:-}" ]; then - tput bold; tput setaf 3; echo "WARNING: Processing without compression..."; tput sgr0 -fi -if [ -e $(dirname "$0")/compiled/csprogs.dat -o -e $(dirname "$0")/compiled/menu.dat -o -e $(dirname "$0")/compiled/progs.dat -o -e $(dirname "$0")/compiled/csprogs.lno -o -e $(dirname "$0")/compiled/menu.lno -o -e $(dirname "$0")/compiled/progs.lno -o -e $(dirname "$0")/compiled/*.pk3 -o -e $(dirname "$0")/csprogs.dat -o -e $(dirname "$0")/menu.dat -o -e $(dirname "$0")/progs.dat -o -e $(dirname "$0")/csprogs.lno -o -e $(dirname "$0")/menu.lno -o -e $(dirname "$0")/progs.lno ]; then - tput bold; tput setaf 3; echo "There are compiled files here. The operation will proceed to delete the current compiled files in and out of the 'compiled' directory, replace and get new compiled ones (*.dat, *.lno, and *.pk3 files will be removed)." - # deletes any remaining compiled files that weren't moved to 'compiled' directory - tput bold; tput setaf 1 +TARGET_ALL=0 +CLEAN_BUILD=0 +MAKE_TARGETS=("qc") + +usage() { + echo "build.sh [-c|--clean] [-a|-all]" + echo + echo " -c | --clean Remove the build artifacts and rebuild." + echo " -a | --all Build both qc and pk3 targets." + echo " -h | --help Show this message." + echo + echo "NOTE: Default target is 'qc' only." +} + +# Filter repeating arguments. +# Who would pass same arguments multiple times tho?! +if [[ $# -gt 0 ]]; then + readarray -t arguments < <(printf '%s\n' "$@" | sort -u) +else + # No arguments were provided + arguments=() +fi - rm -vf $(dirname "$0")/*.dat - rm -vf $(dirname "$0")/*.lno - rm -vf $(dirname "$0")/*.pk3 +# Parse CLI arguments +for i in "${arguments[@]}"; do + case $i in + -a | --all) + TARGET_ALL=1 + MAKE_TARGETS+=("pk3") + ;; + -c | --clean) + CLEAN_BUILD=1 + ;; + -h | --help) + usage + exit 0 + ;; + *) + echo "Unknown flag: '$i' ... aborting" + exit 1 + ;; + esac +done - rm -vf $(dirname "$0")/compiled/*.dat - rm -vf $(dirname "$0")/compiled/*.lno - rm -vf $(dirname "$0")/compiled/*.pk3 +if [[ ! -f "gmqcc/.git" ]]; then + echo "=> Submodule gmqcc not initialized..." + echo "=> Creating partial clone... (with --filter=blob:none)" + if ! git submodule update --init --filter=blob:none gmqcc; then + echo " -> Failed to initialize gmqcc submodule... aborting" + exit 1 + fi +else + echo "=> Submodule gmqcc already initialized." +fi - tput sgr0 +if [[ ! -f "gmqcc/gmqcc" ]]; then + echo "=> Building gmqcc..." + if ! make -C gmqcc -j"$(nproc)"; then + echo " -> Failed to build gmqcc... aborting" + exit 1 + fi +else + echo "=> Using existing gmqcc binary (VERSION: $(gmqcc/gmqcc --version))" fi -cd ${0%[\\/]*} -set -eu +if [[ ! -d "build" ]]; then + echo "=> Creating build directory..." + if ! mkdir build; then + echo " -> Could not create build directory... aborting" + exit 1 + fi +fi -declare base=xonotic -if [ ! -d "$base" ]; then - echo "RTFM (README.md)" +if [[ ! -f "xonotic/.git" ]]; then + echo "=> Submodule xonotic not initialized..." + echo "=> Creating partial clone... (with --filter=blob:none)" + if ! git submodule update --init --filter=blob:none xonotic; then + echo " -> Failed to initialize xonotic submodule... aborting" exit 1 + fi +else + echo "=> Submodule xonotic already initialized." fi -: ${PROGS_OUT:=$PWD} -export PROGS_OUT +export XONOTIC=${XONOTIC:-1} +export QCC=${QCC:-"$(pwd)/gmqcc/gmqcc"} -: ${QCC:=$PWD/gmqcc/gmqcc} -export QCC +WATERMARK="$(git describe --tags --dirty='~' --always)" +if [[ $? -ne 0 ]]; then + echo "-> Error: Failed to generate QCCFLAGS_WATERMARK... aborting" + exit 1 +fi +export QCCFLAGS_WATERMARK="${WATERMARK}" +export PROGS_OUT=${PROGS_OUT:-"$(pwd)/build"} -export QCCFLAGS_WATERMARK=$(git describe --tags --dirty='~' --always) +TMP_MOD="$(realpath --relative-to=xonotic/qcsrc "$(pwd)")" +if [[ $? -ne 0 ]]; then + echo "-> Error: could not calculate BUILD_MOD... aborting" + exit 1 +fi -relpath() { - b=; s=$(cd $(readlink -f ${1%%/}); pwd); d=$(cd $2; pwd) - while [ "${d#$s/}" == "${d}" ]; do s=$(dirname ${s}); b="../${b}"; done - echo ${b}${d#${s}/} -} +if [[ -z "$TMP_MOD" ]]; then + echo "TMP_MOD is empty! ... aborting" + exit 1 +fi -export BUILD_MOD="$(relpath $base/qcsrc $PWD)" -export XONOTIC=1 -make -C ${base} +export BUILD_MOD="${TMP_MOD}" -tput bold; tput setaf 2; echo "Compiled successfully!"; tput sgr0 -mkdir -vp $(dirname "$0")/compiled -mv -v *.lno $(dirname "$0")/compiled -mv -v *.dat $(dirname "$0")/compiled +echo "=> Starting Compilation..." +((CLEAN_BUILD == 1)) && make -C xonotic clean && rm -f "${PROGS_OUT}/"csprogs-*.pk3 -if [ -n "${ZIP:-}" ]; then - tput bold; tput setaf 3; echo "Done without compression."; tput sgr0 +if ! make -C xonotic "${MAKE_TARGETS[@]}"; then + echo " -> Modpack compilation failed... aborting" + exit 1 else - cp -v $base/qcsrc/csprogs-*.pk3 ./compiled + if ((TARGET_ALL == 1)); then + cp xonotic/qcsrc/csprogs-*.pk3 "${PROGS_OUT}" + fi + exit 0 fi - -tput bold; tput setaf 3; echo "Now you can look at the compiled files inside $(dirname "$0")/compiled directory." diff --git a/update.sh b/update.sh deleted file mode 100755 index 3fd829147..000000000 --- a/update.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -cd ${0%[\\/]*} -set -eu - -git fetch --tags -if [ -z "${CI-}" ]; then - git pull -fi - -git submodule update --init --depth 100 - -declare qccDir='gmqcc' -declare qccRepo='https://gitlab.com/xonotic/gmqcc.git' -declare qccBranch='main' - -#if [ -z "${CI-}" ]; then -# wget -P .cache -c https://github.com/MarioSMB/csprogs/raw/master/csprogs-$(git describe --tags --dirty=*).pk3 -#fi - -if [ ! -d "$qccDir" ]; then - git clone --depth=1 --branch=${qccBranch} ${qccRepo} ${qccDir} -else - pushd ${qccDir} && git pull - popd -fi - -pushd ${qccDir} && make -popd From 62069156769349ef7e0d582ccfd1c061292b51db Mon Sep 17 00:00:00 2001 From: Jian Date: Wed, 22 Apr 2026 01:17:45 +0500 Subject: [PATCH 03/11] ci(build.yml): upload build artifacts --- .github/workflows/build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4c08de39d..db85fbd3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,3 +47,10 @@ jobs: - name: Build Progs run: ./build.sh -a + + # Upload the build path + - name: Upload Artifacts + uses: actions/upload-artifact@v7 + with: + name: progs + path: build From 65d701bdd7747eee695029d74b2d8959fdf4bc57 Mon Sep 17 00:00:00 2001 From: Jian Date: Wed, 22 Apr 2026 02:16:21 +0500 Subject: [PATCH 04/11] ci(build.yml): add version info the artifact name --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db85fbd3b..ffa778af1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,9 +48,12 @@ jobs: - name: Build Progs run: ./build.sh -a - # Upload the build path + - name: Generate Artifact Name + run: echo "ARTIFACT_NAME=progs-$(git describe --tags --dirty="~" --always)" >> "$GITHUB_ENV" + + # Upload the files in build folder - name: Upload Artifacts uses: actions/upload-artifact@v7 with: - name: progs + name: ${{ env.ARTIFACT_NAME }} path: build From 265f304f7df28c7e19d74f1743c0dbc2a52c326e Mon Sep 17 00:00:00 2001 From: Jian Date: Thu, 23 Apr 2026 00:00:30 +0500 Subject: [PATCH 05/11] feat: scope build output to current branch name --- build.sh | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index 5963e65f9..44c3281ef 100755 --- a/build.sh +++ b/build.sh @@ -44,6 +44,13 @@ for i in "${arguments[@]}"; do esac done +if ! CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"; then + echo "=> Failed to parse git branch name... aborting" + exit 1 +else + echo "=> Current Branch is ${CURRENT_BRANCH}" +fi + if [[ ! -f "gmqcc/.git" ]]; then echo "=> Submodule gmqcc not initialized..." echo "=> Creating partial clone... (with --filter=blob:none)" @@ -65,9 +72,9 @@ else echo "=> Using existing gmqcc binary (VERSION: $(gmqcc/gmqcc --version))" fi -if [[ ! -d "build" ]]; then - echo "=> Creating build directory..." - if ! mkdir build; then +if [[ ! -d "build/${CURRENT_BRANCH}" ]]; then + echo "=> Creating build directory... (build/${CURRENT_BRANCH})" + if ! mkdir -p "build/${CURRENT_BRANCH}"; then echo " -> Could not create build directory... aborting" exit 1 fi @@ -87,16 +94,16 @@ fi export XONOTIC=${XONOTIC:-1} export QCC=${QCC:-"$(pwd)/gmqcc/gmqcc"} -WATERMARK="$(git describe --tags --dirty='~' --always)" -if [[ $? -ne 0 ]]; then +if ! WATERMARK="$(git describe --tags --dirty='~' --always)"; then echo "-> Error: Failed to generate QCCFLAGS_WATERMARK... aborting" exit 1 +else + echo "=> Version tag is: ${WATERMARK}" fi export QCCFLAGS_WATERMARK="${WATERMARK}" -export PROGS_OUT=${PROGS_OUT:-"$(pwd)/build"} +export PROGS_OUT=${PROGS_OUT:-"$(pwd)/build/${CURRENT_BRANCH}"} -TMP_MOD="$(realpath --relative-to=xonotic/qcsrc "$(pwd)")" -if [[ $? -ne 0 ]]; then +if ! TMP_MOD="$(realpath --relative-to=xonotic/qcsrc "$(pwd)")"; then echo "-> Error: could not calculate BUILD_MOD... aborting" exit 1 fi @@ -108,9 +115,13 @@ fi export BUILD_MOD="${TMP_MOD}" -echo "=> Starting Compilation..." -((CLEAN_BUILD == 1)) && make -C xonotic clean && rm -f "${PROGS_OUT}/"csprogs-*.pk3 +if ((CLEAN_BUILD == 1)); then + echo "=> Cleaning old build artifacts in build/${CURRENT_BRANCH}" + make -C xonotic clean + rm -f "${PROGS_OUT}/"csprogs-*.pk3 +fi +echo "=> Starting Compilation..." if ! make -C xonotic "${MAKE_TARGETS[@]}"; then echo " -> Modpack compilation failed... aborting" exit 1 From ab2c880f112986219b2950e4b5dc514e0c6cb170 Mon Sep 17 00:00:00 2001 From: Jian Date: Thu, 23 Apr 2026 00:12:02 +0500 Subject: [PATCH 06/11] ci(build.yml): include branch name in artifact filenames --- .github/workflows/build.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ffa778af1..789414382 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,11 +49,16 @@ jobs: run: ./build.sh -a - name: Generate Artifact Name - run: echo "ARTIFACT_NAME=progs-$(git describe --tags --dirty="~" --always)" >> "$GITHUB_ENV" + run: | + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + VERSION_TAG=$(git describe --tags --dirty="~" --always) + echo "CURRENT_BRANCH=${CURRENT_BRANCH}" >> "$GITHUB_ENV" + echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV" + echo "ARTIFACT_NAME=progs-${CURRENT_BRANCH}-${VERSION_TAG}" >> "$GITHUB_ENV" # Upload the files in build folder - name: Upload Artifacts uses: actions/upload-artifact@v7 with: name: ${{ env.ARTIFACT_NAME }} - path: build + path: build/${{ env.CURRENT_BRANCH }} From ff4f1b03395f78c873331643850504c81a50e199 Mon Sep 17 00:00:00 2001 From: Jian Date: Fri, 24 Apr 2026 05:16:05 +0500 Subject: [PATCH 07/11] ci(build.yml): skip gmqcc init on cache hit --- .github/workflows/build.yml | 8 ++++++-- build.sh | 38 +++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 789414382..c75ec9b2c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,13 +22,13 @@ jobs: fetch-depth: 0 fetch-tags: true - - name: Initialize Sumbodules + - name: Initialize xonotic submodule # Create a small clone, with full history to improve workflow speed. # For example, original size of xonotic-data.pk3dir is ~4GB # with: git submodules update --init --filter=blob:none xonotic # The size is reduced to ~700MB # https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---filterfilter-spec - run: git submodule update --init --filter=blob:none gmqcc xonotic + run: git submodule update --init --filter=blob:none xonotic - name: Get gmqcc Commit ID id: get-gmqcc-commit-id @@ -41,6 +41,10 @@ jobs: path: gmqcc/gmqcc key: ${{ runner.os }}-gmqcc-bin-${{ steps.get-gmqcc-commit-id.outputs.GMQCC_SHA }} + - if: steps.cache-gmqcc.outputs.cache-hit != 'true' + name: Initialize gmqcc submodule + run: git submodule update --init --filter=blob:none gmqcc + - if: steps.cache-gmqcc.outputs.cache-hit != 'true' name: Compile gmqcc Binary run: make -C gmqcc -j$(nproc) diff --git a/build.sh b/build.sh index 44c3281ef..e7bc829ed 100755 --- a/build.sh +++ b/build.sh @@ -4,12 +4,19 @@ TARGET_ALL=0 CLEAN_BUILD=0 MAKE_TARGETS=("qc") +if [[ "$CI" == "true" ]]; then + INIT_SUBMODULES=0 +else + INIT_SUBMODULES=1 +fi + usage() { echo "build.sh [-c|--clean] [-a|-all]" echo echo " -c | --clean Remove the build artifacts and rebuild." echo " -a | --all Build both qc and pk3 targets." echo " -h | --help Show this message." + echo " --no-init Don't bother initializing submodules. (For CI Only)" echo echo "NOTE: Default target is 'qc' only." } @@ -37,6 +44,9 @@ for i in "${arguments[@]}"; do usage exit 0 ;; + --no-init) + INIT_SUBMODULES=0 + ;; *) echo "Unknown flag: '$i' ... aborting" exit 1 @@ -52,11 +62,15 @@ else fi if [[ ! -f "gmqcc/.git" ]]; then - echo "=> Submodule gmqcc not initialized..." - echo "=> Creating partial clone... (with --filter=blob:none)" - if ! git submodule update --init --filter=blob:none gmqcc; then - echo " -> Failed to initialize gmqcc submodule... aborting" - exit 1 + if ((INIT_SUBMODULES == 1)); then + echo "=> Submodule gmqcc not initialized..." + echo "=> Creating partial clone... (with --filter=blob:none)" + if ! git submodule update --init --filter=blob:none gmqcc; then + echo " -> Failed to initialize gmqcc submodule... aborting" + exit 1 + fi + else + echo "=> Skipping gmqcc initialization... (running in CI)" fi else echo "=> Submodule gmqcc already initialized." @@ -81,11 +95,15 @@ if [[ ! -d "build/${CURRENT_BRANCH}" ]]; then fi if [[ ! -f "xonotic/.git" ]]; then - echo "=> Submodule xonotic not initialized..." - echo "=> Creating partial clone... (with --filter=blob:none)" - if ! git submodule update --init --filter=blob:none xonotic; then - echo " -> Failed to initialize xonotic submodule... aborting" - exit 1 + if ((INIT_SUBMODULES == 1)); then + echo "=> Submodule xonotic not initialized..." + echo "=> Creating partial clone... (with --filter=blob:none)" + if ! git submodule update --init --filter=blob:none xonotic; then + echo " -> Failed to initialize xonotic submodule... aborting" + exit 1 + fi + else + echo "=> Skipping xonotic submodule initialization... (running in CI)" fi else echo "=> Submodule xonotic already initialized." From bfc59b002239e089d9ae0a1dffc70094172936ad Mon Sep 17 00:00:00 2001 From: Jian Date: Sun, 17 May 2026 20:22:52 +0500 Subject: [PATCH 08/11] build: add flag to toggle git filter flag - Add github workflow to test building the mod against xonotic master --- .github/workflows/daily.yml | 72 +++++++++++++++++++++++++++++++++++++ build.sh | 11 +++--- 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/daily.yml diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml new file mode 100644 index 000000000..3d69783a6 --- /dev/null +++ b/.github/workflows/daily.yml @@ -0,0 +1,72 @@ +name: Test Build Against QC Master Daily +on: + schedule: + - cron: "19 0 * * *" + workflow_dispatch: + inputs: + reason: + description: "Reason for Running" + required: false + default: "Manual Check" + +jobs: + test-build-artifacts: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + # Create partial clone + # See: https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---filterfilter-spec + filter: blob:none + submodules: false + fetch-depth: 0 + fetch-tags: true + + - name: Initialize xonotic submodule + # Create a small clone, with full history to improve workflow speed. + # For example, original size of xonotic-data.pk3dir is ~4GB + # with: git submodules update --init --filter=blob:none xonotic + # The size is reduced to ~700MB + # https://git-scm.com/docs/git-rev-list#Documentation/git-rev-list.txt---filterfilter-spec + run: | + git submodule update --init --filter=blob:none xonotic + git -C xonotic checkout master + git -C xonotic pull origin master + + - name: Get gmqcc Commit ID + id: get-gmqcc-commit-id + run: echo "GMQCC_SHA=$(git rev-parse :gmqcc)" >> "$GITHUB_OUTPUT" + + - name: Cache gmqcc Binary + id: cache-gmqcc + uses: actions/cache@v4 + with: + path: gmqcc/gmqcc + key: ${{ runner.os }}-gmqcc-bin-${{ steps.get-gmqcc-commit-id.outputs.GMQCC_SHA }} + + - if: steps.cache-gmqcc.outputs.cache-hit != 'true' + name: Initialize gmqcc submodule + run: git submodule update --init --filter=blob:none gmqcc + + - if: steps.cache-gmqcc.outputs.cache-hit != 'true' + name: Compile gmqcc Binary + run: make -C gmqcc -j$(nproc) + + - name: Build Progs + run: ./build.sh -a + + - name: Generate Artifact Name + run: | + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + VERSION_TAG=$(git describe --tags --dirty="~" --always) + echo "CURRENT_BRANCH=${CURRENT_BRANCH}" >> "$GITHUB_ENV" + echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV" + echo "ARTIFACT_NAME=progs-${CURRENT_BRANCH}-${VERSION_TAG}" >> "$GITHUB_ENV" + + # Upload the files in build folder + - name: Upload Artifacts + uses: actions/upload-artifact@v7 + with: + name: ${{ env.ARTIFACT_NAME }} + path: build/${{ env.CURRENT_BRANCH }} diff --git a/build.sh b/build.sh index e7bc829ed..cdb0736ed 100755 --- a/build.sh +++ b/build.sh @@ -3,6 +3,7 @@ TARGET_ALL=0 CLEAN_BUILD=0 MAKE_TARGETS=("qc") +FILTER_FLAGS="--filter=blob:none" if [[ "$CI" == "true" ]]; then INIT_SUBMODULES=0 @@ -16,6 +17,7 @@ usage() { echo " -c | --clean Remove the build artifacts and rebuild." echo " -a | --all Build both qc and pk3 targets." echo " -h | --help Show this message." + echo " --no-filter Don't use --filter flag when initializing submodules" echo " --no-init Don't bother initializing submodules. (For CI Only)" echo echo "NOTE: Default target is 'qc' only." @@ -47,6 +49,9 @@ for i in "${arguments[@]}"; do --no-init) INIT_SUBMODULES=0 ;; + -nf | --no-filter) + FILTER_FLAGS="" + ;; *) echo "Unknown flag: '$i' ... aborting" exit 1 @@ -64,8 +69,7 @@ fi if [[ ! -f "gmqcc/.git" ]]; then if ((INIT_SUBMODULES == 1)); then echo "=> Submodule gmqcc not initialized..." - echo "=> Creating partial clone... (with --filter=blob:none)" - if ! git submodule update --init --filter=blob:none gmqcc; then + if ! git submodule update --init $FILTER_FLAGS gmqcc; then echo " -> Failed to initialize gmqcc submodule... aborting" exit 1 fi @@ -97,8 +101,7 @@ fi if [[ ! -f "xonotic/.git" ]]; then if ((INIT_SUBMODULES == 1)); then echo "=> Submodule xonotic not initialized..." - echo "=> Creating partial clone... (with --filter=blob:none)" - if ! git submodule update --init --filter=blob:none xonotic; then + if ! git submodule update --init $FILTER_FLAGS xonotic; then echo " -> Failed to initialize xonotic submodule... aborting" exit 1 fi From 8aea679e20391563d5d6f807fc4b774b56b656ab Mon Sep 17 00:00:00 2001 From: Jian Date: Mon, 18 May 2026 22:14:20 +0500 Subject: [PATCH 09/11] feat(build.sh): enhance submodule handling and CLI arguments - Add short-hand flags `-nf` and `-ni` for submodule control - Replace file-existence checks for submodules with `git submodule status` - Improve logging to include commit hashes during initialization - Update usage documentation --- build.sh | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/build.sh b/build.sh index cdb0736ed..4b2a4b148 100755 --- a/build.sh +++ b/build.sh @@ -12,13 +12,13 @@ else fi usage() { - echo "build.sh [-c|--clean] [-a|-all]" + echo "build.sh [-c|--clean] [-a|-all] [-nf|--no-filter] [-ni|--no-init] [-h|--help]" echo - echo " -c | --clean Remove the build artifacts and rebuild." - echo " -a | --all Build both qc and pk3 targets." - echo " -h | --help Show this message." - echo " --no-filter Don't use --filter flag when initializing submodules" - echo " --no-init Don't bother initializing submodules. (For CI Only)" + echo " -c | --clean Remove compiled .dat and .pk3 file before rebuilding." + echo " -a | --all Build both qc and pk3 targets." + echo " -h | --help Show this message." + echo " -nf | --no-filter Don't use --filter flag when initializing submodules." + echo " -ni | --no-init Skip initializing submodules, manual initialization." echo echo "NOTE: Default target is 'qc' only." } @@ -46,7 +46,7 @@ for i in "${arguments[@]}"; do usage exit 0 ;; - --no-init) + -ni | --no-init) INIT_SUBMODULES=0 ;; -nf | --no-filter) @@ -66,18 +66,19 @@ else echo "=> Current Branch is ${CURRENT_BRANCH}" fi -if [[ ! -f "gmqcc/.git" ]]; then - if ((INIT_SUBMODULES == 1)); then - echo "=> Submodule gmqcc not initialized..." +submodule_gmqcc_status=$(git submodule status gmqcc | awk '{ print $1 }') +if ((INIT_SUBMODULES == 1)); then + if [[ "${submodule_gmqcc_status:0:1}" == "+" || "${submodule_gmqcc_status:0:1}" == "-" ]]; then + echo "=> Submodule gmqcc not initialized... (commit: ${submodule_gmqcc_status})" if ! git submodule update --init $FILTER_FLAGS gmqcc; then echo " -> Failed to initialize gmqcc submodule... aborting" exit 1 fi else - echo "=> Skipping gmqcc initialization... (running in CI)" + echo "=> Submodule gmqcc already initialized. (commit: ${submodule_gmqcc_status})" fi else - echo "=> Submodule gmqcc already initialized." + echo "=> Skipping gmqcc initialization... (commit: ${submodule_gmqcc_status})" fi if [[ ! -f "gmqcc/gmqcc" ]]; then @@ -98,18 +99,19 @@ if [[ ! -d "build/${CURRENT_BRANCH}" ]]; then fi fi -if [[ ! -f "xonotic/.git" ]]; then - if ((INIT_SUBMODULES == 1)); then - echo "=> Submodule xonotic not initialized..." +submodule_xonotic_status=$(git submodule status xonotic | awk '{ print $1 }') +if ((INIT_SUBMODULES == 1)); then + if [[ "${submodule_xonotic_status:0:1}" == "+" || "${submodule_xonotic_status:0:1}" == "-" ]]; then + echo "=> Submodule xonotic not initialized... (commit: ${submodule_xonotic_status})" if ! git submodule update --init $FILTER_FLAGS xonotic; then echo " -> Failed to initialize xonotic submodule... aborting" exit 1 fi else - echo "=> Skipping xonotic submodule initialization... (running in CI)" + echo "=> Submodule xonotic already initialized. (commit: ${submodule_xonotic_status})" fi else - echo "=> Submodule xonotic already initialized." + echo "=> Skipping xonotic submodule initialization... (commit: ${submodule_xonotic_status})" fi export XONOTIC=${XONOTIC:-1} From 52235f96173f06b54fc4ebca1cd714c9a4844260 Mon Sep 17 00:00:00 2001 From: Jian Date: Tue, 19 May 2026 01:02:18 +0500 Subject: [PATCH 10/11] ci(daily.yml): disable build artifact upload --- .github/workflows/daily.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 3d69783a6..0f01b9bcb 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -56,17 +56,17 @@ jobs: - name: Build Progs run: ./build.sh -a - - name: Generate Artifact Name - run: | - CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) - VERSION_TAG=$(git describe --tags --dirty="~" --always) - echo "CURRENT_BRANCH=${CURRENT_BRANCH}" >> "$GITHUB_ENV" - echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV" - echo "ARTIFACT_NAME=progs-${CURRENT_BRANCH}-${VERSION_TAG}" >> "$GITHUB_ENV" - - # Upload the files in build folder - - name: Upload Artifacts - uses: actions/upload-artifact@v7 - with: - name: ${{ env.ARTIFACT_NAME }} - path: build/${{ env.CURRENT_BRANCH }} + # - name: Generate Artifact Name + # run: | + # CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + # VERSION_TAG=$(git describe --tags --dirty="~" --always) + # echo "CURRENT_BRANCH=${CURRENT_BRANCH}" >> "$GITHUB_ENV" + # echo "VERSION_TAG=${VERSION_TAG}" >> "$GITHUB_ENV" + # echo "ARTIFACT_NAME=progs-${CURRENT_BRANCH}-${VERSION_TAG}" >> "$GITHUB_ENV" + # + # # Upload the files in build folder + # - name: Upload Artifacts + # uses: actions/upload-artifact@v7 + # with: + # name: ${{ env.ARTIFACT_NAME }} + # path: build/${{ env.CURRENT_BRANCH }} From daaee9bd88650e4f938c3540962879168281dbee Mon Sep 17 00:00:00 2001 From: Jian Date: Tue, 19 May 2026 12:44:22 +0500 Subject: [PATCH 11/11] build: add safety flags and directory normalization to build.sh --- build.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sh b/build.sh index 4b2a4b148..051b8856b 100755 --- a/build.sh +++ b/build.sh @@ -11,6 +11,8 @@ else INIT_SUBMODULES=1 fi +set -eu + usage() { echo "build.sh [-c|--clean] [-a|-all] [-nf|--no-filter] [-ni|--no-init] [-h|--help]" echo @@ -59,6 +61,8 @@ for i in "${arguments[@]}"; do esac done +cd "${0%/*}" + if ! CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"; then echo "=> Failed to parse git branch name... aborting" exit 1