@@ -64,18 +64,38 @@ jobs:
6464 KBUILD_OUTPUT : ${{ github.workspace }}/kbuild-output
6565 KERNEL : ${{ inputs.kernel }}
6666 KERNEL_ROOT : ${{ github.workspace }}
67+ REFERENCE_REPO_PATH : /libbpfci/mirrors/linux
6768 REPO_PATH : " "
6869 REPO_ROOT : ${{ github.workspace }}
6970 RUNNER_TYPE : ${{ contains(fromJSON(inputs.runs_on), 'codebuild') && 'codebuild' || 'default' }}
7071 steps :
72+
7173 - uses : actions/checkout@v4
7274 with :
73- fetch-depth : ${{ inputs.download_sources && 1 || env.BPF_NEXT_FETCH_DEPTH }}
75+ sparse-checkout : |
76+ .github
77+ ci
7478
7579 - if : ${{ env.RUNNER_TYPE == 'codebuild' }}
7680 shell : bash
7781 run : .github/scripts/tmpfsify-workspace.sh
7882
83+ - if : ${{ ! inputs.download_sources }}
84+ name : git clone ${{ github.repository }}@${{ github.sha }}
85+ shell : bash
86+ run : |
87+ if [ -d "${{ env.REFERENCE_REPO_PATH }}" ]; then
88+ git clone \
89+ --revision ${{ github.sha }} \
90+ --reference-if-able ${{ env.REFERENCE_REPO_PATH }} \
91+ https://github.com/${{ github.repository }}.git .kernel
92+ else
93+ git clone \
94+ --revision ${{ github.sha }} \
95+ --depth ${{ inputs.download_sources && 1 || env.BPF_NEXT_FETCH_DEPTH }} \
96+ https://github.com/${{ github.repository }}.git .kernel
97+ fi
98+
7999 - if : ${{ inputs.download_sources }}
80100 name : Download bpf-next tree
81101 env :
@@ -84,9 +104,10 @@ jobs:
84104 with :
85105 dest : ' .kernel'
86106 rev : ${{ env.BPF_NEXT_BASE_BRANCH }}
107+
87108 - uses : libbpf/ci/prepare-incremental-build@v3
88109 with :
89- repo-root : ${{ inputs.download_sources && '.kernel' || env.REPO_ROOT }}
110+ repo-root : ' .kernel'
90111 base-branch : >-
91112 ${{ inputs.download_sources && env.BPF_NEXT_BASE_BRANCH
92113 || github.event_name == 'pull_request' && github.base_ref
@@ -95,15 +116,16 @@ jobs:
95116 arch : ${{ inputs.arch }}
96117 toolchain_full : ${{ inputs.toolchain_full }}
97118 kbuild-output : ${{ env.KBUILD_OUTPUT }}
98- - if : ${{ inputs.download_sources }}
99- name : Move linux source in place
119+
120+ - name : Move linux source in place
100121 shell : bash
101122 run : |
102123 cd .kernel
103- rm -rf .git
124+ rm -rf .git .github ci
104125 mv -t .. $(ls -A)
105126 cd ..
106127 rmdir .kernel
128+
107129 - uses : libbpf/ci/patch-kernel@v3
108130 with :
109131 patches-root : ' ${{ github.workspace }}/ci/diffs'
0 commit comments