Fix build errors and improve CI config #140
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
| name: Continuous Integration | |
| on: [push, pull_request] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| BUILD_TYPE: Release | |
| jobs: | |
| clang-format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: clang-format | |
| uses: jidicula/clang-format-action@d05cecd4a1a5b7e64c22f5a468456135a43f13f6 # v4.14.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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - 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@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 | |
| - 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 }} | |
| # Use fork owner's container registry in pull request CI | |
| # - this solution assumes the fork is <username>/SYCL-Samples | |
| - name: Set image name | |
| run: | | |
| IMAGE_NAME=${{ github.repository }} | |
| REPO_OWNER=${{ github.repository_owner }} | |
| ACTOR=${{ github.actor }} | |
| IMAGE_NAME=${IMAGE_NAME/$REPO_OWNER/$ACTOR} | |
| echo IMAGE_NAME=${IMAGE_NAME} >> $GITHUB_ENV | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.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@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| 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 --warning-suppression-mappings=${PWD}/ci/warning-suppresions.txt" | |
| -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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - 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 |