2020 strategy :
2121 fail-fast : false
2222 matrix :
23- include :
24- - arch : amd64
25- clang_target : x86_64-linux-gnu
26- sysroot_arch : amd64
27- - arch : arm64
28- clang_target : aarch64-linux-gnu
29- sysroot_arch : arm64
30- - arch : " 386"
31- clang_target : i686-linux-gnu
32- sysroot_arch : i386
33- - arch : arm
34- clang_target : arm-linux-gnueabihf
35- sysroot_arch : armhf
23+ arch : [amd64, arm64, "386", arm]
3624 steps :
3725 - uses : actions/checkout@v4
3826 with :
7462 if : steps.build-cache.outputs.cache-hit != 'true'
7563 run : ccache -s
7664 - name : Package
77- run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package
65+ run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} package --local
7866 - name : Cache toolchain
7967 uses : actions/cache@v4
8068 with :
@@ -89,42 +77,28 @@ jobs:
8977 run : |
9078 sudo apt update
9179 sudo apt install -y qemu-user-binfmt
92- - name : Get CGO flags
93- id : cgo-flags
94- run : |
95- CGO_FLAGS=$(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} cgo-flags)
96- echo "CGO_FLAGS: $CGO_FLAGS"
97- echo "flags=$CGO_FLAGS" >> $GITHUB_OUTPUT
9880 - name : Build test binary
9981 run : |
100- CLANG=$PWD/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang
101- SYSROOT=$PWD/naiveproxy/src/out/sysroot-build/bullseye/bullseye_${{ matrix.sysroot_arch }}_staging
102- CC="$CLANG --target=${{ matrix.clang_target }} --sysroot=$SYSROOT" \
103- CXX="$CLANG++ --target=${{ matrix.clang_target }} --sysroot=$SYSROOT" \
104- CGO_ENABLED=1 \
105- CGO_LDFLAGS="${{ steps.cgo-flags.outputs.flags }}" \
106- GOOS=linux \
107- GOARCH=${{ matrix.arch }} \
108- go test -c -o cronet.test .
82+ eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env --export)
83+ CGO_ENABLED=1 GOOS=linux GOARCH=${{ matrix.arch }} go test -c -o cronet.test .
10984 - name : Run test binary
11085 run : |
86+ eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env --export)
11187 if [ "${{ matrix.arch }}" != "amd64" ] && [ "${{ matrix.arch }}" != "386" ]; then
112- export QEMU_LD_PREFIX=$PWD/naiveproxy/src/out/sysroot-build/bullseye/bullseye_${{ matrix.sysroot_arch }}_staging
88+ export QEMU_LD_PREFIX
11389 fi
11490 ./cronet.test -test.v -test.run=TestEngineVersion
11591 - name : Build purego test binary
11692 if : matrix.arch == 'amd64' || matrix.arch == 'arm64'
11793 run : |
11894 cp lib/linux_${{ matrix.arch }}/libcronet.so .
119- CGO_ENABLED=0 \
120- GOOS=linux \
121- GOARCH=${{ matrix.arch }} \
122- go test -tags with_purego -c -o cronet.purego.test .
95+ CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.arch }} go test -tags with_purego -c -o cronet.purego.test .
12396 - name : Run purego test binary
12497 if : matrix.arch == 'amd64' || matrix.arch == 'arm64'
12598 run : |
12699 if [ "${{ matrix.arch }}" != "amd64" ]; then
127- export QEMU_LD_PREFIX=$PWD/naiveproxy/src/out/sysroot-build/bullseye/bullseye_${{ matrix.sysroot_arch }}_staging
100+ eval $(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env --export)
101+ export QEMU_LD_PREFIX
128102 fi
129103 export LD_LIBRARY_PATH=$PWD
130104 ./cronet.purego.test -test.v -test.run=TestEngineVersion
@@ -200,15 +174,11 @@ jobs:
200174 if : steps.build-cache.outputs.cache-hit != 'true'
201175 run : ccache -s
202176 - name : Package
203- run : go run ./cmd/build-naive --target=${{ matrix.target }} package
177+ run : go run ./cmd/build-naive --target=${{ matrix.target }} package --local
204178 - name : Build and run test binary
205- if : startsWith( matrix.target, 'darwin/')
179+ if : matrix.target == 'darwin/arm64'
206180 run : |
207- CGO_ENABLED=1 \
208- CGO_LDFLAGS="$(go run ./cmd/build-naive --target=${{ matrix.target }} cgo-flags)" \
209- GOOS=$(echo "${{ matrix.target }}" | cut -d/ -f1) \
210- GOARCH=$(echo "${{ matrix.target }}" | cut -d/ -f2) \
211- go test -c -o cronet.test .
181+ CGO_ENABLED=1 go test -c -o cronet.test .
212182 ./cronet.test -test.v -test.run=TestEngineVersion
213183 - uses : actions/upload-artifact@v4
214184 with :
@@ -343,26 +313,16 @@ jobs:
343313 if : steps.build-cache.outputs.cache-hit != 'true'
344314 run : ccache -s
345315 - name : Package
346- run : go run ./cmd/build-naive --target=android/${{ matrix.arch }} package
316+ run : go run ./cmd/build-naive --target=android/${{ matrix.arch }} package --local
347317 - name : Setup Android NDK
348318 uses : nttld/setup-ndk@v1
349319 id : setup-ndk
350320 with :
351321 ndk-version : r28
352- - name : Get CGO flags
353- id : cgo-flags
354- run : |
355- CGO_FLAGS=$(go run ./cmd/build-naive --target=android/${{ matrix.arch }} cgo-flags)
356- echo "CGO_FLAGS: $CGO_FLAGS"
357- echo "flags=$CGO_FLAGS" >> $GITHUB_OUTPUT
358322 - name : Build test binary
359323 run : |
360324 CC=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/${{ matrix.cc }} \
361- CGO_ENABLED=1 \
362- CGO_LDFLAGS="${{ steps.cgo-flags.outputs.flags }}" \
363- GOOS=android \
364- GOARCH=${{ matrix.arch }} \
365- go test -c -o cronet.test .
325+ CGO_ENABLED=1 GOOS=android GOARCH=${{ matrix.arch }} go test -c -o cronet.test .
366326 - uses : actions/upload-artifact@v4
367327 with :
368328 name : cronet-android-${{ matrix.arch }}
@@ -377,23 +337,7 @@ jobs:
377337 strategy :
378338 fail-fast : false
379339 matrix :
380- include :
381- - arch : amd64
382- cpu : x64
383- clang_target : x86_64-openwrt-linux-musl
384- openwrt_arch : x86_64
385- - arch : arm64
386- cpu : arm64
387- clang_target : aarch64-openwrt-linux-musl
388- openwrt_arch : aarch64
389- - arch : " 386"
390- cpu : x86
391- clang_target : i486-openwrt-linux-musl
392- openwrt_arch : i386_pentium4
393- - arch : arm
394- cpu : arm
395- clang_target : arm-openwrt-linux-musleabi
396- openwrt_arch : arm_cortex-a15_neon-vfpv4
340+ arch : [amd64, arm64, "386", arm]
397341 steps :
398342 - uses : actions/checkout@v4
399343 with :
@@ -435,7 +379,7 @@ jobs:
435379 if : steps.build-cache.outputs.cache-hit != 'true'
436380 run : ccache -s
437381 - name : Package
438- run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package
382+ run : go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl package --local
439383 - name : Cache toolchain
440384 uses : actions/cache@v4
441385 with :
@@ -450,23 +394,10 @@ jobs:
450394 run : |
451395 sudo apt update
452396 sudo apt install -y qemu-user-binfmt
453- - name : Get CGO flags
454- id : cgo-flags
455- run : |
456- CGO_FLAGS=$(go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl cgo-flags)
457- echo "CGO_FLAGS: $CGO_FLAGS"
458- echo "flags=$CGO_FLAGS" >> $GITHUB_OUTPUT
459397 - name : Build test binary
460398 run : |
461- CLANG=$PWD/naiveproxy/src/third_party/llvm-build/Release+Asserts/bin/clang
462- SYSROOT=$PWD/naiveproxy/src/out/sysroot-build/openwrt/23.05.5/${{ matrix.openwrt_arch }}
463- CC="$CLANG --target=${{ matrix.clang_target }} --sysroot=$SYSROOT" \
464- CXX="$CLANG++ --target=${{ matrix.clang_target }} --sysroot=$SYSROOT" \
465- CGO_ENABLED=1 \
466- CGO_LDFLAGS="${{ steps.cgo-flags.outputs.flags }}" \
467- GOOS=linux \
468- GOARCH=${{ matrix.arch }} \
469- go test -c -o cronet.test .
399+ 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 .
470401 - name : Run test binary
471402 continue-on-error : true # musl/QEMU test is flaky, don't block CI
472403 run : |
0 commit comments