Run everything with unbufferd stdout/err

Instead of flushing everywhere
This commit is contained in:
Christoph Reiter
2021-08-28 11:08:53 +02:00
parent 640d714345
commit 10764cd166
2 changed files with 7 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
run: |
python autobuild.py write-build-plan build_plan.json
python -u autobuild.py write-build-plan build_plan.json
$buildPlan = Get-Content build_plan.json -Raw
echo "::set-output name=build-plan::$buildPlan"
@@ -56,7 +56,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
run: |
python autobuild.py clean-assets
python -u autobuild.py clean-assets
- name: Show build queue
if: steps.check.outputs.build-plan != '[]'
@@ -64,7 +64,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN_READONLY: ${{ secrets.GITHUBTOKENREADONLY }}
run: |
python autobuild.py show
python -u autobuild.py show
build:
needs: schedule
@@ -145,4 +145,4 @@ jobs:
$BUILD_ROOT='C:\_'
$MSYS2_ROOT=(msys2 -c 'cygpath -w /')
Get-PSDrive -PSProvider FileSystem
python autobuild.py build ${{ matrix.build-args }} "$MSYS2_ROOT" "$BUILD_ROOT"
python -u autobuild.py build ${{ matrix.build-args }} "$MSYS2_ROOT" "$BUILD_ROOT"

View File

@@ -246,12 +246,10 @@ def fresh_git_repo(url: str, path: _PathLike) -> Generator:
@contextmanager
def gha_group(title: str) -> Generator:
print(f'\n::group::{title}')
stdout.flush()
try:
yield
finally:
print('::endgroup::')
stdout.flush()
class BuildError(Exception):
@@ -354,7 +352,7 @@ def upload_asset(release: GitRelease, path: _PathLike, replace: bool = False,
if can_try_upload_again():
upload()
print(f"Uploaded {asset_name} as {asset_label}", flush=True)
print(f"Uploaded {asset_name} as {asset_label}")
def get_python_path(msys2_root: _PathLike, msys2_path: _PathLike) -> Path:
@@ -400,7 +398,7 @@ def staging_dependencies(
with ThreadPoolExecutor(8) as executor:
for i, item in enumerate(executor.map(fetch_item, todo)):
asset_path, asset = item
print(f"[{i + 1}/{len(todo)}] {get_asset_filename(asset)}", flush=True)
print(f"[{i + 1}/{len(todo)}] {get_asset_filename(asset)}")
package_paths.append(asset_path)
repo_name = f"autobuild-{repo_type}"
@@ -1399,9 +1397,8 @@ def wait_for_api_limit_reset(
wait = min_sleep
elif wait > max_sleep:
wait = max_sleep
print(f"Too few API calls left, waiting for {wait} seconds", flush=True)
print(f"Too few API calls left, waiting for {wait} seconds")
time.sleep(wait)
stdout.flush()
def clean_environ(environ: Dict[str, str]) -> Dict[str, str]: