6262 if : steps.build-cache.outputs.cache-hit != 'true'
6363 run : ccache -s
6464 - name : Package
65- run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package --local
65+ run : |
66+ go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package --local
67+ go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package
6668 - name : Cache toolchain
6769 uses : actions/cache@v4
6870 with :
@@ -174,7 +176,9 @@ jobs:
174176 if : steps.build-cache.outputs.cache-hit != 'true'
175177 run : ccache -s
176178 - name : Package
177- run : go run ./cmd/build-naive --target=${{ matrix.target }} package --local
179+ run : |
180+ go run ./cmd/build-naive --target=${{ matrix.target }} package --local
181+ go run ./cmd/build-naive --target=${{ matrix.target }} package
178182 - name : Build and run test binary
179183 if : matrix.target == 'darwin/arm64'
180184 run : |
@@ -313,7 +317,9 @@ jobs:
313317 if : steps.build-cache.outputs.cache-hit != 'true'
314318 run : ccache -s
315319 - name : Package
316- run : go run ./cmd/build-naive --target=android/${{ matrix.arch }} package --local
320+ run : |
321+ go run ./cmd/build-naive --target=android/${{ matrix.arch }} package --local
322+ go run ./cmd/build-naive --target=android/${{ matrix.arch }} package
317323 - name : Setup Android NDK
318324 uses : nttld/setup-ndk@v1
319325 id : setup-ndk
@@ -379,7 +385,9 @@ jobs:
379385 if : steps.build-cache.outputs.cache-hit != 'true'
380386 run : ccache -s
381387 - name : Package
382- run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package --local
388+ run : |
389+ go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package --local
390+ go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package
383391 - name : Cache toolchain
384392 uses : actions/cache@v4
385393 with :
@@ -397,7 +405,7 @@ jobs:
397405 - name : Build test binary
398406 run : |
399407 eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env --export)
400- CGO_ENABLED=1 GOOS=linux GOARCH=${{ matrix.arch }} go test -c -o cronet.test .
408+ CGO_ENABLED=1 GOOS=linux GOARCH=${{ matrix.arch }} go test -c -tags with_musl - o cronet.test .
401409 - name : Run test binary
402410 continue-on-error : true # musl/QEMU test is flaky, don't block CI
403411 run : |
@@ -417,6 +425,139 @@ jobs:
417425 include/
418426 include_cgo.go
419427
428+ integration-test :
429+ if : github.event_name == 'push'
430+ needs : [linux, darwin, windows]
431+ strategy :
432+ fail-fast : false
433+ matrix :
434+ include :
435+ - name : linux-amd64-cgo
436+ os : ubuntu-22.04
437+ artifact : cronet-linux-amd64
438+ target : linux/amd64
439+ mode : cgo
440+ - name : linux-amd64-purego
441+ os : ubuntu-22.04
442+ artifact : cronet-linux-amd64
443+ target : linux/amd64
444+ mode : purego
445+ - name : darwin-arm64
446+ os : macos-15
447+ artifact : cronet-darwin-arm64
448+ target : darwin/arm64
449+ mode : cgo
450+ - name : windows-amd64
451+ os : windows-2022
452+ artifact : cronet-windows-amd64
453+ target : windows/amd64
454+ mode : purego
455+ runs-on : ${{ matrix.os }}
456+ steps :
457+ - uses : actions/checkout@v4
458+ with :
459+ submodules : ' recursive'
460+
461+ - uses : actions/setup-go@v5
462+ with :
463+ go-version : ^1.24
464+
465+ - name : Download artifact
466+ uses : actions/download-artifact@v4
467+ with :
468+ name : ${{ matrix.artifact }}
469+ path : .
470+
471+ - name : Get naiveproxy commit
472+ id : naive
473+ shell : bash
474+ run : echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT
475+
476+ - name : Get Chromium version
477+ id : chromium
478+ shell : bash
479+ run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
480+
481+ # Linux: restore build cache and toolchain cache (needed for env command)
482+ - name : Restore build cache (Linux)
483+ if : runner.os == 'Linux'
484+ uses : actions/cache/restore@v4
485+ with :
486+ path : naiveproxy/src/out
487+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-amd64
488+
489+ - name : Restore toolchain cache (Linux)
490+ if : runner.os == 'Linux'
491+ uses : actions/cache/restore@v4
492+ with :
493+ path : |
494+ naiveproxy/src/third_party/llvm-build
495+ naiveproxy/src/gn/out
496+ naiveproxy/src/chrome/build/pgo_profiles
497+ key : toolchain-linux-${{ steps.chromium.outputs.version }}
498+
499+ - name : Download toolchain (Linux)
500+ if : runner.os == 'Linux'
501+ run : go run ./cmd/build-naive --target=linux/amd64 download-toolchain
502+
503+ # Darwin: restore build cache (needed for env command)
504+ - name : Restore build cache (macOS)
505+ if : runner.os == 'macOS'
506+ uses : actions/cache/restore@v4
507+ with :
508+ path : naiveproxy/src/out
509+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-darwin-arm64
510+
511+ # Install iperf3
512+ - name : Install iperf3 (Linux)
513+ if : runner.os == 'Linux'
514+ run : |
515+ sudo apt update
516+ sudo apt install -y iperf3
517+
518+ - name : Install iperf3 (macOS)
519+ if : runner.os == 'macOS'
520+ run : brew install iperf3
521+
522+ - name : Install iperf3 (Windows)
523+ if : runner.os == 'Windows'
524+ run : choco install iperf3
525+
526+ # Generate package --local files
527+ - name : Package (non-Windows)
528+ if : runner.os != 'Windows'
529+ run : go run ./cmd/build-naive --target=${{ matrix.target }} package --local
530+
531+ # CGO mode tests
532+ - name : Run integration tests (CGO - Linux)
533+ if : matrix.mode == 'cgo' && runner.os == 'Linux'
534+ run : |
535+ eval $(go run ./cmd/build-naive --target=${{ matrix.target }} env --export)
536+ cd test && CGO_ENABLED=1 go test -v
537+
538+ - name : Run integration tests (CGO - macOS)
539+ if : matrix.mode == 'cgo' && runner.os == 'macOS'
540+ run : |
541+ eval $(go run ./cmd/build-naive --target=${{ matrix.target }} env --export)
542+ cd test && CGO_ENABLED=1 go test -v
543+
544+ # purego mode tests
545+ - name : Run integration tests (purego - Linux)
546+ if : matrix.mode == 'purego' && runner.os == 'Linux'
547+ working-directory : test
548+ run : |
549+ export LD_LIBRARY_PATH=$PWD/../lib/linux_amd64
550+ CGO_ENABLED=0 go test -tags with_purego -v
551+
552+ - name : Run integration tests (purego - Windows)
553+ if : matrix.mode == 'purego' && runner.os == 'Windows'
554+ working-directory : test
555+ shell : bash
556+ run : |
557+ # Add DLL directory to PATH for library loading
558+ export PATH="$PWD/../lib/windows_amd64:$PATH"
559+ go test -tags with_purego -v
560+
420561 publish :
421562 if : github.event_name == 'push'
422563 needs : [linux, linux-musl, darwin, windows, android]
0 commit comments