-
Notifications
You must be signed in to change notification settings - Fork 1
148 lines (129 loc) · 4.93 KB
/
ci-pipeline.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
137
138
139
140
141
142
143
144
145
146
147
148
name: CI Pipeline
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Determine ref
run: |
if [ -z "${{ github.head_ref }}" ]; then
echo "ref=${{ github.ref }}" >> $GITHUB_ENV
else
echo "ref=${{ github.head_ref }}" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.ref }}
- name: Install clang-format
run: |
sudo apt-get install -y clang-format-15
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100
sudo update-alternatives --set clang-format /usr/bin/clang-format-15
- name: Run clang-format
run: |
chmod +x ./format_sources.sh
./format_sources.sh
- name: Check for code format changes
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git add .
if ! git diff --cached --exit-code; then
git commit -m "Applied format changes."
git push origin HEAD:${{ env.ref }}
echo "Applied format changes."
else
echo "No formatting changes."
fi
build:
runs-on: ubuntu-latest
needs: format
strategy:
matrix:
compiler: ['gcc', 'clang', 'android-clang']
build_type: ['Debug', 'Release']
graphics_system: ['OpenGL', 'Vulkan']
steps:
- name: Determine ref
run: |
if [ -z "${{ github.head_ref }}" ]; then
echo "ref=${{ github.ref }}" >> $GITHUB_ENV
else
echo "ref=${{ github.head_ref }}" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.ref }}
- name: Install compiler
if: matrix.compiler == 'gcc'
run: |
sudo apt-get install -y gcc-12 g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 12
sudo update-alternatives --set gcc /usr/bin/gcc-12
sudo update-alternatives --set g++ /usr/bin/g++-12
- name: Install compiler
if: matrix.compiler == 'clang'
run: |
sudo apt-get install -y clang-15
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 100
sudo update-alternatives --set clang /usr/bin/clang-15
sudo update-alternatives --set clang++ /usr/bin/clang++-15
- name: Install Android SDK
if: matrix.compiler == 'android-clang'
run: |
sudo apt-get install -y openjdk-11-jdk wget unzip
wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip -O commandlinetools.zip
mkdir -p ~/android-sdk
unzip commandlinetools.zip -d ~/android-sdk/cmdline-tools
export ANDROID_HOME=$HOME/android-sdk
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
yes | sdkmanager --licenses
sdkmanager "platform-tools" "platforms;android-33" "ndk;26.1.10909125" "build-tools;34.0.0"
- name: Install build tools
run: |
sudo apt-get install -y cmake ninja-build
- name: Install dependencies
run: |
sudo apt-get install -y glslang-tools libx11-dev libgl1-mesa-dev libglu1-mesa-dev libxrender-dev libvulkan-dev libspirv-cross-c-shared-dev
wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.2/KTX-Software-4.3.2-Linux-x86_64.deb
sudo dpkg -i ./KTX-Software-4.3.2-Linux-x86_64.deb
- name: Build
if: matrix.compiler == 'gcc'
run: |
CC=gcc CXX=g++ cmake -B build -S . \
-DFASTCG_GRAPHICS_SYSTEM=${{ matrix.graphics_system }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build build
- name: Build
if: matrix.compiler == 'clang'
run: |
CC=clang CXX=clang++ cmake -B build -S . \
-DFASTCG_GRAPHICS_SYSTEM=${{ matrix.graphics_system }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build build
- name: Build
if: matrix.compiler == 'android-clang'
run: |
export ANDROID_HOME=$HOME/android-sdk
export NDKROOT=$ANDROID_HOME/ndk/26.1.10909125
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$NDKROOT/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=android-33 \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_ABI=arm64-v8a \
-DANDROID_STL=c++_static \
-DFASTCG_GRAPHICS_SYSTEM=${{ matrix.graphics_system }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build build