-
Notifications
You must be signed in to change notification settings - Fork 5
136 lines (114 loc) · 4.34 KB
/
ci.yml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Continuous Integration
on: [push, pull_request]
permissions:
contents: read
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BUILD_TYPE: Release
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: clang-format
uses: jidicula/clang-format-action@c74383674bf5f7c69f60ce562019c1c94bc1421a # v4.13.0
with:
clang-format-version: '17'
check-path: 'src'
fallback-style: 'Google'
include-regex: '^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(frag|vert))$'
build-container:
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.set_image_tag.outputs.image_tag }}
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Path filter
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
with:
filters: |
container:
- 'ci/Dockerfile'
- name: Set up Docker Buildx
if: steps.changes.outputs.container == 'true'
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Log in to the Container registry
if: steps.changes.outputs.container == 'true'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for the main branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},priority=5000
# use ref_name in all other cases
type=raw,value=${{github.ref_name}},priority=4000
- name: Build and push
if: steps.changes.outputs.container == 'true'
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
context: '{{defaultContext}}:ci'
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Set output image tag
id: set_image_tag
run: >
tags="${{ steps.meta.outputs.tags }}"
&& tags=${tags%% *}
&& image=${tags%:*}
&& tag="${{ steps.changes.outputs.container == 'true' && '${tags#*:}' || 'latest' }}"
&& echo "image_tag=${image}:${tag}"
&& echo "image_tag=${image}:${tag}" >> "$GITHUB_OUTPUT"
cmake-build:
needs: build-container
runs-on: ubuntu-latest
container:
image: ${{ needs.build-container.outputs.image_tag }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
submodules: "recursive"
- name: Configure CMake
run: >
cmake -B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_CXX_COMPILER=clang++
-DENABLE_GRAPHICS=ON
-DENABLE_SPIR=ON
-DENABLE_CUDA=ON -DCUDA_COMPUTE_CAPABILITY=80
-DENABLE_HIP=ON -DHIP_GFX_ARCH=gfx90a
-DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror'
-G Ninja
- name: Build
run: cmake --build ${{github.workspace}}/build -- -k 0
cmake-build-nographics:
runs-on: ubuntu-latest
container:
image: intel/oneapi-basekit:latest
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Configure CMake (no graphics)
run: >
cmake -B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_CXX_COMPILER=icpx
-DENABLE_GRAPHICS=OFF
-DENABLE_SPIR=ON -DENABLE_CUDA=OFF -DENABLE_HIP=OFF
-DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror'
- name: Build (no graphics)
run: cmake --build ${{github.workspace}}/build -- -k -j