commit
1162a0b008
|
|
@ -2,7 +2,7 @@ name: Build Projects
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, integration ]
|
||||
branches: [ main, integration, dev/**]
|
||||
pull_request:
|
||||
branches: [ main, integration ]
|
||||
|
||||
|
|
@ -14,8 +14,14 @@ jobs:
|
|||
target:
|
||||
- zig: x86_64-linux-gnu
|
||||
os: self-hosted-linux
|
||||
zipCommand: tar -cvfz
|
||||
zipName: package.tar.xz
|
||||
python: $PYTHON_NAME
|
||||
- zig: x86_64-windows
|
||||
os: self-hosted-windows
|
||||
zipCommand: zip
|
||||
zipName: package.zip
|
||||
python: %PYTHON_NAME%
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
|
|
@ -23,15 +29,12 @@ jobs:
|
|||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Build projects
|
||||
working-directory: ./projects
|
||||
run: zig build install -Dtarget=${{ matrix.target.zig }}
|
||||
- name: Get short commit SHA
|
||||
id: commit
|
||||
shell: bash
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build Debug
|
||||
working-directory: ./projects
|
||||
run: ${{ matrix.target.python }} ../tools/scripts/automation.py ${{ matrix.target.zig }} --deploy=${{ steps.commit.outputs.sha_short }} --branch=${{ github.head_ref || github.ref_name }}
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
if: success()
|
||||
with:
|
||||
name: build-artifacts-${{ matrix.target.zig }}
|
||||
path: |
|
||||
projects/zig-out/
|
||||
retention-days: 7
|
||||
|
|
|
|||
|
|
@ -401,7 +401,6 @@ pub const Program = struct {
|
|||
for (self.gameModules.items) |*m| {
|
||||
if (std.mem.eql(u8, m.name, module)) {
|
||||
m.enabled = enable;
|
||||
std.debug.print("enabling module {s} {any}\n", .{ module, enable });
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
import os
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
orig_dir = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
def getCommitHash():
|
||||
commit_hash = subprocess.check_output(
|
||||
['git', 'rev-parse', '--short', 'HEAD'],
|
||||
text=True
|
||||
).strip()
|
||||
print(commit_hash)
|
||||
|
||||
|
||||
dryRun = False
|
||||
|
||||
def run(cmd):
|
||||
global dryRun
|
||||
print(" ".join(cmd))
|
||||
if not dryRun:
|
||||
print(subprocess.check_output(cmd, shell=True).decode())
|
||||
|
||||
def buildAndPackage(branch, target, deploy):
|
||||
run(['zig', 'build', 'install', f'-Dtarget={target}', '--prefix', 'zig-out-debug'])
|
||||
run(['zig', 'build', 'install', f'-Dtarget={target}', '-Dstatic_build', '-Doptimize=ReleaseSafe', '--prefix', 'zig-out-release'])
|
||||
|
||||
if deploy is not None:
|
||||
def makePackage(target, branch, deploy, tag):
|
||||
host = '$BACKLOG_INFRA_DEPLOY_HOST'
|
||||
path = '$BACKLOG_INFRA_DEPLOY_PATH'
|
||||
|
||||
if os.name == 'nt':
|
||||
host = '%BACKLOG_INFRA_DEPLOY_HOST%'
|
||||
path = '%BACKLOG_INFRA_DEPLOY_PATH%'
|
||||
|
||||
run(['ssh', host, f'mkdir -p {path}/{branch}/{deploy}'])
|
||||
|
||||
if os.name == 'nt':
|
||||
packageFile = f'{deploy}-{tag}-{target}.zip'
|
||||
run(['zip', '-r', '-7', packageFile, f'zig-out-{tag}'])
|
||||
run(['scp', packageFile, f'{host}:{path}/{branch}/{deploy}/{packageFile}'])
|
||||
else:
|
||||
packageFile = f'{deploy}-{tag}.tar.xz'
|
||||
run(['tar', '-cvzf', packageFile, f'zig-out-{tag}'])
|
||||
run(['scp', packageFile, f'{host}:{path}/{branch}/{deploy}/{packageFile}'])
|
||||
|
||||
makePackage(target, branch, deploy, 'debug')
|
||||
makePackage(target, branch, deploy, 'release')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='run automation tasks for the repo')
|
||||
|
||||
# Positional argument (required)
|
||||
parser.add_argument('--deploy', nargs="?", help='Path to the input file')
|
||||
parser.add_argument('--branch', default="manual", help='branch name')
|
||||
parser.add_argument('--dry', action="store_true", help='dont run anything')
|
||||
|
||||
parser.add_argument('target', help='required')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
if args.dry:
|
||||
dryRun = True
|
||||
|
||||
buildAndPackage(args.branch, args.target, args.deploy)
|
||||
|
||||
Loading…
Reference in New Issue