-
Notifications
You must be signed in to change notification settings - Fork 7
226 lines (198 loc) · 10.7 KB
/
main.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: CI
on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
# Packman
PM_PACKAGES_ROOT: ${{ github.workspace }}/packman-repo
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows - MSVC",
artifact: "windows-msvc.tar.xz",
os: windows-latest,
cc: "cl",
cxx: "cl",
build-type: "Release",
build-code: "Windows",
cache-type: "Windows",
generator: "Ninja Multi-Config",
coverage: "false",
}
- {
name: "Ubuntu - GCC",
artifact: "linux-gcc.tar.xz",
os: ubuntu-latest,
cc: "gcc-11",
cxx: "g++-11",
build-type: "Release",
build-code: "Ubuntu",
cache-type: "Linux",
generator: "Unix Makefiles",
coverage: "false",
}
- {
name: "AlmaLinux 8 - GCC",
artifact: "linux-gcc.tar.xz",
os: ubuntu-latest,
cc: "gcc-11",
cxx: "g++-11",
build-type: "Release",
build-code: "AlmaLinux8",
cache-type: "Linux",
generator: "Unix Makefiles",
coverage: "false",
}
steps:
- name: Removed unneeded packages to gain disk space (Unix)
if: runner.os != 'Windows'
run: |
df -h
sudo apt-get update
sudo apt remove google-chrome-stable x11-common xserver-common aspnetcore-runtime-6.0 aspnetcore-runtime-7.0 aspnetcore-runtime-8.0 aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 aspnetcore-targeting-pack-8.0 dotnet-apphost-pack-6.0 dotnet-apphost-pack-7.0 dotnet-apphost-pack-8.0 dotnet-host dotnet-hostfxr-6.0 dotnet-hostfxr-7.0 dotnet-hostfxr-8.0 dotnet-runtime-6.0 dotnet-runtime-7.0 dotnet-runtime-8.0 dotnet-runtime-deps-6.0 dotnet-runtime-deps-7.0 dotnet-runtime-deps-8.0 dotnet-sdk-6.0 dotnet-sdk-7.0 dotnet-sdk-8.0 dotnet-targeting-pack-6.0 dotnet-targeting-pack-7.0 dotnet-targeting-pack-8.0 eatmydata emacsen-common firebird3.0-common-doc firebird3.0-common firefox kubectl mercurial-common mercurial microsoft-edge-stable mssql-tools mysql-client-8.0 mysql-client-core-8.0 mysql-client mysql-common mysql-server-8.0 php8.1 postgresql-14
df -h
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: ilammy/msvc-dev-cmd@v1
- uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
# Tell Conan to look for or create its build folder (.conan) in the repository's root directory
# This is partly done to make the directory easily accessible to Docker builds
- name: Conan Set build directory (Unix)
if: runner.os != 'Windows'
run: echo "CONAN_USER_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV
# Disable short paths so that all packages are built in the same .conan directory
# This is safe to do since long paths are enabled on Windows Server 2022 in GitHub Actions
# See https://docs.conan.io/en/latest/reference/env_vars.html#conan-user-home-short
# See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
# See https://github.com/actions/runner-images/issues/1052#issuecomment-644212560
- name: Conan Set build directory (Windows)
if: runner.os == 'Windows'
run: |
echo "CONAN_USER_HOME=$env:GITHUB_WORKSPACE" >> $env:GITHUB_ENV
echo "CONAN_USER_HOME_SHORT=None" >> $env:GITHUB_ENV
# The -v{num} is a cache key buster because we were starting to use the same cache keys from previous tests
# Unfortunately github actions doesn't let you delete old caches so we have to work around it like this
- name: Conan Check cache
id: conan-cache
uses: actions/cache@v3
with:
path: ${{ env.CONAN_USER_HOME }}/.conan
key: conan-${{ matrix.config.name }}-${{ hashFiles('cmake/AddConanDependencies.cmake') }}-v3
- name: Packman Check cache
id: packman-cache
uses: actions/cache@v3
with:
path: ${{ env.PM_PACKAGES_ROOT }}
key: packman-${{ matrix.config.cache-type }}-${{ hashFiles('extern/nvidia/deps/kit-sdk.packman.xml', 'extern/nvidia/deps/target-deps.packman.xml') }}
- name: AlmaLinux Build with Docker
uses: ./.github/actions
if: matrix.config.name == 'AlmaLinux 8 - GCC'
with:
build-type: ${{ matrix.config.build-type }}
# Change the ownership from root to user for all files created by Docker in
# the Conan build directory so that the files can be cached without permission
# denied errors
- name: AlmaLinux Change Conan & Packman directory permissions
if: matrix.config.name == 'AlmaLinux 8 - GCC'
run: |
sudo chown -R $USER:$USER $CONAN_USER_HOME/.conan
sudo chown -R $USER:$USER $PM_PACKAGES_ROOT
- name: Install Linux dependencies
if: ${{ runner.os == 'Linux' && matrix.config.name != 'AlmaLinux 8 - GCC' }}
run: |
sudo apt update
sudo apt install -y doxygen clang-tidy-15 gcovr nvidia-driver-535
sudo pip3 install conan==1.63.0 black==23.1.0 flake8==6.0.0
# Could not figure out how to add Chocolatey libraries to the PATH automatically with refreshenv, so
# hardcoding their locations instead. Followed these instructions for adding to the PATH on PowerShell:
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
# Note that this is only a problem on CI, not with local builds
# Also requests is not installed by default on windows, but is expected by scripts/update_certs.py
- name: Install Windows dependencies
if: runner.os == 'Windows'
run: |
choco install -y conan --version 1.63.0
choco install -y llvm --version=15.0.7 --allow-downgrade
pip3 install black==23.1.0 flake8==6.0.0 requests
echo "C:/Program Files/conan/conan" >> $env:GITHUB_PATH
# Note: CMAKE_BUILD_TYPE is only used by Linux. It is ignored for Windows.
# Note: CMAKE_CONFIGURATION_TYPES is used by Windows to generate a single configuration for Release since we don't need Debug, RelWithDebugInfo, and MinSizeRel on CI. It is ignored for Linux.
- name: Configure
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake -B build -D Python3_EXECUTABLE=python3 -D CESIUM_OMNI_ENABLE_TESTS=OFF -D CESIUM_OMNI_ENABLE_COVERAGE=${{ matrix.config.coverage}} -D CMAKE_C_COMPILER=${{ matrix.config.cc }} -D CMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -D CMAKE_BUILD_TYPE=${{ matrix.config.build-type }} -D CMAKE_CONFIGURATION_TYPES=${{ matrix.config.build-type }} -G "${{ matrix.config.generator }}"
# Change the ownership from root to user for all files in the Conan cache so
# that DLLs can be used without permission denied errors
- name: Windows Change Conan directory permissions
if: runner.os == 'Windows'
run: |
$Path = "${{ env.CONAN_USER_HOME }}/.conan"
$Username = "$env:UserName"
$Acl = Get-Acl -Path $Path
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($Username, 'FullControl', 'ContainerInherit,ObjectInherit', 'None', 'Allow')
$Acl.SetAccessRule($Ar)
- name: Check C/C++ Formatting
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --build build --target clang-format-check-all --config ${{ matrix.config.build-type }}
- name: Check Python Formatting
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: black --check --diff .
- name: Check Python Linting
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: flake8
- name: Build
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --build build --config ${{ matrix.config.build-type }} --parallel ${{ steps.cpu-cores.outputs.count }}
- name: Coverage
if: matrix.config.coverage == 'true'
run: cmake --build build --target generate-coverage --config ${{ matrix.config.build-type }}
- name: Documentation
# Currently disabled for Windows because `choco install doxygen.install` is flaky
if: ${{ matrix.config.name != 'AlmaLinux 8 - GCC' && runner.os != 'Windows' }}
run: cmake --build build --target generate-documentation --config ${{ matrix.config.build-type }}
- name: Install (Default/Kit)
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --install build --config ${{ matrix.config.build-type }}
- name: Install (Library)
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --install build --config ${{ matrix.config.build-type }} --prefix install-library --component library
- name: Package
if: matrix.config.name != 'AlmaLinux 8 - GCC'
run: cmake --build build --target package --config ${{ matrix.config.build-type }}
- name: Capture Git info (not Windows)
if: runner.os != 'Windows'
shell: bash
run: |
echo "branch=${{ github.ref_name }}" >> $GITHUB_ENV
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "us_date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "zip_name=$(find . -maxdepth 2 -type f -name "CesiumGS-cesium-omniverse*.zip" -exec basename {} \;)" >> $GITHUB_ENV
- name: Capture Git info (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
echo "branch=${{ github.ref_name }}" >> $env:GITHUB_ENV
echo "sha_short=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV
echo "us_date=$(Get-Date -Format "yyyy-MM-dd")" >> $env:GITHUB_ENV
echo "zip_name=$(Get-ChildItem -Path build/CesiumGS-cesium-omniverse*.zip -Name)" >> $env:GITHUB_ENV
- name: Capture AWS secrets
uses: aws-actions/configure-aws-credentials@v2
env:
AWS_S3_USERNAME: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_S3_PASSWORD: ${{ secrets.AWS_SECRET_KEY_ID }}
with:
aws-access-key-id: ${{ env.AWS_S3_USERNAME }}
aws-secret-access-key: ${{ env.AWS_S3_PASSWORD }}
aws-region: us-east-1
- name: Upload to S3
if: ${{ matrix.config.name == 'AlmaLinux 8 - GCC' || runner.os == 'Windows' }}
run: |
aws s3 cp build/${{ env.zip_name }} s3://cesium-builds/cesium-omniverse/${{ env.branch }}/${{ env.us_date }}/${{ env.sha_short }}/${{ matrix.config.build-code }}/