mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 03:09:53 +02:00
Fix CI
I forgot to adjust the pattern build.sh looked for in 49991b5915
so this commit started out as a simple fix that did that, but then I realized that the project call in meson.build had grown too complicated to be tractable with grep so I moved version number enforcement to prepare.py.
This commit is contained in:
24
.github/build.sh
vendored
24
.github/build.sh
vendored
@@ -415,30 +415,6 @@ meson_configure+=$'\t'-Dcpp_args=[$c_args]
|
||||
meson_configure+=$'\t'-Dc_link_args=[$c_link_args]
|
||||
meson_configure+=$'\t'-Dcpp_link_args=[$c_link_args]
|
||||
|
||||
meson_xyz=$(grep meson.build -we "project(" | cut -d "'" -f 6)
|
||||
if echo $meson_xyz | grep upstream; then
|
||||
meson_xyz=$(echo $meson_xyz | cut -d '-' -f 3)
|
||||
fi
|
||||
actual_display_version_major=$(echo $meson_xyz | cut -d '.' -f 1)
|
||||
actual_display_version_minor=$(echo $meson_xyz | cut -d '.' -f 2)
|
||||
actual_build_num=$( echo $meson_xyz | cut -d '.' -f 3)
|
||||
function verify_version_component() {
|
||||
declare -n expected_ptr="$1"
|
||||
declare -n actual_ptr="actual_$1"
|
||||
if [[ "$actual_ptr" != "$expected_ptr" ]]; then
|
||||
>&2 echo "meson option $key expected to be $expected, is instead $actual"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
if [[ $stable_or_beta == yes ]] && [[ $MOD_ID == 0 ]]; then
|
||||
verify_version_component display_version_major
|
||||
verify_version_component display_version_minor
|
||||
verify_version_component build_num
|
||||
fi
|
||||
if [[ $RELEASE_TYPE == snapshot ]] && [[ $MOD_ID == 0 ]]; then
|
||||
verify_version_component build_num
|
||||
fi
|
||||
|
||||
$meson_configure build
|
||||
cd build
|
||||
|
||||
|
38
.github/prepare.py
vendored
38
.github/prepare.py
vendored
@@ -20,26 +20,37 @@ match_tptlibsdev = re.fullmatch(r'refs/heads/tptlibsdev-(.*)', ref)
|
||||
match_alljobs = re.fullmatch(r'refs/heads/(.*)-alljobs', ref)
|
||||
do_release = False
|
||||
do_priority = 10
|
||||
display_version_major = None
|
||||
display_version_minor = None
|
||||
build_num = None
|
||||
if event_name == 'pull_request':
|
||||
do_priority = 0
|
||||
if match_stable:
|
||||
display_version_major = match_stable.group(1)
|
||||
display_version_minor = match_stable.group(2)
|
||||
build_num = match_stable.group(3)
|
||||
release_type = 'stable'
|
||||
release_name = 'v%s.%s.%s' % (match_stable.group(1), match_stable.group(2), match_stable.group(3))
|
||||
release_name = f'v{display_version_major}.{display_version_minor}.{build_num}'
|
||||
do_release = True
|
||||
do_priority = -5
|
||||
elif match_beta:
|
||||
display_version_major = match_beta.group(1)
|
||||
display_version_minor = match_beta.group(2)
|
||||
build_num = match_beta.group(3)
|
||||
release_type = 'beta'
|
||||
release_name = 'v%s.%s.%sb' % (match_beta.group(1), match_beta.group(2), match_beta.group(3))
|
||||
release_name = f'v{display_version_major}.{display_version_minor}.{build_num}b'
|
||||
do_release = True
|
||||
do_priority = -5
|
||||
elif match_snapshot:
|
||||
build_num = match_snapshot.group(1)
|
||||
release_type = 'snapshot'
|
||||
release_name = 'snapshot-%s' % match_snapshot.group(1)
|
||||
release_name = f'snapshot-{build_num}'
|
||||
do_release = True
|
||||
do_priority = -5
|
||||
elif match_tptlibsdev:
|
||||
branch = match_tptlibsdev.group(1)
|
||||
release_type = 'tptlibsdev'
|
||||
release_name = 'tptlibsdev-%s' % match_tptlibsdev.group(1)
|
||||
release_name = f'tptlibsdev-{branch}'
|
||||
do_priority = 0
|
||||
else:
|
||||
release_type = 'dev'
|
||||
@@ -56,13 +67,28 @@ build_options = {}
|
||||
with open('build-prepare/meson-info/intro-buildoptions.json') as f:
|
||||
for option in json.loads(f.read()):
|
||||
build_options[option['name']] = option['value']
|
||||
with open('build-prepare/meson-info/intro-projectinfo.json') as f:
|
||||
display_version = json.loads(f.read())['version']
|
||||
display_version_split = display_version.split('-')
|
||||
if len(display_version_split) == 3:
|
||||
display_version = display_version_split[0]
|
||||
display_version = display_version.split('.')
|
||||
|
||||
if int(build_options['mod_id']) == 0 and os.path.exists('.github/mod_id.txt'):
|
||||
with open('.github/mod_id.txt') as f:
|
||||
build_options['mod_id'] = f.read()
|
||||
mod_id = int(build_options['mod_id'])
|
||||
|
||||
if mod_id == 0:
|
||||
if display_version_major:
|
||||
assert(display_version_major == display_version[0])
|
||||
if display_version_minor:
|
||||
assert(display_version_minor == display_version[1])
|
||||
if build_num:
|
||||
assert(build_num == display_version[2])
|
||||
|
||||
steam_builds = False
|
||||
if int(build_options['mod_id']) == 0:
|
||||
if mod_id == 0:
|
||||
if release_type == 'stable':
|
||||
steam_builds = True
|
||||
elif release_type == 'beta':
|
||||
@@ -83,7 +109,7 @@ if int(build_options['mod_id']) == 0:
|
||||
build_options['app_exe' ] += 'dev'
|
||||
build_options['app_id' ] += 'dev'
|
||||
|
||||
set_output('mod_id' , build_options['mod_id' ])
|
||||
set_output('mod_id' , str(mod_id))
|
||||
set_output('app_name' , build_options['app_name' ])
|
||||
set_output('app_comment', build_options['app_comment'])
|
||||
set_output('app_exe' , build_options['app_exe' ])
|
||||
|
Reference in New Issue
Block a user