diff --git a/.github/README.md b/.github/README.md index 4e05fcda332f..3ee5aad61228 100644 --- a/.github/README.md +++ b/.github/README.md @@ -70,4 +70,6 @@ Each content is built once. A check of a change is keyed by the kernel's sources change to the CI alone builds nothing new), so the layers' pull requests and the push after a merge find the build of the pull request that brought the change and take seconds; only a tag builds again, twice and keyed by its commit, which `uname -v` and the release name. One change costs one build in its -pull request and two in its headset's tag. +pull request and two in its headset's tag. A check build compiles through ccache, whose objects the cache of its +branch, its base or the default branch carries over, so it recompiles only what the change touches; a tag's two +builds start clean (a change to the kernel's configuration touches every file, so it compiles everything anyway). diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85adc0506f30..c12eb66fffdb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -207,13 +207,32 @@ jobs: run: | uv sync --locked uv run python -m overpressure container pull + # A check build compiles through ccache (build-tree.sh's CCACHE_DIR), whose objects carry over from the + # newest cache this run may read: its own branch's, its base's, the default branch's. A tag's two + # builds start clean: they are the test that the kernel is reproducible. + - name: The compiled objects of earlier builds + if: steps.key.outputs.name && steps.earlier.outputs.found != 'true' && github.ref_type != 'tag' + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: overpressure/out/ccache + key: ccache-${{ matrix.headset.device }}-${{ github.run_id }} + restore-keys: ccache-${{ matrix.headset.device }}- - name: The kernel if: steps.key.outputs.name && steps.earlier.outputs.found != 'true' working-directory: overpressure + env: + CCACHE: ${{ github.ref_type != 'tag' && '/work/out/ccache' || '' }} run: | uv run python -m overpressure container run -- \ + env ${CCACHE:+CCACHE_DIR="$CCACHE"} \ bash "devices/$DEVICE/kernel/build-tree.sh" out/linux /var/tmp/kernel out/kernel cat out/kernel/build.json + - name: The compiled objects, for the next build + if: always() && steps.key.outputs.name && steps.earlier.outputs.found != 'true' && github.ref_type != 'tag' + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: overpressure/out/ccache + key: ccache-${{ matrix.headset.device }}-${{ github.run_id }} - name: The tooling it was built with if: steps.key.outputs.name && steps.earlier.outputs.found != 'true' run: |