-
Notifications
You must be signed in to change notification settings - Fork 12
91 lines (87 loc) · 3 KB
/
Copy pathut-cpp.yml
File metadata and controls
91 lines (87 loc) · 3 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
# 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: C++ 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-cpp:
strategy:
matrix:
include:
- os: ubuntu22
image: ghcr.io/facebookincubator/velox-dev:ubuntu-22.04
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-cpp-${{ matrix.os }}-ccache-${{github.sha}}
restore-keys: |
ut-cpp-${{ 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 '
set -euo pipefail
NUM_THREADS=$(nproc)
cmake -DCMAKE_BUILD_TYPE=Release -DVELOX4J_ENABLE_CCACHE=ON -DVELOX4J_BUILD_TESTING=ON -S src/main/cpp -B src/main/cpp/build
cmake --build src/main/cpp/build -j "$NUM_THREADS"
'
- name: Run UTs
run: |
docker exec test-container bash -c '
set -euo pipefail
cd src/main/cpp/build/test
ctest -V
'
- 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-cpp-${{ matrix.os }}-ccache-${{github.sha}}