File: test_java.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 (115 lines) | stat: -rw-r--r-- 4,750 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Java 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:
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: OpenJDK 8
            version: '8'
            image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
            targets: //java/... //java/internal:java_version
          - name: OpenJDK 11
            version: '11'
            image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
            targets: //java/... //java/internal:java_version
          - name: OpenJDK 17
            version: '17'
            image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:17-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
            targets: //java/... //java/internal:java_version
          - name: aarch64
            version: 'aarch64'
            image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17
            targets: //java/... //src/google/protobuf/compiler:protoc_aarch64_test

    name: Linux ${{ matrix.name }}
    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: ${{ matrix.image }}
          credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
          bazel-cache: java_linux/${{ matrix.version }}
          bazel: test ${{ matrix.targets }} --test_env=KOKORO_JAVA_VERSION

  linkage-monitor:
    name: Linux Linkage Monitor
    runs-on: ubuntu-latest
    steps:
      - name: Checkout pending changes
        uses: protocolbuffers/protobuf-ci/checkout@v2
        with:
          ref: ${{ inputs.safe-checkout }}
      - name: Run Linkage Monitor test
        uses: protocolbuffers/protobuf-ci/bazel-docker@v2
        with:
          image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:8-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
          credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
          bazel-cache: java_linux/8
          bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone

  protobuf-bom:
    name: Protobuf Maven BOM
    runs-on: ubuntu-latest
    steps:
    - name: Checkout pending changes
      uses: protocolbuffers/protobuf-ci/checkout@v2
      with:
        ref: ${{ inputs.safe-checkout }}
    - name: Build protoc
      id: build-protoc
      uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v2
      with:
        image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d
        credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
        architecture: linux-x86_64
    - name: Move protoc into place and clean up
      run: |
        mv ${{ steps.build-protoc.outputs.protoc }} protoc
        sudo rm -rf _build
    - name: Install snapshot version locally (not using generated pom.xml)
      run: |
        mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true
      working-directory: java
    - name: Generate pom.xml files from the template
      uses: protocolbuffers/protobuf-ci/bazel-docker@v2
      with:
        image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702
        credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
        bazel-cache: java_linux/11
        # protobuf-java and protobuf-java-util are the member of the BOM
        bash: |
          bazel build //java/core:core_mvn-pom //java/util:util_mvn-pom
          cp bazel-bin/java/core/core_mvn-pom.xml .
          cp bazel-bin/java/util/util_mvn-pom.xml .
    - name: Copy the generated pom.xml files to the local Maven repository
      shell: bash
      run: |
        LOCAL_MAVEN_GROUP_DIR="${HOME}/.m2/repository/com/google/protobuf"
        VERSION=$(grep "<version>" core_mvn-pom.xml | sed "s/<version>\(.*\)<\/version>/\1/" | xargs)
        cp core_mvn-pom.xml ${LOCAL_MAVEN_GROUP_DIR}/protobuf-java/${VERSION}/protobuf-java-${VERSION}.pom
        cp util_mvn-pom.xml ${LOCAL_MAVEN_GROUP_DIR}/protobuf-java-util/${VERSION}/protobuf-java-util-${VERSION}.pom
    - name: Clean up
      run: |
        sudo rm -rf _build
    - name: Validate Protobuf BOM
      uses: googleapis/java-cloud-bom/tests/validate-bom@fd56f04bb0bc581776a74031591f0b3bc5e7920a # v26.13.0
      with:
        bom-path: java/bom/pom.xml