From 2f4c20deb1e2c35920ae3e4bc1800e20a6f56a67 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 22 Aug 2023 12:53:41 -0700 Subject: [PATCH] Add upb test runs This change adds test runs for GCC, Windows, and Mac. The 32-bit ASAN test turned out to be somewhat difficult to migrate, so I left a TODO for that one. I made sure to give each build environment its own cache prefix, so that we don't end up with artifacts built by different toolchains conflicting with each other in the same cache. PiperOrigin-RevId: 559197655 --- .github/workflows/test_upb.yml | 68 ++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index c4187cd5df2c..7fdfddd67970 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -12,7 +12,7 @@ permissions: contents: read jobs: - linux: + linux-clang: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: @@ -23,10 +23,8 @@ jobs: - { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-@upb//benchmarks:benchmark -@upb//python/..." } - { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-@upb//benchmarks:benchmark -@upb//python/... -@upb//lua/..." } - { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-@upb//benchmarks:benchmark -@upb//python/..." } - include: - # Set defaults - - image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb - - targets: "@upb//..." + # TODO: b/297027295 - Add 32-bit ASAN test + name: ${{ matrix.config.name }} runs-on: ubuntu-latest @@ -38,8 +36,64 @@ jobs: - name: Run tests uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: - image: ${{ matrix.image }} + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: upb-bazel - bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.targets }} ${{ matrix.config.flags }} + bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 @upb//... ${{ matrix.config.flags }} exclude-targets: ${{ matrix.config.exclude-targets }} + + linux-gcc: + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + name: GCC Optimized + runs-on: ubuntu-latest + steps: + - name: Checkout pending changes + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + ref: ${{ inputs.safe-checkout }} + - name: Run tests + uses: protocolbuffers/protobuf-ci/bazel-docker@v2 + with: + image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:12.2-6.3.0-518b4fcd8d0ded2484c94f02e835526cacfdac2d" + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + bazel-cache: "upb-bazel-gcc" + bazel: test --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 -c opt @upb//... + + windows: + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + name: Windows + runs-on: windows-2019 + steps: + - name: Checkout pending changes + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + ref: ${{ inputs.safe-checkout }} + - name: Run tests + uses: protocolbuffers/protobuf-ci/bazel@v2 + with: + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + bazel-cache: "upb-bazel-windows" + bazel: test --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 @upb//upb/... @upb//upbc/... @upb//python/... @upb//protos/... @upb//protos_generator/... + + macos: + strategy: + fail-fast: false # Don't cancel all jobs if one fails. + matrix: + config: + - { name: "macOS", bazel-command: "test" } + - { name: "macOS ARM (build only)", bazel-command: "build", flags: "--cpu=darwin_arm64" } + name: macOS + runs-on: macos-12 + steps: + - name: Checkout pending changes + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + ref: ${{ inputs.safe-checkout }} + - name: Run tests + uses: protocolbuffers/protobuf-ci/bazel@v2 + with: + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + bazel-cache: "upb-bazel-macos" + bazel: ${{ matrix.config.bazel-command }} --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 ${{ matrix.config.flags }} @upb//...