Skip to content

Commit

Permalink
GitHub Actions pboProject (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dahlgren committed Oct 15, 2021
1 parent 5fb693d commit 929649b
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 14 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/pboproject.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: pboProject

on:
push:
branches:
- master
pull_request_target:

jobs:
pboproject:
runs-on: windows-2019
steps:
- name: Install Arma 3 Tools
uses: arma-actions/arma3-tools@master
with:
toolsUrl: ${{ secrets.ARMA3_TOOLS_URL }}
- name: Install Mikero Tools
uses: arma-actions/mikero-tools@2021-04-10
- name: Download game data
run: |
Invoke-WebRequest "$env:ARMA3_DATA_URL" -OutFile arma3.zip
$files = @("arma3.zip")
ForEach ($file in $files) {
Extract-7Zip -Path $file -DestinationPath .
Remove-Item $file
}
env:
ARMA3_DATA_URL: ${{ secrets.ARMA3_DATA_URL }}
- name: Checkout CBA A3
uses: actions/checkout@v2
with:
path: x\cba
persist-credentials: false
- name: Checkout pull request
uses: actions/checkout@v2
if: ${{ github.event_name == 'pull_request_target' }}
with:
path: pullrequest
ref: 'refs/pull/${{ github.event.number }}/merge'
- name: Replace addons with pull request addons
if: ${{ github.event_name == 'pull_request_target' }}
run: |
rm -r x\cba\addons\
rm -r x\cba\optionals\
xcopy /e /h /q pullrequest\addons x\cba\addons\
xcopy /e /h /q pullrequest\optionals x\cba\optionals\
- name: Setup build environment
run: |
subst P: .
pboproject -P
- name: Build
run: py P:\x\cba\tools\make.py ci
env:
PYTHONUNBUFFERED: 1
- name: Archive logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: logs
path: temp/*.log
- name: Archive @cba_a3
uses: actions/upload-artifact@v2
with:
name: '@cba_a3-${{ github.sha }}'
path: x\cba\release\@cba_a3
40 changes: 26 additions & 14 deletions tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,17 @@ def find_bi_tools(work_drive):
else:
raise Exception("BadTools","Arma 3 Tools are not installed correctly or the P: drive needs to be created.")

def mikero_windows_registry(path, access=winreg.KEY_READ):
try:
return winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Mikero\{}".format(path), access=access)
except FileNotFoundError:
try:
return winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Mikero\{}".format(path), access=access)
except FileNotFoundError:
try:
return winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Wow6432Node\Mikero\{}".format(path), access=access)
except FileNotFoundError:
return winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Wow6432Node\Mikero\{}".format(path), access=access)

def find_depbo_tools():
"""Use registry entries to find DePBO-based tools."""
Expand All @@ -236,20 +247,8 @@ def find_depbo_tools():

for tool in requiredToolPaths:
try:
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
try:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
try:
k = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Wow6432Node\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
k = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"Software\Wow6432Node\Mikero\{}".format(tool))
path = winreg.QueryValueEx(k, "exe")[0]
k = mikero_windows_registry(tool)
path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError:
print_error("Could not find {}".format(tool))
failed = True
Expand All @@ -265,6 +264,17 @@ def find_depbo_tools():

return requiredToolPaths

def pboproject_settings():
"""Use registry entries to configure needed pboproject settings."""
value_exclude = "thumbs.db,*.txt,*.h,*.dep,*.cpp,*.bak,*.png,*.log,*.pew,source,*.tga"

try:
k = mikero_windows_registry(r"pboProject\Settings", access=winreg.KEY_SET_VALUE)
winreg.SetValueEx(k, "m_exclude", 0, winreg.REG_SZ, value_exclude)
winreg.SetValueEx(k, "m_exclude2", 0, winreg.REG_SZ, value_exclude)
except:
raise Exception("BadDePBO", "pboProject not installed correctly, make sure to run it at least once")


def color(color):
"""Set the color. Works on Win32 and normal terminals."""
Expand Down Expand Up @@ -1029,6 +1039,8 @@ def main(argv):
pboproject = depbo_tools["pboProject"]
rapifyTool = depbo_tools["rapify"]
makepboTool = depbo_tools["MakePbo"]

pboproject_settings()
except:
raise
print_error("Could not find dePBO tools. Download the needed tools from: https://dev.withsix.com/projects/mikero-pbodll/files")
Expand Down

0 comments on commit 929649b

Please sign in to comment.