Skip to content

Commit 4a3a3fb

Browse files
CI: Use BF2/IRA multibuild instead of separate builds
Nothing CI ever works first try.
1 parent 9087970 commit 4a3a3fb

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

.github/workflows/ci.yml

+7-13
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,12 @@ jobs:
3737
# These run in parallel.
3838
matrix:
3939
build:
40-
- name: debug-bf2
41-
preset: debug-bf2
42-
codename: bf2
43-
- name: release-bf2
44-
preset: release-bf2
45-
codename: bf2
46-
- name: debug-ira
47-
preset: debug-ira
48-
codename: ira
49-
- name: release-ira
50-
preset: release-ira
51-
codename: ira
40+
- name: debug-bf2_ira
41+
preset: debug-bf2_ira
42+
codename: bf2;ira
43+
- name: release-bf2_ira
44+
preset: release-bf2_ira
45+
codename: bf2;ira
5246
- name: debug-bfsw
5347
preset: debug-bfsw
5448
codename: bfsw
@@ -95,7 +89,7 @@ jobs:
9589
id: package
9690
run: |
9791
cd build-${{matrix.build.preset}}
98-
python3 ../scripts/makePackage.py --json ../npdm/${{matrix.build.codename}}.json
92+
python3 ../scripts/makePackage.py --codename "${{matrix.build.codename}}"
9993
cd pkg
10094
zip -9r ../xenomods-${{matrix.build.preset}}.zip .
10195

scripts/makePackage.py

+19-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from shutil import copyfile
1111
from pathlib import Path
1212

13-
1413
# bail (printing a message beforehand) and exit
1514
def Bail(message):
1615
print(f'Error: {message}')
@@ -21,29 +20,33 @@ def Bail(message):
2120
parser = argparse.ArgumentParser(description='Script for packaging.')
2221

2322
# stuff we gather from
24-
parser.add_argument('--json', dest='path', required=True, type=str, help='path to npdmtool JSON file to gather information from')
23+
parser.add_argument('--codename', dest='codename', required=True, type=str, help='codename(s) of the build type')
2524
parser.add_argument('--subsdk', dest='subsdk_name', required=False, type=str, default="subsdk9", help='subsdk name (default \'subsdk9\')')
2625

2726
args = parser.parse_args()
2827

29-
if not os.path.exists(args.path):
30-
Bail("JSON file doesn't exist")
28+
for codename in args.codename.split(';'):
29+
print(f"Codename: {codename}")
30+
npdmPath = Path(os.getcwd()) / f"../npdm/{codename}.json"
31+
32+
if not os.path.exists(npdmPath):
33+
Bail("NPDM JSON file doesn't exist")
3134

32-
with open(args.path, mode='r') as file:
33-
# additionaly if it doesn't have json data, it probably shouldn't be used either, bail there too.
34-
try:
35-
jsondata = json.loads(file.read())
36-
except:
37-
Bail("JSON file contains invalid data")
35+
with open(npdmPath, mode='r') as file:
36+
# additionaly if it doesn't have json data, it probably shouldn't be used either, bail there too.
37+
try:
38+
jsondata = json.loads(file.read())
39+
except:
40+
Bail("NPDM JSON file contains invalid data")
3841

39-
programid = jsondata['program_id'][2:].upper()
42+
programid = jsondata['program_id'][2:].upper()
4043

41-
print(f"Gathered program id is {programid}")
44+
print(f"Gathered program id is {programid}")
4245

43-
amspath = Path(os.getcwd()) / 'pkg' / 'atmosphere' / 'contents' / programid / 'exefs'
44-
amspath.mkdir(parents=True)
46+
amspath = Path(os.getcwd()) / 'pkg' / 'atmosphere' / 'contents' / programid / 'exefs'
47+
amspath.mkdir(parents=True)
4548

46-
copyfile('xenomods.nso', str(amspath / args.subsdk_name))
47-
copyfile('main.npdm', str(amspath / 'main.npdm'))
49+
copyfile('xenomods.nso', str(amspath / args.subsdk_name))
50+
copyfile(f'{codename}.npdm', str(amspath / 'main.npdm'))
4851

4952
print('Generated package data')

0 commit comments

Comments
 (0)