mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
Define consistent and unique cache keys (#6182)
Take OS name, build tool, Swift version and dependencies into account.
This commit is contained in:
@@ -16,10 +16,13 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get Swift version
|
||||
id: swift_version
|
||||
run: echo "version=$(swift --version | grep '[5-9]\.[0-9]\+\.[0-9]' -o | head -1)" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: ${{ runner.os }}-swift-spm-${{ hashFiles('Package.resolved') }}
|
||||
restore-keys: ${{ runner.os }}-swift-spm-
|
||||
key: ${{ runner.os }}-spm-${{ steps.swift_version.outputs.version }}-${{ hashFiles('Package.resolved', 'Package.swift') }}
|
||||
restore-keys: ${{ runner.os }}-spm-${{ steps.swift_version.outputs.version }}-
|
||||
path: .build
|
||||
- name: Build everything
|
||||
run: swift build --build-tests
|
||||
|
||||
@@ -22,10 +22,13 @@ jobs:
|
||||
target: "//:swiftlint @com_github_jpsim_sourcekitten//:sourcekitten"
|
||||
env:
|
||||
CI_BAZELRC_FILE_CONTENT: ${{ secrets.CI_BAZELRC_FILE_CONTENT }}
|
||||
- name: Get Swift version
|
||||
id: swift_version
|
||||
run: echo "version=$(swift --version | grep '[5-9]\.[0-9]\+\.[0-9]' -o | head -1)" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: ${{ runner.os }}-swift-spm-${{ hashFiles('Package.resolved') }}
|
||||
restore-keys: ${{ runner.os }}-swift-spm-
|
||||
key: ${{ runner.os }}-spm-${{ steps.swift_version.outputs.version }}-${{ hashFiles('Package.resolved', 'Package.swift') }}
|
||||
restore-keys: ${{ runner.os }}-spm-${{ steps.swift_version.outputs.version }}-
|
||||
path: .build
|
||||
- name: Generate documentation
|
||||
run: |
|
||||
|
||||
@@ -18,10 +18,13 @@ jobs:
|
||||
container: swift:6.1-noble
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Get Swift version
|
||||
id: swift_version
|
||||
run: echo "version=$(swift --version | grep '[5-9]\.[0-9]\+\.[0-9]' -o | head -1)" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: ${{ runner.os }}-swift-spm-${{ hashFiles('Package.resolved') }}
|
||||
restore-keys: ${{ runner.os }}-swift-spm-
|
||||
key: ${{ runner.os }}-spm-${{ steps.swift_version.outputs.version }}-${{ hashFiles('Package.resolved', 'Package.swift') }}
|
||||
restore-keys: ${{ runner.os }}-spm-${{ steps.swift_version.outputs.version }}-
|
||||
path: .build
|
||||
- name: Run tests
|
||||
uses: ./.github/actions/run-make
|
||||
@@ -44,7 +47,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: ${{ runner.os }}-xcode-spm-${{ matrix.xcode }}-${{ hashFiles('Package.resolved') }}
|
||||
key: ${{ runner.os }}-xcode-spm-${{ matrix.xcode }}-${{ hashFiles('Package.resolved', 'Package.swift') }}
|
||||
restore-keys: ${{ runner.os }}-xcode-spm-${{ matrix.xcode }}-
|
||||
path: .build
|
||||
- name: Run tests
|
||||
|
||||
Reference in New Issue
Block a user