Skip to content

Periodic Format

Periodic Format #376

name: Periodic Format
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 1,3,6' # every day at midnight
jobs:
format:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
build-type: [Debug]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Init Submodules
uses: snickerbockers/submodules-init@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential xz-utils curl libx11-dev xorg-dev libglu1-mesa-dev
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm
key: llvm-13.0-${{ matrix.os }}
- name: Install LLVM (pre-built)
uses: KyleMayes/install-llvm-action@v1
with:
version: "13.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/Build
- name: Configure CMake
shell: bash
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/Build -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
- name: Format
shell: bash
run: cmake --build Build --config ${{ matrix.build-type }} --target ClangFormat
- name: Commit changes
id: commit
continue-on-error: true
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Applied clang-format" -a
- name: Push changes
if: steps.commit.outcome == 'success'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}