diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 1ed3c6f6..5c25753c 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -1,6 +1,6 @@ name: Check formatting -on: [push, pull_request, workflow_dispatch] +on: [push, workflow_dispatch] jobs: check_formatting: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..4ced1d0d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,26 @@ +name: Linting and extra checks + +on: [push, workflow_dispatch] + +jobs: + run_lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up compiler + uses: egor-tensin/setup-clang@v1 + with: + version: latest + platform: x64 + - name: Get all source files + run: echo "SRC='$(find src -name "*.[ch]" -o -path src/flamingo -prune -type f)'" >> $GITHUB_ENV + - name: Build (with LSP output) + run: intercept-build sh build.sh + - name: Run clang-tidy + run: clang-tidy $SRC + - name: Make sure 'mkdir_wrapped' is used everywhere (except for once for 'fsutils.c') + run: | + if [ $(cat $SRC | grep "[^\"]mkdir(" | wc -l) -gt 1 ]; then + echo "Error: 'mkdir' is used in multiple places. Use 'mkdir_wrapped' instead." + exit 1 + fi