diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 279f0d195..d72f2483f 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -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 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cb12d47d0..3a807641c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb26266e8..68b79f79b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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