diff --git a/.github/workflows/test_csharp.yml b/.github/workflows/test_csharp.yml index 01398982c8..26d974102a 100644 --- a/.github/workflows/test_csharp.yml +++ b/.github/workflows/test_csharp.yml @@ -20,13 +20,31 @@ jobs: uses: protocolbuffers/protobuf-ci/checkout@v2 with: ref: ${{ inputs.safe-checkout }} + + # TODO Run this with Bazel once codegen is handled properly. - name: Run tests + uses: protocolbuffers/protobuf-ci/docker@v2 + with: + image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:3.1.415-6.0.100-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + entrypoint: /bin/bash + command: >- + -c " + cd csharp && + dotnet restore src/Google.Protobuf.sln && + dotnet build -c Release src/Google.Protobuf.sln && + dotnet test -c Release -f net6.0 src/Google.Protobuf.Test/Google.Protobuf.Test.csproj" + + - name: Clear bazel between docker instances + run: sudo rm -rf _build + + - name: Run conformance tests uses: protocolbuffers/protobuf-ci/bazel-docker@v2 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/csharp:3.1.415-6.0.100-66964dc8b07b6d1fc73a5cc14e59e84c1c534cea credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: csharp_linux - bazel: test //csharp/... --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel + bazel: test //csharp:conformance_test --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=/home/bazel windows: name: Windows @@ -42,11 +60,22 @@ jobs: with: dotnet-version: '6.0.x' - - name: Build - run: dotnet build csharp/src/Google.Protobuf.sln + # Workaround for incompatibility between gcloud and windows-2019 runners. + - name: Install Python + uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4.7.0 + with: + python-version: '3.9' + - name: Use custom python for gcloud + run: echo "CLOUDSDK_PYTHON=${Python3_ROOT_DIR}\\python3" >> $GITHUB_ENV + shell: bash - - name: Run Tests - run: dotnet test csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + - name: Run tests + uses: protocolbuffers/protobuf-ci/bash@v2 + with: + credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} + command: | + dotnet build csharp/src/Google.Protobuf.sln + dotnet test csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj linux-aarch64: name: Linux aarch64