From 222da8e5f0bed443bde0473dc4d5de3a1f76ef53 Mon Sep 17 00:00:00 2001 From: "Neil R. Spruit" Date: Fri, 15 Nov 2024 11:33:47 -0800 Subject: [PATCH] Add workflows for static builds Signed-off-by: Neil R. Spruit --- .github/workflows/build-multi-static.yml | 159 +++++++++++++++++++++++ .github/workflows/build-quick-static.yml | 49 +++++++ 2 files changed, 208 insertions(+) create mode 100644 .github/workflows/build-multi-static.yml create mode 100644 .github/workflows/build-quick-static.yml diff --git a/.github/workflows/build-multi-static.yml b/.github/workflows/build-multi-static.yml new file mode 100644 index 00000000..0921e8ad --- /dev/null +++ b/.github/workflows/build-multi-static.yml @@ -0,0 +1,159 @@ +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + +permissions: read-all + +defaults: + run: + shell: bash + +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 }} + steps: + - uses: actions/checkout@v4 + with: + clean: true + ref: ${{ github.event.pull_request.head.sha }} + - name: Set constants + id: const + run: | + cat >> ${GITHUB_OUTPUT} <- + ${{ 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} <> ${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 + id: build + run: | + mkdir build + docker run \ + --rm \ + --interactive \ + -v '${{ github.workspace }}':${MOUNT_TARGET} \ + -w ${MOUNT_TARGET}/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 + + cmake \ + ${{ matrix.os.name != 'windows' && ' \ + -G Ninja ' || ' ' + }}\ + ${{ matrix.arch == 'arm64' && ' \ + -D CMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ + -D CMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ + -D CMAKE_SYSTEM_PROCESSOR=aarch64 ' || ' ' + }}\ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_INSTALL_PREFIX=${{ matrix.target == 'install' && '../level-zero-install' || matrix.target == 'package' && '/usr' || '' }} \ + -D CPACK_OUTPUT_FILE_PREFIX=${MOUNT_TARGET}/level-zero-package \ + .. + + cmake --build . ${PARALLEL} --target ${{ matrix.target }} ${{ matrix.os.name == 'windows' && '--config Release' || '' }} + + ccache --show-stats + + EOF diff --git a/.github/workflows/build-quick-static.yml b/.github/workflows/build-quick-static.yml new file mode 100644 index 00000000..33c75000 --- /dev/null +++ b/.github/workflows/build-quick-static.yml @@ -0,0 +1,49 @@ +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + +permissions: read-all + +jobs: + build-linux: + if: github.repository_owner == 'oneapi-src' + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - uses: hendrikmuhs/ccache-action@v1 + - name: Build Loader on Latest Ubuntu + run: | + mkdir build + cd build + cmake \ + -D CMAKE_C_COMPILER_LAUNCHER=ccache \ + -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_L0_LOADER_TESTS=1 \ + .. + make -j$(nproc) + - env: + ZE_ENABLE_LOADER_DEBUG_TRACE: '1' + ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/lib' + working-directory: build + run: ctest -V + + build-windows: + if: github.repository_owner == 'oneapi-src' + runs-on: [windows-latest] + steps: + - uses: actions/checkout@v3 + - name: Build Loader on Latest Windows + run: | + mkdir build + cd build + cmake -D BUILD_L0_LOADER_TESTS=1 -D BUILD_STATIC=1 .. + cmake --build . --config Release + - env: + ZE_ENABLE_LOADER_DEBUG_TRACE: '1' + ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/bin/Release' + working-directory: build + run: ctest -C Release -V