Add more logs for custom dialer #138
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release tag' | |
| type: string | |
| required: false | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| linux: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [amd64, arm64, "386", arm] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.25 | |
| - name: Get naiveproxy commit | |
| id: naive | |
| run: echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get Chromium version | |
| id: chromium | |
| run: echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT | |
| - name: Cache build artifacts | |
| id: build-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| key: naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-${{ matrix.arch }} | |
| - name: Cache ccache files | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: ccache-linux-${{ matrix.arch }}- | |
| - name: Install packages | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ninja-build ccache | |
| - name: Reset ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -z | |
| - name: Build | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: go run ./cmd/build-naive --target=linux/${{ matrix.arch }} build | |
| - name: Show ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -s | |
| - name: Package | |
| run: | | |
| go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package --local | |
| go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package | |
| - name: Cache toolchain | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| naiveproxy/src/third_party/llvm-build | |
| naiveproxy/src/gn/out | |
| naiveproxy/src/chrome/build/pgo_profiles | |
| key: toolchain-linux-${{ matrix.arch }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: toolchain-linux-${{ matrix.arch }}- | |
| - name: Download clang and sysroot | |
| run: go run ./cmd/build-naive --target=linux/${{ matrix.arch }} download-toolchain | |
| - name: Install QEMU for cross-platform testing | |
| run: | | |
| sudo apt update | |
| sudo apt install -y qemu-user-binfmt | |
| - name: Build test binary | |
| run: | | |
| eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env --export) | |
| CGO_ENABLED=1 GOOS=linux GOARCH=${{ matrix.arch }} go test -c -o cronet.test . | |
| - name: Run test binary | |
| run: | | |
| eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env --export) | |
| if [ "${{ matrix.arch }}" != "amd64" ] && [ "${{ matrix.arch }}" != "386" ]; then | |
| export QEMU_LD_PREFIX | |
| fi | |
| ./cronet.test -test.v -test.run=TestEngineVersion | |
| - name: Build purego test binary | |
| if: matrix.arch == 'amd64' || matrix.arch == 'arm64' | |
| run: | | |
| cp lib/linux_${{ matrix.arch }}/libcronet.so . | |
| CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.arch }} go test -tags with_purego -c -o cronet.purego.test . | |
| - name: Run purego test binary | |
| if: matrix.arch == 'amd64' || matrix.arch == 'arm64' | |
| run: | | |
| if [ "${{ matrix.arch }}" != "amd64" ]; then | |
| eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env --export) | |
| export QEMU_LD_PREFIX | |
| fi | |
| export LD_LIBRARY_PATH=$PWD | |
| ./cronet.purego.test -test.v -test.run=TestEngineVersion | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cronet-linux-${{ matrix.arch }} | |
| path: | | |
| lib/ | |
| include/ | |
| include_cgo.go | |
| darwin: | |
| runs-on: macos-15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: darwin/amd64 | |
| name: darwin-amd64 | |
| - target: darwin/arm64 | |
| name: darwin-arm64 | |
| # iOS | |
| - target: ios/arm64 | |
| name: ios-arm64 | |
| - target: ios/arm64/simulator | |
| name: ios-arm64-simulator | |
| - target: ios/amd64 | |
| name: ios-amd64-simulator | |
| # tvOS | |
| - target: tvos/arm64 | |
| name: tvos-arm64 | |
| - target: tvos/arm64/simulator | |
| name: tvos-arm64-simulator | |
| - target: tvos/amd64 | |
| name: tvos-amd64-simulator | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Get naiveproxy commit | |
| id: naive | |
| run: echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get Chromium version | |
| id: chromium | |
| run: echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT | |
| - name: Cache build artifacts | |
| id: build-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| key: naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-${{ matrix.name }} | |
| - name: Cache ccache files | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/Library/Caches/ccache | |
| key: ccache-darwin-${{ matrix.name }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: ccache-darwin-${{ matrix.name }}- | |
| - name: Install tools | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: brew install ninja ccache | |
| - name: Reset ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -z | |
| - name: Build | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: go run ./cmd/build-naive --target=${{ matrix.target }} build | |
| - name: Show ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -s | |
| - name: Package | |
| run: | | |
| go run ./cmd/build-naive --target=${{ matrix.target }} package --local | |
| go run ./cmd/build-naive --target=${{ matrix.target }} package | |
| - name: Build and run test binary | |
| if: matrix.target == 'darwin/arm64' | |
| run: | | |
| CGO_ENABLED=1 go test -c -o cronet.test . | |
| ./cronet.test -test.v -test.run=TestEngineVersion | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cronet-${{ matrix.name }} | |
| path: | | |
| lib/ | |
| include/ | |
| include_cgo.go | |
| windows: | |
| runs-on: windows-2022 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Get naiveproxy commit | |
| id: naive | |
| shell: bash | |
| run: echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get Chromium version | |
| id: chromium | |
| shell: bash | |
| run: echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT | |
| - name: Cache build artifacts | |
| id: build-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| key: naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-windows-${{ matrix.arch }} | |
| - name: Cache sccache files | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/AppData/Local/Mozilla/sccache | |
| key: sccache-windows-${{ matrix.arch }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: sccache-windows-${{ matrix.arch }}- | |
| - name: Install tools | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: | | |
| choco install ninja sccache | |
| - name: Reset sccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: sccache -z | |
| - name: Build | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: go run ./cmd/build-naive --target=windows/${{ matrix.arch }} build | |
| - name: Show sccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: sccache -s | |
| - name: Package | |
| run: go run ./cmd/build-naive --target=windows/${{ matrix.arch }} package | |
| - name: Build and run test binary | |
| if: matrix.arch != 'arm64' | |
| shell: bash | |
| run: | | |
| # Copy DLL to current directory for fallback loading | |
| cp lib/windows_${{ matrix.arch }}/libcronet.dll . | |
| CGO_ENABLED=0 \ | |
| GOOS=windows \ | |
| GOARCH=${{ matrix.arch }} \ | |
| go test -tags with_purego -c -o cronet.test.exe . | |
| ./cronet.test.exe -test.v -test.run=TestEngineVersion | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cronet-windows-${{ matrix.arch }} | |
| path: | | |
| lib/ | |
| include/ | |
| include_cgo.go | |
| android: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: arm64 | |
| cc: aarch64-linux-android23-clang | |
| - arch: amd64 | |
| cc: x86_64-linux-android23-clang | |
| - arch: arm | |
| cc: armv7a-linux-androideabi23-clang | |
| - arch: "386" | |
| cc: i686-linux-android23-clang | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Get naiveproxy commit | |
| id: naive | |
| run: echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get Chromium version | |
| id: chromium | |
| run: echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT | |
| - name: Cache build artifacts | |
| id: build-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| key: naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-android-${{ matrix.arch }} | |
| - name: Cache ccache files | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-android-${{ matrix.arch }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: ccache-android-${{ matrix.arch }}- | |
| - name: Install packages | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ninja-build ccache | |
| - name: Reset ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -z | |
| - name: Build | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: go run ./cmd/build-naive --target=android/${{ matrix.arch }} build | |
| - name: Show ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -s | |
| - name: Package | |
| run: | | |
| go run ./cmd/build-naive --target=android/${{ matrix.arch }} package --local | |
| go run ./cmd/build-naive --target=android/${{ matrix.arch }} package | |
| - name: Setup Android NDK | |
| uses: nttld/setup-ndk@v1 | |
| id: setup-ndk | |
| with: | |
| ndk-version: r28 | |
| - name: Build test binary | |
| run: | | |
| CC=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.cc }} \ | |
| CGO_ENABLED=1 GOOS=android GOARCH=${{ matrix.arch }} go test -c -o cronet.test . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cronet-android-${{ matrix.arch }} | |
| path: | | |
| lib/ | |
| include/ | |
| include_cgo.go | |
| linux-musl: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [amd64, arm64, "386", arm] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Get naiveproxy commit | |
| id: naive | |
| run: echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get Chromium version | |
| id: chromium | |
| run: echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT | |
| - name: Cache build artifacts | |
| id: build-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| key: naive-build-${{ steps.naive.outputs.commit }}-${{ hashFiles('cmd/build-naive/cmd_build.go', 'cmd/build-naive/cmd.go') }}-linux-musl-${{ matrix.arch }} | |
| - name: Cache ccache files | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ccache | |
| key: ccache-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: ccache-linux-musl-${{ matrix.arch }}- | |
| - name: Install packages | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y ninja-build zstd ccache | |
| - name: Reset ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -z | |
| - name: Build | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl build | |
| - name: Show ccache stats | |
| if: steps.build-cache.outputs.cache-hit != 'true' | |
| run: ccache -s | |
| - name: Package | |
| run: | | |
| go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package --local | |
| go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package | |
| - name: Cache toolchain | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| naiveproxy/src/third_party/llvm-build | |
| naiveproxy/src/gn/out | |
| naiveproxy/src/chrome/build/pgo_profiles | |
| key: toolchain-linux-musl-${{ matrix.arch }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: toolchain-linux-musl-${{ matrix.arch }}- | |
| - name: Download toolchain | |
| run: go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain | |
| - name: Install QEMU for cross-platform testing | |
| run: | | |
| sudo apt update | |
| sudo apt install -y qemu-user-binfmt | |
| - name: Build test binary | |
| run: | | |
| eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env --export) | |
| CGO_ENABLED=1 GOOS=linux GOARCH=${{ matrix.arch }} go test -c -tags with_musl -o cronet.test . | |
| - name: Run test binary | |
| continue-on-error: true # musl/QEMU test is flaky, don't block CI | |
| run: | | |
| # Static binary - can run directly with QEMU binfmt or explicit QEMU for cross-arch | |
| case "${{ matrix.arch }}" in | |
| amd64) QEMU=qemu-x86_64 ;; | |
| arm64) QEMU=qemu-aarch64 ;; | |
| 386) QEMU=qemu-i386 ;; | |
| arm) QEMU=qemu-arm ;; | |
| esac | |
| timeout 60 $QEMU ./cronet.test -test.v -test.run=TestEngineVersion -test.timeout=30s | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cronet-linux-musl-${{ matrix.arch }} | |
| path: | | |
| lib/ | |
| include/ | |
| include_cgo.go | |
| integration-test: | |
| if: github.event_name != 'workflow_dispatch' | |
| needs: [linux, darwin, windows] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux | |
| - name: linux-amd64-cgo | |
| os: ubuntu-22.04 | |
| artifact: cronet-linux-amd64 | |
| target: linux/amd64 | |
| mode: cgo | |
| - name: linux-amd64-purego | |
| os: ubuntu-22.04 | |
| artifact: cronet-linux-amd64 | |
| target: linux/amd64 | |
| mode: purego | |
| - name: linux-arm64-purego | |
| os: ubuntu-22.04-arm | |
| artifact: cronet-linux-arm64 | |
| target: linux/arm64 | |
| mode: purego | |
| # macOS ARM64 | |
| - name: darwin-arm64-macos15 | |
| os: macos-15 | |
| artifact: cronet-darwin-arm64 | |
| target: darwin/arm64 | |
| mode: cgo | |
| - name: darwin-arm64-macos26 | |
| os: macos-26 | |
| artifact: cronet-darwin-arm64 | |
| target: darwin/arm64 | |
| mode: cgo | |
| # macOS x64 (Intel) | |
| - name: darwin-amd64-macos15 | |
| os: macos-15-intel | |
| artifact: cronet-darwin-amd64 | |
| target: darwin/amd64 | |
| mode: cgo | |
| # Windows x64 | |
| - name: windows-amd64-2022 | |
| os: windows-2022 | |
| artifact: cronet-windows-amd64 | |
| target: windows/amd64 | |
| mode: purego | |
| - name: windows-amd64-2025 | |
| os: windows-2025 | |
| artifact: cronet-windows-amd64 | |
| target: windows/amd64 | |
| mode: purego | |
| # Windows ARM64 | |
| - name: windows-arm64 | |
| os: windows-11-arm | |
| artifact: cronet-windows-arm64 | |
| target: windows/arm64 | |
| mode: purego | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.24 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: . | |
| - name: Get naiveproxy commit | |
| id: naive | |
| shell: bash | |
| run: echo "commit=$(git -C naiveproxy rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Get Chromium version | |
| id: chromium | |
| shell: bash | |
| run: echo "version=$(cat naiveproxy/CHROMIUM_VERSION)" >> $GITHUB_OUTPUT | |
| # Linux: restore build cache and toolchain cache (needed for env command) | |
| - name: Restore build cache (Linux) | |
| if: runner.os == 'Linux' | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| 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' }} | |
| - name: Restore toolchain cache (Linux) | |
| if: runner.os == 'Linux' | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| naiveproxy/src/third_party/llvm-build | |
| naiveproxy/src/gn/out | |
| naiveproxy/src/chrome/build/pgo_profiles | |
| key: toolchain-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}-${{ steps.chromium.outputs.version }} | |
| restore-keys: toolchain-linux-${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }}- | |
| - name: Download toolchain (Linux) | |
| if: runner.os == 'Linux' | |
| run: go run ./cmd/build-naive --target=${{ matrix.target }} download-toolchain | |
| # Darwin: restore build cache (needed for env command) | |
| - name: Restore build cache (macOS) | |
| if: runner.os == 'macOS' | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: naiveproxy/src/out | |
| 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' }} | |
| # Install iperf3 | |
| - name: Install iperf3 (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt update | |
| sudo apt install -y iperf3 | |
| - name: Install iperf3 (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install iperf3 | |
| - name: Install iperf3 (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install iperf3 | |
| # Generate package --local files | |
| - name: Package (non-Windows) | |
| if: runner.os != 'Windows' | |
| run: go run ./cmd/build-naive --target=${{ matrix.target }} package --local | |
| # CGO mode tests | |
| - name: Run integration tests (CGO) | |
| if: matrix.mode == 'cgo' | |
| run: | | |
| eval $(go run ./cmd/build-naive --target=${{ matrix.target }} env --export) | |
| cd test && CGO_ENABLED=1 go test -v | |
| # purego mode tests | |
| - name: Run integration tests (purego - Linux) | |
| if: matrix.mode == 'purego' && runner.os == 'Linux' | |
| working-directory: test | |
| run: | | |
| export LD_LIBRARY_PATH=$PWD/../lib/linux_${{ contains(matrix.target, 'arm64') && 'arm64' || 'amd64' }} | |
| CGO_ENABLED=0 go test -tags with_purego -v | |
| - name: Run integration tests (purego - Windows) | |
| if: matrix.mode == 'purego' && runner.os == 'Windows' | |
| working-directory: test | |
| shell: bash | |
| run: | | |
| # Determine library directory based on target architecture | |
| case "${{ matrix.target }}" in | |
| */arm64) LIB_DIR="windows_arm64" ;; | |
| */amd64) LIB_DIR="windows_amd64" ;; | |
| esac | |
| export PATH="$PWD/../lib/${LIB_DIR}:$PATH" | |
| go test -tags with_purego -v | |
| publish: | |
| if: github.event_name == 'push' | |
| needs: [linux, linux-musl, darwin, windows, android] | |
| runs-on: ubuntu-22.04 | |
| env: | |
| TARGET_BRANCH: ${{ github.ref_name == 'main' && 'go' || 'go_dev' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ^1.22 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Merge artifacts | |
| run: | | |
| for dir in artifacts/cronet-*/; do | |
| cp -r "$dir"/* . | |
| done | |
| ls -laR lib/ include/ include_cgo.go | |
| - name: Configure git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Publish | |
| run: go run ./cmd/build-naive publish --branch ${{ env.TARGET_BRANCH }} | |
| release: | |
| needs: [linux, windows] | |
| if: github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Linux artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: cronet-linux-* | |
| path: artifacts/ | |
| merge-multiple: false | |
| - name: Download Windows artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: cronet-windows-* | |
| path: artifacts/ | |
| merge-multiple: false | |
| - name: Get Chromium version | |
| id: chromium | |
| run: | | |
| VERSION=$(grep -h 'const Version' artifacts/cronet-linux-amd64/lib/linux_amd64/libcronet_cgo.go | sed 's/.*"\(.*\)".*/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| # Linux glibc shared libraries | |
| for dir in artifacts/cronet-linux-*/lib/linux_*; do | |
| if [[ "$dir" != *_musl ]]; then | |
| ARCH=$(basename "$dir" | sed 's/linux_//') | |
| if [ -f "$dir/libcronet.so" ]; then | |
| cp "$dir/libcronet.so" "release/libcronet-linux-${ARCH}.so" | |
| fi | |
| fi | |
| done | |
| # Windows DLLs | |
| for dir in artifacts/cronet-windows-*/lib/windows_*; do | |
| ARCH=$(basename "$dir" | sed 's/windows_//') | |
| if [ -f "$dir/libcronet.dll" ]; then | |
| cp "$dir/libcronet.dll" "release/libcronet-windows-${ARCH}.dll" | |
| fi | |
| done | |
| ls -la release/ | |
| - name: Create or update release draft | |
| if: github.event.inputs.version != '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| CHROMIUM_VERSION="${{ steps.chromium.outputs.version }}" | |
| # Check if release exists | |
| if gh release view "$VERSION" &>/dev/null; then | |
| echo "Release $VERSION exists, uploading assets..." | |
| else | |
| echo "Creating release draft $VERSION..." | |
| gh release create "$VERSION" \ | |
| --draft \ | |
| --title "$VERSION" \ | |
| --notes "Cronet Go binding release based on Chromium $CHROMIUM_VERSION" | |
| fi | |
| # Upload assets (Linux .so and Windows .dll) | |
| gh release upload "$VERSION" release/* --clobber |