Skip to content

ビルド失敗時に GitHub Actions がエラーで止まるようにする - #1334

Open
m-tmatma wants to merge 1 commit into
TeraTermProject:mainfrom
m-tmatma:fix/issue-1092-release-bat-errorlevel
Open

ビルド失敗時に GitHub Actions がエラーで止まるようにする#1334
m-tmatma wants to merge 1 commit into
TeraTermProject:mainfrom
m-tmatma:fix/issue-1092-release-bat-errorlevel

Conversation

@m-tmatma

@m-tmatma m-tmatma commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

概要

issue #1092 への対応。

installer/release.bat においてサブルーチンの呼び出し後にエラーチェックが行われていなかったため、ビルドが失敗しても GitHub Actions が正常終了してしまう問題を修正する。

変更内容

installer/release.bat

  • option 1〜6, 11〜14 の各 call の直後に if errorlevel 1 exit /b 1 を追加
    • サブルーチン(:download_libs, :build_libs, :build_teraterm, :build_teraterm_1, :build_teraterm_2)が失敗した場合にスクリプトを即座に終了するようにした
  • :build_libs サブルーチンにエラー伝播を追加
    • buildall.bat が失敗した場合に exit /b 1 を返すようにした(これまでは常に exit /b 0 を返していた)

installer/create_package.bat

  • 各コマンド(cmake -E copy_directory, %INNO_SETUP%, cmake -E tar, cmake -E sha256sum, cmake -E sha512sum)の直後にエラーチェックを追加
  • pushd Output ブロック内でエラーが発生した場合は popd してから exit /b 1 するようにした
  • 末尾に exit /b 0 を追加(これまでは最後のコマンドの終了コードがそのまま返っていた)

テスト結果

コミットを1つにsquashし、最新の main にリベースした状態(コミット 33a653af1)で再検証済み。各ケースをそれぞれ独立したブランチにcherry-pickして並行実行し、いずれも想定通りの箇所で停止することを確認した。

ケース 内容 結果 Actions
A build_common.batexit /b 1 を追加 → :build_teraterm_1 失敗 build_common job の Build step で停止 ✓ https://github.com/m-tmatma/teraterm/actions/runs/30899569406
B teraterm.cpp#error を追加 → コンパイルエラー build_arch job の Build step で停止 ✓ https://github.com/m-tmatma/teraterm/actions/runs/30899569303
C buildall.batexit /b 1 を追加 → :build_libs 失敗 build_arch job の Build step で停止 ✓ https://github.com/m-tmatma/teraterm/actions/runs/30899567031
D teraterm.iss#error を追加 → create_package.bat 失敗 build_arch job の Build step で停止 ✓ https://github.com/m-tmatma/teraterm/actions/runs/30899567665

検証に使用したブランチは確認後に削除済み。

m-tmatma added a commit to m-tmatma/teraterm that referenced this pull request Jun 5, 2026
m-tmatma added a commit to m-tmatma/teraterm that referenced this pull request Jun 5, 2026
@m-tmatma m-tmatma closed this Jun 5, 2026
@m-tmatma m-tmatma reopened this Jun 5, 2026
release.bat の option 1〜6, 11〜14 において、各 call の後に
if errorlevel 1 exit /b 1 を追加し、サブルーチンがエラーを返した
場合にスクリプトを即座に終了するようにした。

buildall.bat が失敗した場合に exit /b 1 で返すようにした。
これまでは常に exit /b 0 を返していたため、libs のビルド失敗が
上位スクリプトに伝播しなかった。

create_package.bat の各コマンドにもエラーチェックを追加した。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@m-tmatma
m-tmatma force-pushed the fix/issue-1092-release-bat-errorlevel branch from 670d00e to 33a653a Compare August 4, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant