Skip to content

Commit

Permalink
ci: Extract linting checks from build_wheels into a standalone work…
Browse files Browse the repository at this point in the history
…flow; Configure the linting workflow to also run on macOS. (#126)
  • Loading branch information
LinZhihao-723 authored Jan 16, 2025
1 parent 631e54b commit 2595c70
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 23 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- ".gitmodules"
- "CMakeLists.txt"
- "clp_ffi_py/**"
- "lint-tasks.yml"
- "pyproject.toml"
- "README.md"
- "requirements-dev.txt"
Expand All @@ -20,7 +19,6 @@ on:
- ".gitmodules"
- "CMakeLists.txt"
- "clp_ffi_py/**"
- "lint-tasks.yml"
- "pyproject.toml"
- "README.md"
- "requirements-dev.txt"
Expand All @@ -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:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 2595c70

Please sign in to comment.