Mozilla-Actions / sccache-action

sccache github action
Apache License 2.0
114 stars 22 forks source link

when used with a docker call how do i get the stats out to the action? #104

Open altendky opened 6 months ago

altendky commented 6 months ago

Thanks for this action, it has sped up my builds by about 6x to get down to 10 minutes which is wonderful. I am setting up builds using QEMU for RISCV in Docker. I was able to propagate the environment variables and the cache directory into the container but I am not sure what to propagate back out so that the post run step is able to show the statistics about cache hits etc.

https://github.com/Chia-Network/build-wheels/actions/runs/8157450783/job/22297172636?pr=30#step:21:1

Post job cleanup.
/opt/hostedtoolcache/sccache/0.7.7/x64/sccache --show-stats
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average compiler                  0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/home/runner/.cache/sccache"
Use direct/preprocessor mode?   yes
Version (client)                0.[7](https://github.com/Chia-Network/build-wheels/actions/runs/8157450783/job/22297172636?pr=30#step:21:7).7
Max cache size                       [10](https://github.com/Chia-Network/build-wheels/actions/runs/8157450783/job/22297172636?pr=30#step:21:10) GiB

https://github.com/Chia-Network/build-wheels/actions/runs/8157450783/workflow?pr=30#L100

      - name: Run sccache-cache
        uses: mozilla-actions/sccache-action@v0.0.3

      - name: Set up QEMU on x86_64
        if: matrix.arch.matrix == 'risc'
        id: qemu
        uses: docker/setup-qemu-action@v3
        with:
          platforms: riscv64

      - name: Build wheel
        run: |
          docker run --rm --platform linux/riscv64 \
          -v ${{ github.workspace }}:/ws \
          -v "${SCCACHE_PATH}":/sccache \
          -e SCCACHE_PATH="/sccache" \
          -e SCCACHE_GHA_ENABLED=true \
          -e ACTIONS_CACHE_URL="${ACTIONS_CACHE_URL}" \
          -e ACTIONS_RUNTIME_TOKEN="${ACTIONS_RUNTIME_TOKEN}" \
          -e RUSTC_WRAPPER=sccache \
          --workdir=/ws \
          chianetwork/ubuntu-22.04-risc-builder:latest \
          bash -exc '\
          pyenv global ${{ matrix.python.matrix }} && \
          python3 -m venv venv && \
          source ./venv/bin/activate && \
          pip install --upgrade pip && \
          pip wheel -w dist ./source \
altendky commented 6 months ago

I'll leave this open since someone else may understand better and be able to confidently say this "can't be fixed" or whatever.

Looking around, it appears that the stats come from a running sccache server process which would have existed only inside the ~docket~ docker container. I'll dump the stats manually within the docker container for now so I can see them.