File: test_csharp.yml

package info (click to toggle)
protobuf 3.25.4-2
  • links: PTS
  • area: main
  • in suites:
  • size: 45,944 kB
  • sloc: cpp: 204,199; java: 87,622; ansic: 81,204; objc: 58,434; cs: 27,303; python: 22,799; php: 11,340; ruby: 8,637; pascal: 3,325; xml: 2,333; sh: 1,331; makefile: 538; lisp: 86; awk: 17
file content (89 lines) | stat: -rw-r--r-- 3,646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: C# Tests

on:
  workflow_call:
    inputs:
      safe-checkout:
        required: true
        description: "The SHA key for the commit we want to run over"
        type: string

permissions:
  contents: read

jobs:
  linux:
    name: Linux
    runs-on: ubuntu-latest
    steps:
      - name: Checkout pending changes
        uses: protocolbuffers/protobuf-ci/checkout@v2
        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/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

  windows:
    name: Windows
    runs-on: windows-2019
    steps:
      - name: Checkout pending changes
        uses: protocolbuffers/protobuf-ci/checkout@v2
        with:
          ref: ${{ inputs.safe-checkout }}

      - name: Setup dotnet
        uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
        with:
          dotnet-version: '6.0.x'

      - name: Build
        run: dotnet build csharp/src/Google.Protobuf.sln

      - name: Run Tests
        run: dotnet test csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj

  linux-aarch64:
    name: Linux aarch64
    runs-on: ubuntu-latest
    steps:
      - name: Checkout pending changes
        uses: protocolbuffers/protobuf-ci/checkout@v2
        with:
          ref: ${{ inputs.safe-checkout }}

      - name: Build protobuf C# tests under x86_64 docker image
        # Tests are built "dotnet publish" because we want all the dependencies to the copied to the destination directory
        # (we want to avoid references to ~/.nuget that won't be available in the subsequent docker run)
        uses: protocolbuffers/protobuf-ci/docker@v2
        with:
          image: mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim
          credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
          command: >-
            /bin/bash -cex '
            DOTNET_CLI_TELEMETRY_OPTOUT=true
            DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
            dotnet publish -c Release -f net6.0 /workspace/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj'

      - name: Use an actual aarch64 docker image to run protobuf C# tests with an emulator
        # "dotnet vstest" allows running tests from a pre-built project.
        # * mount the protobuf root as /work to be able to access the crosscompiled files
        # * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
        #   running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
        #   otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
        #   we just run map the user's home to a throwaway temporary directory
        uses: protocolbuffers/protobuf-ci/docker@v2
        with:
          image: mcr.microsoft.com/dotnet/sdk:6.0.100-bullseye-slim-arm64v8
          skip-staleness-check: true
          credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
          command: >-
            /bin/bash -cex '
            DOTNET_CLI_TELEMETRY_OPTOUT=true
            DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
            dotnet vstest /workspace/csharp/src/Google.Protobuf.Test/bin/Release/net6.0/publish/Google.Protobuf.Test.dll'