@@ -16,6 +16,9 @@ concurrency:
1616 group : ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
1717 cancel-in-progress : true
1818
19+ env :
20+ CACHE_EPOCH : 1
21+
1922jobs :
2023 linux :
2124 runs-on : ubuntu-22.04
@@ -36,19 +39,26 @@ jobs:
3639 - name : Get Chromium version
3740 id : chromium
3841 run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
42+ - name : Get clang toolchain version
43+ id : clang
44+ shell : bash
45+ run : |
46+ clang_revision=$(sed -n "s/^CLANG_REVISION = '\\(.*\\)'$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
47+ clang_subrevision=$(sed -n "s/^CLANG_SUB_REVISION = \\([0-9]*\\)$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
48+ echo "version=${clang_revision}-${clang_subrevision}" >> $GITHUB_OUTPUT
3949 - name : Cache build artifacts
4050 id : build-cache
4151 uses : actions/cache@v4
4252 with :
4353 path : naiveproxy/src/out
44- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-${{ matrix.arch }}
54+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-${{ matrix.arch }}
4555 - name : Cache ccache files
4656 if : steps.build-cache.outputs.cache-hit != 'true'
4757 uses : actions/cache@v4
4858 with :
4959 path : ~/.cache/ccache
50- key : ccache-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}
51- restore-keys : ccache-linux-${{ matrix.arch }}-
60+ key : ccache-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
61+ restore-keys : ccache-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
5262 - name : Install packages
5363 if : steps.build-cache.outputs.cache-hit != 'true'
5464 run : |
7484 naiveproxy/src/third_party/llvm-build
7585 naiveproxy/src/gn/out
7686 naiveproxy/src/chrome/build/pgo_profiles
77- key : toolchain-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}
78- restore-keys : toolchain-linux-${{ matrix.arch }}-
87+ key : toolchain-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
88+ restore-keys : toolchain-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
7989 - name : Download clang and sysroot
8090 run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} download-toolchain
8191 - name : Install QEMU for cross-platform testing
@@ -152,19 +162,26 @@ jobs:
152162 - name : Get Chromium version
153163 id : chromium
154164 run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
165+ - name : Get clang toolchain version
166+ id : clang
167+ shell : bash
168+ run : |
169+ clang_revision=$(sed -n "s/^CLANG_REVISION = '\\(.*\\)'$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
170+ clang_subrevision=$(sed -n "s/^CLANG_SUB_REVISION = \\([0-9]*\\)$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
171+ echo "version=${clang_revision}-${clang_subrevision}" >> $GITHUB_OUTPUT
155172 - name : Cache build artifacts
156173 id : build-cache
157174 uses : actions/cache@v4
158175 with :
159176 path : naiveproxy/src/out
160- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-${{ matrix.name }}
177+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-${{ matrix.name }}
161178 - name : Cache ccache files
162179 if : steps.build-cache.outputs.cache-hit != 'true'
163180 uses : actions/cache@v4
164181 with :
165182 path : ~/Library/Caches/ccache
166- key : ccache-darwin-${{ matrix.name }}-${{ steps.chromium.outputs.version }}
167- restore-keys : ccache-darwin-${{ matrix.name }}-
183+ key : ccache-darwin-${{ matrix.name }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
184+ restore-keys : ccache-darwin-${{ matrix.name }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
168185 - name : Install tools
169186 if : steps.build-cache.outputs.cache-hit != 'true'
170187 run : brew install ninja ccache
@@ -184,6 +201,7 @@ jobs:
184201 - name : Build and run test binary
185202 if : matrix.target == 'darwin/arm64'
186203 run : |
204+ eval $(go run ./cmd/build-naive --target=darwin/arm64 env --export)
187205 CGO_ENABLED=1 go test -c -o cronet.test .
188206 ./cronet.test -test.v -test.run=TestEngineVersion
189207 - uses : actions/upload-artifact@v4
@@ -215,19 +233,33 @@ jobs:
215233 id : chromium
216234 shell : bash
217235 run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
236+ - name : Get clang toolchain version
237+ id : clang
238+ shell : bash
239+ run : |
240+ clang_revision=$(sed -n "s/^CLANG_REVISION = '\\(.*\\)'$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
241+ clang_subrevision=$(sed -n "s/^CLANG_SUB_REVISION = \\([0-9]*\\)$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
242+ echo "version=${clang_revision}-${clang_subrevision}" >> $GITHUB_OUTPUT
243+ - name : Get clang toolchain version
244+ id : clang
245+ shell : bash
246+ run : |
247+ clang_revision=$(sed -n "s/^CLANG_REVISION = '\\(.*\\)'$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
248+ clang_subrevision=$(sed -n "s/^CLANG_SUB_REVISION = \\([0-9]*\\)$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
249+ echo "version=${clang_revision}-${clang_subrevision}" >> $GITHUB_OUTPUT
218250 - name : Cache build artifacts
219251 id : build-cache
220252 uses : actions/cache@v4
221253 with :
222254 path : naiveproxy/src/out
223- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-windows-${{ matrix.arch }}
255+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-windows-${{ matrix.arch }}
224256 - name : Cache sccache files
225257 if : steps.build-cache.outputs.cache-hit != 'true'
226258 uses : actions/cache@v4
227259 with :
228260 path : ~/AppData/Local/Mozilla/sccache
229- key : sccache-windows-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}
230- restore-keys : sccache-windows-${{ matrix.arch }}-
261+ key : sccache-windows-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
262+ restore-keys : sccache-windows-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
231263 - name : Install tools
232264 if : steps.build-cache.outputs.cache-hit != 'true'
233265 run : |
@@ -289,19 +321,26 @@ jobs:
289321 - name : Get Chromium version
290322 id : chromium
291323 run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
324+ - name : Get clang toolchain version
325+ id : clang
326+ shell : bash
327+ run : |
328+ clang_revision=$(sed -n "s/^CLANG_REVISION = '\\(.*\\)'$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
329+ clang_subrevision=$(sed -n "s/^CLANG_SUB_REVISION = \\([0-9]*\\)$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
330+ echo "version=${clang_revision}-${clang_subrevision}" >> $GITHUB_OUTPUT
292331 - name : Cache build artifacts
293332 id : build-cache
294333 uses : actions/cache@v4
295334 with :
296335 path : naiveproxy/src/out
297- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-android-${{ matrix.arch }}
336+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-android-${{ matrix.arch }}
298337 - name : Cache ccache files
299338 if : steps.build-cache.outputs.cache-hit != 'true'
300339 uses : actions/cache@v4
301340 with :
302341 path : ~/.cache/ccache
303- key : ccache-android-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}
304- restore-keys : ccache-android-${{ matrix.arch }}-
342+ key : ccache-android-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
343+ restore-keys : ccache-android-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
305344 - name : Install packages
306345 if : steps.build-cache.outputs.cache-hit != 'true'
307346 run : |
@@ -327,6 +366,7 @@ jobs:
327366 ndk-version : r28
328367 - name : Build test binary
329368 run : |
369+ eval $(go run ./cmd/build-naive --target=android/${{ matrix.arch }} env --export)
330370 CC=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.cc }} \
331371 CGO_ENABLED=1 GOOS=android GOARCH=${{ matrix.arch }} go test -c -o cronet.test .
332372 - uses : actions/upload-artifact@v4
@@ -356,19 +396,26 @@ jobs:
356396 - name : Get Chromium version
357397 id : chromium
358398 run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
399+ - name : Get clang toolchain version
400+ id : clang
401+ shell : bash
402+ run : |
403+ clang_revision=$(sed -n "s/^CLANG_REVISION = '\\(.*\\)'$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
404+ clang_subrevision=$(sed -n "s/^CLANG_SUB_REVISION = \\([0-9]*\\)$/\\1/p" naiveproxy/src/tools/clang/scripts/update.py)
405+ echo "version=${clang_revision}-${clang_subrevision}" >> $GITHUB_OUTPUT
359406 - name : Cache build artifacts
360407 id : build-cache
361408 uses : actions/cache@v4
362409 with :
363410 path : naiveproxy/src/out
364- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-musl-${{ matrix.arch }}
411+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-musl-${{ matrix.arch }}
365412 - name : Cache ccache files
366413 if : steps.build-cache.outputs.cache-hit != 'true'
367414 uses : actions/cache@v4
368415 with :
369416 path : ~/.cache/ccache
370- key : ccache-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}
371- restore-keys : ccache-linux-musl-${{ matrix.arch }}-
417+ key : ccache-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
418+ restore-keys : ccache-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
372419 - name : Install packages
373420 if : steps.build-cache.outputs.cache-hit != 'true'
374421 run : |
@@ -394,8 +441,8 @@ jobs:
394441 naiveproxy/src/third_party/llvm-build
395442 naiveproxy/src/gn/out
396443 naiveproxy/src/chrome/build/pgo_profiles
397- key : toolchain-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}
398- restore-keys : toolchain-linux-musl-${{ matrix.arch }}-
444+ key : toolchain-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
445+ restore-keys : toolchain-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
399446 - name : Download toolchain
400447 run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain
401448 - name : Install QEMU for cross-platform testing
@@ -514,7 +561,7 @@ jobs:
514561 uses : actions/cache/restore@v4
515562 with :
516563 path : naiveproxy/src/out
517- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}
564+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}
518565
519566 - name : Restore toolchain cache (Linux)
520567 if : runner.os == 'Linux'
@@ -524,8 +571,8 @@ jobs:
524571 naiveproxy/src/third_party/llvm-build
525572 naiveproxy/src/gn/out
526573 naiveproxy/src/chrome/build/pgo_profiles
527- key : toolchain-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}-${{ steps.chromium.outputs.version }}
528- restore-keys : toolchain-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}-
574+ key : toolchain-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}
575+ restore-keys : toolchain-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}-${{ steps.chromium.outputs.version }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-
529576
530577 - name : Download toolchain (Linux)
531578 if : runner.os == 'Linux'
@@ -537,7 +584,7 @@ jobs:
537584 uses : actions/cache/restore@v4
538585 with :
539586 path : naiveproxy/src/out
540- key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-${{ contains(matrix.target, 'amd64') && 'darwin-amd64' || 'darwin-arm64' }}
587+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ steps.clang.outputs.version }}-${{ env.CACHE_EPOCH }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-${{ contains(matrix.target, 'amd64') && 'darwin-amd64' || 'darwin-arm64' }}
541588
542589 # Install iperf3
543590 - name : Install iperf3 (Linux)
0 commit comments