Skip to content

Instantly share code, notes, and snippets.

@Hamayama
Last active June 9, 2021 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hamayama/3cc0e9c0c5283e7fc422360c6e5bd372 to your computer and use it in GitHub Desktop.
Save Hamayama/3cc0e9c0c5283e7fc422360c6e5bd372 to your computer and use it in GitHub Desktop.
GitHub Actions のメモ

GitHub Actions のメモ

Workflow の failure 事例

  1. (解決済み)
    https://github.com/shirok/Gauche/runs/462013061?check_suite_focus=true
    Build / build-windows (x86_64)
    Run Gauche once 内で、インストールした gosh.exe が見つからないというエラー (2020-2-22) 。
    → C ドライブへの書き込みが不安定なため、D ドライブにインストールするように変更した (#605)
    → 再度発生 (2020-2-26)
    https://github.com/Hamayama/Gauche/runs/469806890?check_suite_focus=true
    → 「msiexec が非同期に実行されるため」という情報があり、対応した (#611)
    ( https://devblogs.microsoft.com/setup/waiting-for-msiexec-exe-to-finish/ )
    ( 補足:PowerShell 上では、start は Start-Process の alias になっており、うまく動作しなかった。
    このため、cmd.exe /c start /wait msiexec ... のようにした)
    ( 補足:MSYS2 の bash 上では、msiexec を同期実行させる方法は見つけることができなかった。
    まず、MSYS2 の bash 上では、cmd.exe /c が正常に動作しなかった (入力待ちになってしまう) 。
    また、MSYS2 の bash 上では、cmd と start は、シェルスクリプトになっており、いずれもうまく動作しなかった

    → MSYS2 の bash 上でも、msiexec を同期実行させることができた (#630) 。
    以下のように、cmd.exe の /c オプションを //c にしたら動作した。

    bash -lc @'
      cmd.exe //c \"start /wait msiexec ... \"
    '@
    

    ( /c は、MSYS2 では C ドライブの意味になるため、/ でエスケープが必要とのこと。
    また、ダブルクォートの位置と \ でのエスケープにも注意が必要)
    → その後、公式の msys2/setup-msys2 という action の shell 機能を使うようにした。
    ( shell: msys2 {0} と書くことで、run のシェルが MSYS2 の bash になる)
    (関連プルリクエスト #705)
    これによって、上記の bash -lc @'~'@ という記述は不要になった。
    (ダブルクォートのエスケープも不要になった))
    ( 補足:現状、PowerShell 上であっても bash 上であっても、msiexec のエラーを検出できない。
    (戻り値が、常に 0 (成功) になるもよう))

  2. (対応なし)
    https://github.com/Hamayama/Gauche/runs/476346010?check_suite_focus=true
    Build / build-windows (x86_64)
    1. と同じエラーだが、その前の Install Gauche 内で、
    インストーラの取得 (curl) に失敗していた (2020-2-29) 。
    これはネットワークの状況によるため、仕方がない。
    ( 補足:現状、msiexec のエラーは検出不可 )

  3. (未解決!!!)
    https://github.com/Hamayama/Gauche/runs/463790547?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/526000689?check_suite_focus=true
    Build / build-windows (i686)
    テストが 6 時間経過して停止した (2020-2-24)(2020-3-23) 。
    GC の threadleaktest が終了しなかったもよう。
    → GC の以下の件かもしれない
    ivmai/bdwgc#291
    ( leaktest and threadleaktest hangs rarely on Windows #291 )
    → まずは、タイムアウトを 60 分に設定した (#606)
    → 再度発生 (2020-2-26)
    https://github.com/Hamayama/Gauche/runs/468693178?check_suite_focus=true
    (タイムアウトの 60 分設定はうまく機能した)

  4. (未解決!!!)
    https://github.com/Hamayama/Gauche/runs/474902517?check_suite_focus=true
    https://github.com/Hamayama/Gauche/runs/477887512?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/504549584?check_suite_focus=true
    Build / build-windows (x86_64)
    Build / build-windows (i686)
    テストでタイムアウト (60 分) が発生 (2020-2-28)(2020-3-1)(2020-3-13) 。
    GC の leaktest が終了しなかったもよう。
    3. の類似ケースと思われる。

  5. (解決済み)
    https://github.com/shirok/Gauche/runs/464416022?check_suite_focus=true
    Build / build-linux
    タイムアウトを 60 分に設定したが、10 分程度でタイムアウトして終了してしまった (2020-2-24) 。
    → 他のタイムアウト設定が干渉したのかもしれない。
    別の job 内で設定していた run: の timeout-minutes を消し、
    job の timeout-minutes だけを設定するようにした (#606) 。

  6. (未解決!!!)
    https://github.com/Hamayama/Gauche/runs/462672534?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/465514933?check_suite_focus=true
    Build / build-linux
    Build / build-osx
    テストで以下のエラーが発生 (2020-2-23)(2020-2-25) 。
    存在するディレクトリを作成しようとした?

    *** SYSTEM-ERROR: mkdir failed on gauche/priv: File exists
    Makefile:277: recipe for target 'gauche/priv/builtin-syms.h' failed
    Stack Trace:
    _______________________________________
      0  (make-directory* "gauche/priv/")
            at "/home/runner/work/Gauche/Gauche/src/builtin-syms.scm":54
    make[1]: *** [gauche/priv/builtin-syms.h] Error 70
    make[1]: *** Waiting for unfinished jobs....
    make[1]: Leaving directory '/home/runner/work/Gauche/Gauche-tmp-self-host-test/stage1/src'
    make: *** [all] Error 1
    

    → これは、make -j の並列実行の関係かもしれない
    → 以下のコミットで対策されたもよう (2020-3-22)
    https://github.com/shirok/Gauche/commit/010517bfb12e61b719f4d981924dcd6e835a8d31
    → 再度発生 (2020-4-2)(2020-4-3)(2020-4-4)(2020-4-6)
    https://github.com/shirok/Gauche/runs/553797458?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/556670770?check_suite_focus=true https://github.com/shirok/Gauche/runs/559748564?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/562991609?check_suite_focus=true
    Build / build-osx

  7. (未解決!!!)
    https://github.com/shirok/Gauche/runs/465722131?check_suite_focus=true
    https://github.com/Hamayama/Gauche/runs/467701426?check_suite_focus=true
    Build / build-osx
    テストでタイムアウト (60 分) が発生 (2020-2-25)(2020-2-26) 。
    system のテストが 終了しなかったもよう (通常は、1 秒程度で終了するはず) 。
    → 再度発生。ログが取れた (2020-3-2)
    https://github.com/Hamayama/Gauche/actions/runs/50864253
    system の fork & sigint のテストのところで止まっていた。

  8. (未解決!!!)
    https://github.com/shirok/Gauche/runs/465722152?check_suite_focus=true
    Build / build-windows (i686)
    テストでタイムアウト (60 分) が発生 (2020-2-25) 。
    control のテストが 終了しなかったもよう (通常は、1 秒程度で終了するはず) 。
    → テストのログを取得するようにした (#608 #611)
    → テストのログを取得 (2020-2-28)(2020-3-15)
    https://github.com/Hamayama/Gauche/actions/runs/46201554
    https://github.com/shirok/Gauche/actions/runs/55983000
    control の thread pool termination のテストのところで止まっていた。
    → Windows 64bit (x86_64) でも発生 (2020-10-6)
    https://github.com/shirok/Gauche/runs/1214810436?check_suite_focus=true
    Build / build-windows (x86_64)

  9. (未解決!!!)
    https://github.com/Hamayama/Gauche/runs/471934928?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/478508025?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/526125384?check_suite_focus=true
    Build / build-windows (x86_64)
    Build / build-windows (i686)
    テストで 1 件 エラーが発生 (2020-2-27)(2020-3-2)(2020-3-23) 。
    control の wait-all timeout のテストで失敗していた。
    → Linux でも発生 (2020-4-3)
    https://github.com/shirok/Gauche/runs/556798497?check_suite_focus=true
    Build / build-linux

  10. (解決済み)
    https://github.com/shirok/Gauche/actions/runs/50384881
    Build / build-windows (x86_64)
    Build / build-windows (i686)
    MSYS2 のダウンロードのサイト (http://repo.msys2.org) がダウンしていた (2020-3-6) 。
    → 公式のミラーサイトを 1 個だけ追加した (#622)
    (pacman コマンドの方は、自動でミラーサイトを使うもよう)
    → その後、リトライを考慮して、タイムアウトを 90 分に延長した (#625)
    → その後、MSYS2/MinGW-w64 環境のインストールについては、
    公式の msys2/setup-msys2 という action を使うようにした。
    (関連プルリクエスト #699 #702 #704 #705)

  11. (解決済み)
    https://github.com/Hamayama/Gauche/runs/488816317?check_suite_focus=true https://github.com/shirok/Gauche/runs/488783601?check_suite_focus=true
    Build / build-windows (x86_64)
    Build / build-windows (i686)
    MSYS2 の pacman コマンドが core dump した (2020-3-6) 。
    → MSYS2 のダウンロードで、stable (2019-5-24) ではなく latest を優先するようにした。
    また、ダウンロード後は、pacman -Syyuu で最新版にアップデートするようにした (#625)
    → その後、MSYS2/MinGW-w64 環境のインストールについては、
    公式の msys2/setup-msys2 という action を使うようにした。
    (関連プルリクエスト #699 #702 #704 #705)

  12. (解決済み)
    https://github.com/Hamayama/Gauche/runs/489495466?check_suite_focus=true
    Build / build-windows (x86_64)
    srfi-144 のテストで 2 件 エラーが発生 (2020-3-6) 。

    test (fl+* fl-greatest fl-greatest neginf): expects -inf.0 => got +nan.0
    test (fl+* fl-greatest (fl- fl-greatest) posinf): expects +inf.0 => got +nan.0
    

    → MinGW-w64 の gcc のバージョンが 8.3.0 から 9.2.0 に上がったため?
    → 該当のテストをスキップするようにした (#625)
    → MinGW-w64 の C のランタイムの問題らしい
    shirok/Gauche#625 (comment)
    → その後、以下のプルリクエストを作成 (2020-3-15)
    shirok/Gauche#631

  13. (対応なし)
    https://github.com/shirok/Gauche/actions/runs/59838534
    Build / build-linux
    Build / build-osx
    Build / build-windows (x86_64)
    Build / build-windows (i686)
    全 job で、ファイルアクセスのエラーが発生? (2020-3-21)
    これは、ハードウェア側の不具合だと思う。

  14. (未解決!!!)
    https://github.com/shirok/Gauche/runs/525043153?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/528429316?check_suite_focus=true
    Build / build-windows (x86_64)
    Build / build-windows (i686)
    テストでタイムアウト (90 分) が発生 (2020-3-22)(2020-3-24) 。
    ext/threads のテストが 終了しなかったもよう (通常は、5 秒程度で終了するはず) 。
    → テストのログを取得するようにした (#652)

  15. (未解決!!!)
    https://github.com/shirok/Gauche/runs/2360120398?check_suite_focus=true
    Build / build-windows (x86_64)
    regexp のテストで、以下のエラーが発生 (2021-4-16) 。

    "regexp.c", line 2246 (is_word_boundary):
    Assertion failed: prevp != NULL
    

    → テストのログによると、
    test/regexp.scm の '(: bow ($ (* "ab")) eow "c") のテストのところで発生していた。

  16. (未解決!!!)
    https://github.com/shirok/Gauche/runs/2422052059?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/2599664287?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/2644947044?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/2754185355?check_suite_focus=true
    https://github.com/shirok/Gauche/runs/2779987234?check_suite_focus=true
    Build / build-osx
    control のテストで、以下のエラーが発生。
    (2021-4-24)(2021-5-17)(2021-5-22)(2021-6-6)(2021-6-9)

    test reschedule: expects (2 1) => got (1)
    

その他 参考情報 ノウハウ等

  1. YAML ファイルの記述を間違えると、すぐに job が完了したり、
    1行目にエラーがあるというようなメッセージが出たりする。
    (実際には、YAML ファイルのどこかに間違いがある。。。)

  2. いろいろと試していたら、job が動きっぱなしになり Cancel もできなくなったことがあった。
    GitHub をログアウトして、しばらくしてからログインし直したら、Cancel できた。

  3. 現状、実行結果を削除する機能が、どこにも存在しない。。。
    ( https://github.community/t5/GitHub-Actions/Delete-old-workflow-results/td-p/30589 )
    → 追加されたもよう (2020-8-18 確認)
    ( https://github.blog/changelog/2020-07-07-github-actions-ability-to-delete-workflow-runs/ )

  4. 複数の run: の間で環境変数の変更を共有するには、独特の書き方が必要。
    ( https://github.community/t5/GitHub-Actions/Support-saving-environment-variables-between-steps/td-p/31373
    https://help.github.com/en/actions/reference/development-tools-for-github-actions#set-an-environment-variable-set-env )
    → その後、::set-env コマンドが deprecated になって、
    環境変数ファイル ($GITHUB_ENV) に "NAME=VALUE" という形式で文字列を追記すると、
    環境変数が更新されるようになった。(セキュリティ関連の変更?) (2020-10-11)
    ( https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ )

  5. Linux と OSX では、run: のシェルはデフォルトで bash になる。
    ( https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell )

    Windows では、run: のシェルはデフォルトで PowerShell になる。
    これは、かなり記述が難しい。例えば、以下。
    (a) dir は Get-ChildItem の alias なので、注意が必要 (cmd.exe とはオプションが異なる)
    (b) cp は Copy-Item の alias なので、注意が必要
    (c) mkdir は独自コマンドなので、注意が必要
    (d) start は Start-Process の alias なので、注意が必要 (これは、del alias:start でも消せない)
    (e) curl は環境によっては Invoke-WebRequest の alias になる。しかし、GitHub Actions 内では alias にはならないもよう
    (f) 環境変数の参照は、$VAR ではなく $env:VAR と書く
    (g) パイプやリダイレクトがうまく動かない ( bash -c で回避したりしている。何かルールがありそうだが。。。)

    Windows で、shell: cmd を書くと、シェルが cmd.exe になる。しかし、これもいろいろと難しい。
    Windows で、shell: bash を書くと、シェルが Git for Windows の bash になる (MSYS2 の bash にはならないので要注意) 。

  6. MSYS2/MinGW-w64 環境については、自分で記述してインストールしないといけない。
    C ドライブのルートには うまくインストールできなかった (固まったりした) ため、
    D ドライブにインストールするようにした。

    MSYS2 の環境を、デフォルトで用意しようという試みもあるもよう (作業中?) 。
    actions/runner-images#342
    → これは入った (2020/6月頃)

    その後、一時、GitHub Actions の Windows の image にデフォルトで入った MSYS2 を使うようにした。
    しかし、update に時間がかかるようになったため、結局、毎回インストールする方式に戻した。
    また、公式の msys2/setup-msys2 という action を使うようにした。
    (関連プルリクエスト #699 #702 #704 #705)

  7. Windows では、チェックアウト ( - uses: actions/checkout@v2 ) の前に
    - run: git config --global core.autocrlf false を記述しないと、
    改行コードの自動変換によりエラーが発生した。

  8. Windows の run: のところで、bash -lc @'~'@ としている中では、
    ダブルクォートは、バックスラッシュでエスケープして \" とする必要があるもよう。
    そうしないと、bash の実行が、途中で止まってしまうことがあった。
    (このとき、エラーにはならず、後続の run: がそのまま実行されたので、デバッグに苦労した)
    ( 本来、PowerShell の仕様では、@'~'@ の中は エスケープが不要らしい。
    しかし、bash の実行と組み合わせると、何か状況が変化するもよう)
    ( 補足:@'~'@ の中のシングルクォート ' については、エスケープなしで OK であった)

    その後、公式の msys2/setup-msys2 という action の shell 機能を使うようにした。
    ( shell: msys2 {0} と書くことで、run のシェルが MSYS2 の bash になる)
    (関連プルリクエスト #705)
    これによって、上記の bash -lc @'~'@ という記述は不要になった。
    (ダブルクォートのエスケープも不要になった)

  9. GitHub Actions には、MS の Azure の技術が使われているらしい。
    Azure の VM の D ドライブは、temporary drive になっていて、
    内容は保存されないが高速らしい。
    https://docs.microsoft.com/en-us/archive/blogs/mast/understanding-the-temporary-drive-on-windows-azure-virtual-machines

    ドライブの空き容量は、C が 130 GB で、D が 12 GB になっていた。
    ( fsutil volume diskfree c: で確認 )

    現状、チェックアウトしたソースは、D ドライブに展開されている。

    なぜ、C ドライブの書き込みが不安定なのかは、よく分からない。
    (複数の run: 間の 同期がうまくとれていなくて、
    書き込みが完了する前に 次の run: が実行されたりしているのかも。。。)

  10. GitHub の稼働状況は、https://www.githubstatus.com/ で確認できる。
    障害が発生していると、job が動きっぱなしになったことがあった。
    (しばらくしてから、手動で Cancel できた) (2020-2-27)
    https://github.com/Hamayama/Gauche/actions/runs/46176186
    https://github.com/Hamayama/Gauche/actions/runs/46177440

(2020-2-25)(2020-2-26)(2020-2-27)(2020-2-28)(2020-2-29)
(2020-3-1)(2020-3-2)(2020-3-7)(2020-3-10)(2020-3-14)
(2020-3-15)(2020-3-22)(2020-3-28)(2020-3-29)(2020-4-2)
(2020-4-7)(2020-8-18)(2020-10-9)(2020-10-11)(2021-4-18)
(2021-5-23)(2021-6-9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment