@@ -417,6 +417,140 @@ jobs:
417417 include/
418418 include_cgo.go
419419
420+ integration-test :
421+ if : github.event_name == 'push'
422+ needs : [linux, darwin, windows]
423+ strategy :
424+ fail-fast : false
425+ matrix :
426+ include :
427+ - name : linux-amd64-cgo
428+ os : ubuntu-22.04
429+ artifact : cronet-linux-amd64
430+ target : linux/amd64
431+ mode : cgo
432+ - name : linux-amd64-purego
433+ os : ubuntu-22.04
434+ artifact : cronet-linux-amd64
435+ target : linux/amd64
436+ mode : purego
437+ - name : darwin-arm64
438+ os : macos-15
439+ artifact : cronet-darwin-arm64
440+ target : darwin/arm64
441+ mode : cgo
442+ - name : windows-amd64
443+ os : windows-2022
444+ artifact : cronet-windows-amd64
445+ target : windows/amd64
446+ mode : purego
447+ runs-on : ${{ matrix.os }}
448+ steps :
449+ - uses : actions/checkout@v4
450+ with :
451+ submodules : ' recursive'
452+
453+ - uses : actions/setup-go@v5
454+ with :
455+ go-version : ^1.24
456+
457+ - name : Download artifact
458+ uses : actions/download-artifact@v4
459+ with :
460+ name : ${{ matrix.artifact }}
461+ path : .
462+
463+ - name : Get naiveproxy commit
464+ id : naive
465+ shell : bash
466+ run : echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT
467+
468+ - name : Get Chromium version
469+ id : chromium
470+ shell : bash
471+ run : echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT
472+
473+ # Linux: restore build cache and toolchain cache (needed for env command)
474+ - name : Restore build cache (Linux)
475+ if : runner.os == 'Linux'
476+ uses : actions/cache/restore@v4
477+ with :
478+ path : naiveproxy/src/out
479+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-amd64
480+
481+ - name : Restore toolchain cache (Linux)
482+ if : runner.os == 'Linux'
483+ uses : actions/cache/restore@v4
484+ with :
485+ path : |
486+ naiveproxy/src/third_party/llvm-build
487+ naiveproxy/src/gn/out
488+ naiveproxy/src/chrome/build/pgo_profiles
489+ key : toolchain-linux-${{ steps.chromium.outputs.version }}
490+
491+ - name : Download toolchain (Linux)
492+ if : runner.os == 'Linux'
493+ run : go run ./cmd/build-naive --target=linux/amd64 download-toolchain
494+
495+ # Darwin: restore build cache (needed for env command)
496+ - name : Restore build cache (macOS)
497+ if : runner.os == 'macOS'
498+ uses : actions/cache/restore@v4
499+ with :
500+ path : naiveproxy/src/out
501+ key : naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-darwin-arm64
502+
503+ # Install iperf3
504+ - name : Install iperf3 (Linux)
505+ if : runner.os == 'Linux'
506+ run : |
507+ sudo apt update
508+ sudo apt install -y iperf3
509+
510+ - name : Install iperf3 (macOS)
511+ if : runner.os == 'macOS'
512+ run : brew install iperf3
513+
514+ - name : Install iperf3 (Windows)
515+ if : runner.os == 'Windows'
516+ run : choco install iperf3
517+
518+ # Generate package --local files
519+ - name : Package (non-Windows)
520+ if : runner.os != 'Windows'
521+ run : go run ./cmd/build-naive --target=${{ matrix.target }} package --local
522+
523+ # CGO mode tests
524+ - name : Run integration tests (CGO - Linux)
525+ if : matrix.mode == 'cgo' && runner.os == 'Linux'
526+ working-directory : test
527+ run : |
528+ eval $(go run ../cmd/build-naive --target=${{ matrix.target }} env --export)
529+ CGO_ENABLED=1 go test -v
530+
531+ - name : Run integration tests (CGO - macOS)
532+ if : matrix.mode == 'cgo' && runner.os == 'macOS'
533+ working-directory : test
534+ run : |
535+ eval $(go run ../cmd/build-naive --target=${{ matrix.target }} env --export)
536+ CGO_ENABLED=1 go test -v
537+
538+ # purego mode tests
539+ - name : Run integration tests (purego - Linux)
540+ if : matrix.mode == 'purego' && runner.os == 'Linux'
541+ working-directory : test
542+ run : |
543+ export LD_LIBRARY_PATH=$PWD/../lib/linux_amd64
544+ go test -tags with_purego -v
545+
546+ - name : Run integration tests (purego - Windows)
547+ if : matrix.mode == 'purego' && runner.os == 'Windows'
548+ working-directory : test
549+ shell : bash
550+ run : |
551+ cp ../lib/windows_amd64/libcronet.dll .
552+ go test -tags with_purego -v
553+
420554 publish :
421555 if : github.event_name == 'push'
422556 needs : [linux, linux-musl, darwin, windows, android]
0 commit comments