add wrapper for other gtest functions #849
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
permissions: read-all | |
defaults: | |
run: | |
shell: bash | |
env: | |
TEST_GROUPS_ARRAY: '["perf", "conformance", "negative", "layer", "stress"]' | |
jobs: | |
config: | |
if: github.repository_owner == 'oneapi-src' | |
runs-on: ubuntu-latest | |
outputs: | |
short-sha: ${{ steps.const.outputs.short-sha }} | |
ref-slug: ${{ steps.const.outputs.ref-slug }} | |
groups: ${{ steps.const.outputs.groups }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
clean: true | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set constants | |
id: const | |
run: | | |
cat >> ${GITHUB_OUTPUT} <<EOF | |
short-sha=$(git rev-parse --short=7 ${GITHUB_SHA}) | |
ref-slug=$(echo ${{ github.ref_name }} | tr '/_' '-') | |
groups=${{ env.TEST_GROUPS_ARRAY }} | |
EOF | |
build-quick: | |
if: github.repository_owner == 'oneapi-src' | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check ./scripts/lzt_gtest_scan.py | |
run: | | |
python3 scripts/lzt_gtest_scan.py \ | |
--workspace_dir . | |
- uses: actions/checkout@v4 | |
with: | |
repository: oneapi-src/level-zero | |
path: level-zero | |
- run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libboost-all-dev \ | |
libpapi-dev \ | |
libpng-dev \ | |
libva-dev \ | |
clang \ | |
clang-format-14 | |
- uses: hendrikmuhs/ccache-action@v1 | |
- name: Build Loader | |
working-directory: level-zero | |
run: | | |
mkdir build | |
cd build | |
cmake \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
.. | |
make -j$(nproc) | |
sudo make install | |
- name: Build Tests | |
run: | | |
mkdir build | |
cd build | |
cmake \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
.. | |
../clang-format-patch.sh .. > clang_format_results.txt | |
if [[ -s ./clang_format_results.txt ]]; then | |
echo "Clang Format Check failed" | |
cat ./clang_format_results.txt | |
echo "<h3>clang-format</h3>" >> ${GITHUB_STEP_SUMMARY} | |
echo \`\`\` >> ${GITHUB_STEP_SUMMARY} | |
cat ./clang_format_results.txt >> ${GITHUB_STEP_SUMMARY} | |
echo \`\`\` >> ${GITHUB_STEP_SUMMARY} | |
exit 1 | |
else | |
echo "::notice::clang-format check succeeded" | |
fi | |
make -j$(nproc) install | |
- name: Check ./scripts/level_zero_report_utils.py | |
env: | |
ZE_ENABLE_NULL_DRIVER: 1 | |
LD_LIBRARY_PATH: ${{ github.workspace }}/level-zero/build/lib | |
run: | | |
python3 scripts/run_test_report.py \ | |
--run_test_sections all \ | |
--binary_dir ./build/out \ | |
--export_test_plan plan.csv | |
echo "::group::Test Plan" | |
cat plan.csv | |
echo "::endgroup::" | |
- name: Check that basic feature tests haven't changed | |
env: | |
ZE_ENABLE_NULL_DRIVER: 1 | |
LD_LIBRARY_PATH: ${{ github.workspace }}/level-zero/build/lib | |
run: | | |
python3 scripts/run_test_report.py \ | |
--run_test_features basic \ | |
--binary_dir ./build/out \ | |
--export_test_plan basic_features.csv | |
git diff --no-index --exit-code \ | |
<(sort basic_features_freeze.csv) \ | |
<(sort basic_features.csv) | |
build: | |
# Notes on formatting: | |
# | |
# GitHub Actions expressions ${{ ... }} are used wherever possible so the | |
# evaluation results are plainly visible in the web console. | |
# | |
# Note the mixed spaces and tabs in the heredocs, see the bash man page | |
# entry for <<- in the Here Documents section. This allows generated code to | |
# be indented for readability in the workflow output. | |
if: github.repository_owner == 'oneapi-src' | |
needs: [config, build-quick] | |
runs-on: ${{ matrix.os.name == 'windows' && 'windows-latest' || 'ubuntu-latest' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
{name: ubuntu, vmaj: 22, vmin: '04'}, | |
{name: ubuntu, vmaj: 24, vmin: '04'}, | |
{name: ubuntu, vmaj: 24, vmin: '10'}, | |
{name: sles, vmaj: 15, vmin: 2}, | |
{name: sles, vmaj: 15, vmin: 3}, | |
{name: sles, vmaj: 15, vmin: 4}, | |
{name: rhel, vmaj: 8, vmin: 6}, | |
{name: windows} | |
] | |
arch: [''] | |
env: | |
TEST_GROUPS: ${{ join(fromJSON(needs.config.outputs.groups), ' ') }} | |
MSYS_NO_PATHCONV: 1 | |
MOUNT_TARGET: ${{ matrix.os.name == 'windows' && 'C:/project' || '/project' }} | |
# -j breaks the Visual Studio configuration selection | |
PARALLEL: ${{ ! (matrix.os.name == 'windows') && '-j' || '' }} | |
ARCH_SUFFIX: ${{ matrix.arch != '' && format('_{0}', matrix.arch) || '' }} | |
steps: | |
- name: Set constants | |
id: const | |
env: | |
OS_STRING: >- | |
${{ matrix.os.name == 'windows' && 'windows' || | |
format('{0}-{1}.{2}', | |
matrix.os.name, | |
matrix.os.vmaj, | |
matrix.os.vmin | |
) | |
}} | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
run: | | |
cat >> ${GITHUB_OUTPUT} <<EOF | |
os-string=${OS_STRING} | |
image-name=ghcr.io/${{ github.repository }}/${OS_STRING} | |
ccache-dir=${CCACHE_DIR} | |
EOF | |
- uses: actions/checkout@v4 | |
with: | |
clean: true | |
fetch-depth: 0 | |
submodules: true | |
- name: Checkout loader | |
uses: actions/checkout@v4 | |
with: | |
repository: oneapi-src/level-zero | |
clean: true | |
path: ./level-zero | |
- name: Create Ccache directory | |
run: mkdir -p '${{ steps.const.outputs.ccache-dir }}' | |
- name: Ccache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.const.outputs.ccache-dir }} | |
key: ccache-${{ github.job }}-${{ steps.const.outputs.os-string }}${{ env.ARCH_SUFFIX }}-${{ github.sha }} | |
restore-keys: ccache-${{ github.job }}-${{ steps.const.outputs.os-string }}${{ env.ARCH_SUFFIX }}- | |
- name: Compute image name | |
run: echo "DOCKER_IMAGE=localhost/${{ github.repository }}/${{ steps.const.outputs.os-string }}" >> ${GITHUB_ENV} | |
- name: "Registry login: ghcr.io" | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | | |
docker login -u sys-lzdev --password-stdin ghcr.io | |
- name: Build image | |
run: | | |
docker info | |
docker build \ | |
${{ runner.os == 'Windows' && ' \ | |
--memory 16G ' || ' ' | |
}}\ | |
${{ matrix.os.vmaj != '' && format(' \ | |
--build-arg VMAJ={0} \ | |
--build-arg VMIN={1} ', matrix.os.vmaj, matrix.os.vmin) || ' ' | |
}}\ | |
--pull \ | |
--tag ${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \ | |
- < .github/docker/${{ matrix.os.name }}.Dockerfile | |
- name: Build loader | |
run: | | |
mkdir level-zero/build | |
docker run \ | |
--rm \ | |
--interactive \ | |
-v '${{ github.workspace }}':${MOUNT_TARGET} \ | |
-w ${MOUNT_TARGET}/level-zero/build \ | |
-e CCACHE_BASEDIR=${MOUNT_TARGET} \ | |
-e CCACHE_DIR=${MOUNT_TARGET}/ccache \ | |
-v '${{ steps.const.outputs.ccache-dir }}':${MOUNT_TARGET}/ccache \ | |
${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \ | |
bash -e -x <<-EOF | |
ccache --zero-stats | |
cmake \ | |
-G Ninja \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
${{ runner.os == 'Windows' && ' \ | |
-D USE_Z7=TRUE' | |
}} \ | |
-D CMAKE_INSTALL_PREFIX=${MOUNT_TARGET}/level-zero/install \ | |
.. | |
ninja -j $(nproc) install | |
ccache --show-stats | |
EOF | |
- name: Build | |
id: build | |
run: | | |
mkdir build | |
${{ matrix.coverity-build && 'mkdir cov' || '' }} | |
docker run \ | |
--rm \ | |
--interactive \ | |
-v '${{ github.workspace }}':${MOUNT_TARGET} \ | |
-w ${MOUNT_TARGET}/build \ | |
-e CCACHE_BASEDIR=${MOUNT_TARGET} \ | |
-e CCACHE_DIR=${MOUNT_TARGET}/ccache \ | |
-e MSYS_NO_PATHCONV=1 \ | |
-v '${{ steps.const.outputs.ccache-dir }}':${MOUNT_TARGET}/ccache \ | |
${{ matrix.coverity-build && format(' \ | |
-v {0}:{0} ', steps.coverity.outputs.install) || ' ' | |
}}\ | |
${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \ | |
bash -e -x <<-EOF | |
ccache --zero-stats | |
for group in ${TEST_GROUPS}; do | |
cmake \ | |
-G Ninja \ | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
${{ runner.os == 'Windows' && ' \ | |
-D USE_Z7=TRUE' || ' ' | |
}}\ | |
-D GROUP="/\${group}_tests" \ | |
-D CMAKE_PREFIX_PATH=${MOUNT_TARGET}/level-zero/install \ | |
-D REQUIRE_OPENCL_BENCHMARKS=yes \ | |
-D CMAKE_INSTALL_PREFIX=${MOUNT_TARGET}/level-zero-tests-\${group} \ | |
.. | |
cmake --build . -j --target install | |
done | |
ccache --show-stats | |
EOF |