Skip to content

Apply clang-format (#6) #6

Apply clang-format (#6)

Apply clang-format (#6) #6

Workflow file for this run

name: Continuous Integration
on: [push, pull_request]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BUILD_TYPE: Release
jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clang-format
uses: jidicula/[email protected]
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@v4
- name: Path filter
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
container:
- 'ci/Dockerfile'
- name: Set up Docker Buildx
if: steps.changes.outputs.container == 'true'
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
if: steps.changes.outputs.container == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
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@v5
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@v4
with:
submodules: "recursive"
- name: Configure CMake
run: >
cmake -B ${{github.workspace}}/build
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
-DCMAKE_CXX_COMPILER=clang++
-DENABLE_SPIR=ON -DENABLE_CUDA=OFF -DENABLE_HIP=OFF
-DCMAKE_CXX_FLAGS='-Wall -Wextra -Wpedantic -Werror'
-G Ninja
- name: Build
run: cmake --build ${{github.workspace}}/build -- -k 0