action.yml raw

   1  name: "Install Valgrind"
   2  description: "Install Homebrew's Valgrind package and cache it."
   3  runs:
   4    using: "composite"
   5    steps:
   6      - run: |
   7          brew tap LouisBrunner/valgrind
   8          brew fetch --HEAD LouisBrunner/valgrind/valgrind
   9          echo "CI_HOMEBREW_CELLAR_VALGRIND=$(brew --cellar valgrind)" >> "$GITHUB_ENV"
  10        shell: bash
  11  
  12      - run: |
  13          sw_vers > valgrind_fingerprint
  14          brew --version >> valgrind_fingerprint
  15          git -C "$(brew --cache)/valgrind--git" rev-parse HEAD >> valgrind_fingerprint
  16          cat valgrind_fingerprint
  17        shell: bash
  18  
  19      - uses: actions/cache@v5
  20        id: cache
  21        with:
  22          path: ${{ env.CI_HOMEBREW_CELLAR_VALGRIND }}
  23          key: ${{ github.job }}-valgrind-${{ hashFiles('valgrind_fingerprint') }}
  24  
  25      - if: steps.cache.outputs.cache-hit != 'true'
  26        run: |
  27          brew install --HEAD LouisBrunner/valgrind/valgrind
  28        shell: bash
  29  
  30      - if: steps.cache.outputs.cache-hit == 'true'
  31        run: |
  32          brew link valgrind
  33        shell: bash
  34