6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub ActionsのワークフローでElixirのDialyzerをキャッシュして高速化する

Posted at

GitHub Actionsのワークフローで mix dialyzer を実行するとかなりの時間がかかる問題を,キャッシュすることで解決する方法を編み出しました.

前回の記事

基本的には _build/dev/dialyxir_erlang-*_elixir-*_deps-dev.plt* をキャッシュしてあげれば良いです.

そこで,シングルレポジトリの場合には,次のようにします(Ubuntu上だけでmix dialyzerを実行するとしています).

    - name: Restore dialyzer cache (Ubuntu)
      if: ${{ startsWith(runner.os, 'linux') }}
      uses: actions/cache@v3
      with:
        path: ${{ github.workspace }}/_build/dev/dialyxir_erlang-${{ matrix.otp-version }}_elixir-${{ matrix.elixir-version }}_deps-dev.plt*
        key: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-plt
        restore-keys: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-plt

ただし,マルチレポジトリ構成にしているときには,次のように,それぞれのサブプロジェクトで別々のIDになるようにキャッシュしてあげないとエラーになります.

    - name: Restore dialyzer cache (Ubuntu)
      if: ${{ startsWith(runner.os, 'linux') }}
      uses: actions/cache@v3
      with:
        path: ${{ github.workspace }}/${{ matrix.working-directory }}/_build/dev/dialyxir_erlang-${{ matrix.otp-version }}_elixir-${{ matrix.elixir-version }}_deps-dev.plt*
        key: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-repo-${{ matrix.working-directory }}-plt
        restore-keys: ${{ runner.os }}-${{ steps.system-info.outputs.release }}-Elixir-${{ matrix.elixir-version }}-OTP-${{ matrix.otp-version }}-repo-${{ matrix.working-directory }}-plt
6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?