Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement caching .build on linux to speed up CI #43

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: false
default: false
description: "Set to 'true' to enable testing in release mode as well. Defaults to 'false'."
with_experimental_caching:
type: boolean
required: false
default: false
description: "Set to 'true' to enable caching ''.build' in tests. Defaults to 'false'."
with_coverage:
type: boolean
required: false
Expand Down Expand Up @@ -136,6 +141,14 @@ jobs:
uses: vapor/ci/.github/actions/check-compatible-swift@main
with:
package_root: ${{ inputs.package_root }}
- name: Restore .build
if: ${{ inputs.with_experimental_caching && (steps.swift-check.outputs.swift-compatible == 'true') && (matrix.swift-config.build-mode == 'debug' || inputs.with_release_mode_testing) }}
id: "restore-cache"
uses: actions/cache/restore@v4
with:
path: .build
key: "${{ matrix.swift-config.image }}-${{ matrix.swift-config.build-mode }}-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}"
restore-keys: "${{ matrix.swift-config.image }}-${{ matrix.swift-config.build-mode }}-build-${{ runner.os }}-"
- name: Run unit tests
if: ${{ steps.swift-check.outputs.swift-compatible == 'true' && (matrix.swift-config.build-mode == 'debug' || inputs.with_release_mode_testing) }}
run: |
Expand All @@ -149,6 +162,12 @@ jobs:
${WITH_COVERAGE} \
${TEST_FILTER} \
${EXTRA_FLAGS}
- name: Cache .build
if: ${{ inputs.with_experimental_caching && (steps.restore-cache.outputs.cache-hit != 'true') && (steps.swift-check.outputs.swift-compatible == 'true') && (matrix.swift-config.build-mode == 'debug' || inputs.with_release_mode_testing) }}
uses: actions/cache/save@v4
with:
path: .build
key: "${{ matrix.swift-config.image }}-${{ matrix.swift-config.build-mode }}-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}"
- name: Upload coverage data
if: ${{ inputs.with_coverage && (steps.swift-check.outputs.swift-compatible == 'true') && (matrix.swift-config.build-mode == 'debug' || inputs.with_release_mode_testing) }}
uses: vapor/[email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
uses: ./.github/workflows/run-unit-tests.yml
with:
with_release_mode_testing: ${{ inputs.with_release_mode_testing || true }}
with_experimental_caching: true
with_coverage: ${{ inputs.with_coverage || false }}
with_tsan: ${{ inputs.with_tsan || false }}
with_api_check: ${{ inputs.with_api_check || true }}
Expand Down
Loading