Debian Codegraph @

.github/workflows/test-lang-java.yml

raw
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 #
8 # https://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 name: 'Test Java'
17 on:
18 workflow_dispatch:
19 push:
20 branches: [ main ]
21 pull_request:
22 branches: [ main ]
23 paths:
24 - .github/workflows/test-lang-java.yml
25 - lang/java/**
26 - pom.xml
27
28 defaults:
29 run:
30 working-directory: lang/java
31
32 concurrency:
33 group: ${{ github.workflow }}-${{ github.ref }}
34 cancel-in-progress: true
35
36 jobs:
37 test:
38 name: 'Java Test'
39 runs-on: ${{ matrix.os }}
40 strategy:
41 matrix:
42 os:
43 - ubuntu-latest
44 - ubuntu-24.04-arm
45 steps:
46 - name: 'Checkout sourcecode'
47 uses: actions/checkout@v5
48
49 - name: 'Cache Local Maven Repository'
50 uses: actions/cache@v4
51 with:
52 path: ~/.m2/repository
53 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
54 restore-keys: |
55 ${{ runner.os }}-maven-
56
57 - name: 'Setup Temurin JDK 11, 17 & 21'
58 uses: actions/setup-java@v5
59 with:
60 distribution: 'temurin'
61 java-version: |
62 11
63 17
64 21
65
66 - name: 'Setup Maven 3.9.6'
67 uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
68 with:
69 maven-version: 3.9.6
70
71 - name: 'Java Lint'
72 run: ./build.sh lint
73
74 - name: 'Java Test'
75 run: ./build.sh test
76
77 - name: 'Install Java Avro for reproducibility test'
78 working-directory: .
79 run: mvn -B clean install -PskipQuality
80
81 - name: 'Test Reproducible Build'
82 working-directory: .
83 run: mvn clean verify -PskipQuality artifact:compare
84
85 interop:
86 name: 'Java Interop'
87 runs-on: ${{ matrix.os }}
88 strategy:
89 matrix:
90 os:
91 - ubuntu-latest
92 - ubuntu-24.04-arm
93
94 steps:
95 - uses: actions/checkout@v5
96
97 - name: 'Cache Local Maven Repository'
98 uses: actions/cache@v4
99 with:
100 path: ~/.m2/repository
101 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
102 restore-keys: |
103 ${{ runner.os }}-maven-
104
105 - name: 'Setup Temurin JDK 11, 17 & 21'
106 uses: actions/setup-java@v5
107 with:
108 distribution: 'temurin'
109 java-version: |
110 11
111 17
112 21
113
114 - name: 'Setup Maven 3.9.6'
115 uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
116 with:
117 maven-version: 3.9.6
118
119 - name: 'Setup Python for Generating Input Data'
120 uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
121 with:
122 python-version: '3.12'
123
124 - name: 'Apt Install Compression Libs Required by Python'
125 run: |
126 sudo apt-get update && \
127 sudo apt-get install -qqy --no-install-recommends libbz2-dev \
128 liblzma-dev \
129 libsnappy-dev \
130 libzstd-dev
131
132 - name: 'Install Python Dependencies'
133 run: |
134 python3 -m pip install --break-system-packages --upgrade pip setuptools tox
135 python3 -m pip install --break-system-packages python-snappy zstandard
136
137 - name: 'Setup C# for Generating Interop Data'
138 uses: actions/setup-dotnet@v4
139 with:
140 dotnet-version: |
141 6.0.x
142 7.0.x
143 8.0.x
144
145 - name: 'Create Interop Data Directory'
146 working-directory: .
147 run: mkdir -p build/interop/data
148
149 - name: 'Generate Interop Data using Python'
150 working-directory: lang/py
151 run: ./build.sh interop-data-generate
152
153 - name: 'Generate Interop Data using C#'
154 working-directory: lang/csharp
155 run: ./build.sh interop-data-generate
156
157 - name: 'Install Java Avro for other tests'
158 working-directory: .
159 run: mvn -B install -PskipQuality
160
161 - name: 'Generate Interop Data using Java 11, 17 & 21'
162 working-directory: lang/java/interop-data-test
163 run: mvn -B verify -Pgenerate-test-data
164
165 - name: 'Run Interop Tests using Java 11, 17 & 21'
166 working-directory: lang/java/interop-data-test
167 run: mvn -B verify -Pcheck-test-data