From 2595c70b93b34d7326039a97e723d6e4fbc8d893 Mon Sep 17 00:00:00 2001 From: Lin Zhihao <59785146+LinZhihao-723@users.noreply.github.com> Date: Thu, 16 Jan 2025 09:34:12 -0500 Subject: [PATCH] ci: Extract linting checks from `build_wheels` into a standalone workflow; Configure the linting workflow to also run on macOS. (#126) --- .github/workflows/build_wheels.yml | 23 ----------- .github/workflows/lint.yml | 61 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 142cebe..fae1e1a 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -7,7 +7,6 @@ on: - ".gitmodules" - "CMakeLists.txt" - "clp_ffi_py/**" - - "lint-tasks.yml" - "pyproject.toml" - "README.md" - "requirements-dev.txt" @@ -20,7 +19,6 @@ on: - ".gitmodules" - "CMakeLists.txt" - "clp_ffi_py/**" - - "lint-tasks.yml" - "pyproject.toml" - "README.md" - "requirements-dev.txt" @@ -37,28 +35,7 @@ concurrency: cancel-in-progress: true jobs: - linters: - runs-on: "ubuntu-latest" - steps: - - uses: "actions/checkout@v4" - with: - submodules: "recursive" - - - uses: "actions/setup-python@v5" - with: - # NOTE: We resolve some of clang-tidy's IWYU violations using CPython 3.10's headers, so - # we need to use the same version of Python when running clang-tidy. - python-version: "3.10" - - - run: | - pip install --upgrade pip - - - run: "npm install -g @go-task/cli" - - - run: "task lint:check" - build_wheels: - needs: ["linters"] name: "Build ${{ matrix.build.name }}" runs-on: "${{ matrix.build.os }}" strategy: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..af7c2e8 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,61 @@ +name: "Lint" + +on: + pull_request: + paths: + - ".github/workflows/*.yml" + - ".gitmodules" + - "CMakeLists.txt" + - "clp_ffi_py/**" + - "pyproject.toml" + - "requirements-dev.txt" + - "src/**" + - "Taskfile.yml" + - "tests/**" + push: + paths: + - ".github/workflows/*.yml" + - ".gitmodules" + - "CMakeLists.txt" + - "clp_ffi_py/**" + - "pyproject.toml" + - "requirements-dev.txt" + - "src/**" + - "Taskfile.yml" + - "tests/**" + schedule: + # Run every Tuesday at 00:15 UTC (the 15 is to avoid periods of high load) + - cron: "15 0 * * 2" + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + # Cancel in-progress jobs for efficiency + cancel-in-progress: true + +jobs: + lint-check: + strategy: + matrix: + os: ["macos-latest", "ubuntu-latest"] + runs-on: "${{matrix.os}}" + steps: + - uses: "actions/checkout@v4" + with: + submodules: "recursive" + + - uses: "actions/setup-python@v5" + with: + # NOTE: We resolve some of clang-tidy's IWYU violations using CPython 3.10's headers, so + # we need to use the same version of Python when running clang-tidy. + python-version: "3.10" + + - run: | + pip install --upgrade pip + + - run: "npm install -g @go-task/cli" + + - if: "matrix.os == 'macos-latest'" + name: "Install coreutils (for md5sum)" + run: "brew install coreutils" + + - run: "task lint:check"