-
Notifications
You must be signed in to change notification settings - Fork 12
107 lines (103 loc) · 3.94 KB
/
Copy pathut-java.yml
File metadata and controls
107 lines (103 loc) · 3.94 KB
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
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Java UT
on:
workflow_dispatch:
pull_request:
types: [ opened, reopened, synchronize ]
paths:
- '**/*'
push:
branches:
- 'main'
paths:
- '**/*'
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ut-java:
strategy:
matrix:
include:
- os: ubuntu22
image: ghcr.io/facebookincubator/velox-dev:ubuntu-22.04
- os: centos9
image: ghcr.io/facebookincubator/velox-dev:centos9
runs-on: ubuntu-latest
env:
CACHE_DIR: .ccache
CCACHE_MAXSIZE: 3000M
steps:
- uses: actions/checkout@v4
- name: Restore Ccache
uses: actions/cache/restore@v4
with:
path: '${{ github.workspace }}/${{ env.CACHE_DIR }}'
key: ut-java-${{ matrix.os }}-ccache-${{github.sha}}
restore-keys: |
ut-java-${{ matrix.os }}-ccache-
- name: Start Docker container
run: |
docker run --init -d --name test-container \
-e CCACHE_DIR=/velox4j/${{ env.CACHE_DIR }} \
-e CCACHE_MAXSIZE=${{ env.CCACHE_MAXSIZE }} \
-v ${{ github.workspace }}:/velox4j \
-w /velox4j \
${{ matrix.image }} sleep infinity
- name: Run setup script
run: |
docker exec test-container bash -c '
bash .github/workflows/scripts/common/setup-${{ matrix.os }}.sh
'
- name: Build C++ libraries
run: |
docker exec test-container bash -c '
./mvnw clean generate-resources
'
- name: Run UTs
run: |
docker exec test-container bash -c '
./mvnw clean test -Dskip.cpp.build
'
- name: Run UTs with Arrow 7.0.0 / Arrow 13.0.0
run: |
# This is a step testing the compatibility for Velox4J and low Arrow Java versions,
# so user can safely exclude the Arrow-Java transitive dependency introduced by Velox4J
# and depends on their own Arrow-Java instead.
# References about why we choose Arrow Java 7 / 13 for different Java versions:
# 1. https://github.com/openjdk/jdk/commit/a56598f5a534cc9223367e7faa8433ea38661db9
# 2. https://github.com/apache/arrow/pull/36370
docker exec test-container bash -c '
set -euo pipefail
JAVA_VERSION=$(./mvnw help:evaluate -Dexpression=java.version -q -DforceStdout)
JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | grep -oE "^[0-9]+")
echo "Detected Java version: $JAVA_VERSION (major=$JAVA_MAJOR_VERSION)"
if [ "$JAVA_MAJOR_VERSION" -ge 21 ]; then
./mvnw clean test -Dskip.cpp.build -Darrow.version=13.0.0
else
./mvnw clean test -Dskip.cpp.build -Darrow.version=7.0.0
fi
'
- name: Stop Docker container
if: always()
run: |
docker stop test-container
- name: Save Ccache
if: always()
uses: actions/cache/save@v4
with:
path: '${{ github.workspace }}/${{ env.CACHE_DIR }}'
key: ut-java-${{ matrix.os }}-ccache-${{github.sha}}