-
Notifications
You must be signed in to change notification settings - Fork 489
fix(.github/workflows): reuse cached .git repository for branch HEAD commit #3893
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
Changes from all commits
b742c82
60729ed
d39ddcb
c2e5a78
6671f89
49ba5a8
ca7461b
4f673ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,13 +4,11 @@ on: | |
| workflow_dispatch: # manually | ||
| inputs: | ||
| go-version: | ||
| description: The Go version to use | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added descriptions because a linter was complaining about them. |
||
| required: true | ||
| type: string | ||
| runs-on: | ||
| required: true | ||
| type: string | ||
| ref: | ||
| description: 'The branch to run the workflow on' | ||
| description: The OS to run the tests on | ||
| required: true | ||
| type: string | ||
| workflow_call: | ||
|
|
@@ -21,10 +19,6 @@ on: | |
| runs-on: | ||
| required: true | ||
| type: string | ||
| ref: | ||
| description: 'The branch to run the workflow on' | ||
| required: true | ||
| type: string | ||
|
|
||
| env: | ||
| DD_APPSEC_WAF_TIMEOUT: 1m # Increase time WAF time budget to reduce CI flakiness | ||
|
|
@@ -50,10 +44,16 @@ jobs: | |
| shell: pwsh | ||
| run: | | ||
| "normalized_workspace=${{ github.workspace }}" >> $env:GITHUB_ENV | ||
| - name: Restore repo cache | ||
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
| with: | ||
| path: .git | ||
| key: gitdb-${{ github.repository_id }}-${{ github.sha }} | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v2.7.0 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
| ref: ${{ github.sha }} | ||
| clean: false | ||
|
Comment on lines
52
to
+56
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If by any chance the previous step doesn't find the cached repo, checkout will just work as usual by downloading the repository. |
||
| - name: Setup Go and development tools | ||
| uses: ./.github/actions/setup-go | ||
| with: | ||
|
|
@@ -63,7 +63,7 @@ jobs: | |
| - name: Mac OS Coreutils | ||
| if: inputs.runs-on == 'macos-latest' | ||
| run: brew install coreutils | ||
| - name: "Runner ${{ matrix.runner-index }}: Test Core and Contrib (No Integration Tests)" | ||
| - name: "Runner: Test Core and Contrib (No Integration Tests)" | ||
| shell: bash | ||
| run: | | ||
| export PATH="${{ github.workspace }}/bin:${PATH}" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,6 @@ on: | |
| go-version: | ||
| required: true | ||
| type: string | ||
| ref: | ||
| description: 'The branch to run the workflow on' | ||
| required: true | ||
| type: string | ||
|
|
||
| env: | ||
| DD_APPSEC_WAF_TIMEOUT: 1m # Increase time WAF time budget to reduce CI flakiness | ||
|
|
@@ -31,10 +27,16 @@ jobs: | |
| outputs: | ||
| matrix: ${{ steps.matrix.outputs.matrix }} | ||
| steps: | ||
| - name: Restore repo cache | ||
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
| with: | ||
| path: .git | ||
| key: gitdb-${{ github.repository_id }}-${{ github.sha }} | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
| ref: ${{ github.sha }} | ||
| clean: false | ||
|
|
||
| - name: Compute Matrix | ||
| id: matrix | ||
|
|
@@ -201,11 +203,16 @@ jobs: | |
| ports: | ||
| - 4566:4566 | ||
| steps: | ||
| - name: Restore repo cache | ||
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
| with: | ||
| path: .git | ||
| key: gitdb-${{ github.repository_id }}-${{ github.sha }} | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
| fetch-depth: $(( ${{ github.event_name == 'pull_request' && github.event.pull_request.commits || 0 }} + 1 )) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default |
||
| ref: ${{ github.sha }} | ||
| clean: false | ||
|
|
||
| - name: Setup Go and development tools | ||
| uses: ./.github/actions/setup-go | ||
|
|
@@ -273,11 +280,16 @@ jobs: | |
| - 8125:8125/udp | ||
| - 8126:8126 | ||
| steps: | ||
| - name: Restore repo cache | ||
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
| with: | ||
| path: .git | ||
| key: gitdb-${{ github.repository_id }}-${{ github.sha }} | ||
| - name: Checkout | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| ref: ${{ inputs.ref || github.ref }} | ||
| fetch-depth: $(( ${{ github.event_name == 'pull_request' && github.event.pull_request.commits || 0 }} + 1 )) | ||
| ref: ${{ github.sha }} | ||
| clean: false | ||
| - name: Setup Go and development tools | ||
| uses: ./.github/actions/setup-go | ||
| with: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed because this workflow is never used from another one.