diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index faa6d9b..6e0e8ba 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,9 +7,14 @@ on: branches: [ "main" ] jobs: - build: + lint: runs-on: ubuntu-latest steps: + # Fixes: https://github.com/actions/checkout/issues/135 + - name: Set git to use LF. + run: | + git config --global core.autocrlf false + git config --global core.eol lf - uses: actions/checkout@v3 - name: Install dependencies. run: sudo apt-get install -y clang-format diff --git a/Makefile b/Makefile index a0cc02a..c030859 100644 --- a/Makefile +++ b/Makefile @@ -55,13 +55,12 @@ dockerun: $(QEMU) -drive format=raw,file=$(BUILD_DIR)/os_image check: - # For some reason, GitHub Actions seems to add carriage returns? - # @grep -RE "\r" source/ && echo "Found carriage returns in source files. Please run 'make format' to fix them." && exit 1 || exit 0 - find source/ -type f -name '*.c' -or -name '*.h' | xargs $(FORMAT) --dry-run --Werror + @grep -RE $$'\r' source/ && echo "Found carriage returns in source files. Please run 'make format' to fix them." && exit 1 || exit 0 + @find source/ -type f -name '*.c' -or -name '*.h' | xargs $(FORMAT) --dry-run --Werror && echo "All files are formatted correctly." || echo "Some files are not formatted correctly. Please run 'make format' to fix them." format: - find source -type f -name '*.c' -or -name '*.h' -or -name '*.asm' | xargs dos2unix - find source/ -type f -name '*.c' -or -name '*.h' | xargs $(FORMAT) + @find source -type f -name '*.c' -or -name '*.h' -or -name '*.asm' | xargs dos2unix > /dev/null 2>&1 && echo "Converted carriage returns to line feeds." + @find source/ -type f -name '*.c' -or -name '*.h' | xargs $(FORMAT) && echo "Formatted all files." clean: rm -rf $(BUILD_DIR)