-
-
Notifications
You must be signed in to change notification settings - Fork 4
Cache .build directory for faster runtimes #13
Copy link
Copy link
Open
Description
Right now Android CI is my slowest CI aside from benchmarks.
Something like this, for example, could makes things faster:
- name: Restore .build
if: ${{ runner.debug != '1' }}
id: "restore-cache"
uses: actions/cache/restore@v4
with:
path: .build
key: "${{ github.event.repository.name }}-unit-tests-${{ matrix.config.mode }}-build-${{ matrix.swift.version }}-${{ matrix.macos.version }}-${{ hashFiles('./Package.resolved') }}"
restore-keys: "${{ github.event.repository.name }}-unit-tests-${{ matrix.config.mode }}-build-${{ matrix.swift.version }}-${{ matrix.macos.version }}-"
- name: Build ${{ github.event.repository.name }}
run: |
swift build \
--build-tests \
--enable-code-coverage \
--explicit-target-dependency-import-check error \
-Xswiftc -require-explicit-sendable \
-c ${{ matrix.config.mode }}
- name: Cache .build
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .build
key: "${{ github.event.repository.name }}-unit-tests-${{ matrix.config.mode }}-build-${{ matrix.swift.version }}-${{ matrix.macos.version }}-${{ hashFiles('./Package.resolved') }}"
Make sure to install zstd before calling any actions/cache so the cache action automatically uses zstd instead of gzip and becomes way faster.
See my article for full info: https://swiftonserver.com/faster-github-actions-ci-for-swift-projects/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels