Skip to content

Commit 3b77110

Browse files
CI: lint in separate workflow
1 parent 37b0ac5 commit 3b77110

2 files changed

Lines changed: 74 additions & 3 deletions

File tree

.github/workflows/lint.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Lint
2+
on: [pull_request, workflow_dispatch]
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
lint:
10+
name: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- os: ubuntu-latest
16+
compiler: g++
17+
- os: macOS-latest
18+
compiler: clang++
19+
runs-on: ${{ matrix.os }}
20+
timeout-minutes: 15
21+
defaults:
22+
run:
23+
shell: bash -l {0}
24+
env:
25+
CXX: "ccache ${{ matrix.compiler }}"
26+
CXXFLAGS: "-O2 -g"
27+
UV_NO_SYNC: "1"
28+
LD_LIBRARY_PATH: "/usr/local/lib"
29+
steps:
30+
# Setup environment
31+
- uses: actions/checkout@v5
32+
- name: Set up Python . . .
33+
uses: actions/setup-python@v6
34+
with:
35+
python-version-file: "pyproject.toml"
36+
- name: Install uv . . .
37+
uses: astral-sh/setup-uv@v6
38+
with:
39+
enable-cache: true
40+
- name: "Install libsemigroups_pybind11 dependencies . . ."
41+
run: uv sync --locked --no-install-project --no-dev --group lint
42+
- name: "Find the names of the Python files that will be linted"
43+
run: echo "PYTHON_FILES=$(uv run ruff check --show-files | grep '\.py$' | tr -s '\n' ' ')" >> $GITHUB_ENV
44+
45+
# Lint with ruff and cpplint
46+
- name: "Lint with ruff . . ."
47+
run: uv run ruff check
48+
- name: "Lint with cpplint . . ."
49+
run: uv run cpplint src/*.hpp src/*.cpp
50+
51+
# Build libsemigroups
52+
- name: "macOS only: Install libsemigroups dependencies . . ."
53+
if: ${{ matrix.os == 'macOS-latest' }}
54+
run: brew install autoconf automake libtool
55+
- name: "Setup ccache . . ."
56+
uses: Chocobo1/setup-ccache-action@v1
57+
with:
58+
update_packager_index: false
59+
install_ccache: true
60+
- name: "Install libsemigroups . . ."
61+
run: |
62+
git clone --depth 1 --branch main https://github.com/libsemigroups/libsemigroups.git
63+
cd libsemigroups
64+
./autogen.sh && ./configure CXX="$CXX" CXXFLAGS="$CXXFLAGS" --disable-hpcombi && sudo make install -j8
65+
ccache -s
66+
67+
# Build libsemigroups_pybind11
68+
- name: "Install libsemigroups_pybind11 . . ."
69+
run: uv sync --locked --all-extras --no-dev --group lint
70+
71+
# Lint with ruff and cpplint
72+
- name: "Lint with pylint . . ."
73+
run: uv run pylint $PYTHON_FILES

.github/workflows/tests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run tests and lint (GitHub libsemigroups)
1+
name: Run tests (GitHub libsemigroups)
22
on: [pull_request, workflow_dispatch]
33

44
concurrency:
@@ -62,5 +62,3 @@ jobs:
6262
run: uv run pytest
6363
- name: "Running doc tests . . ."
6464
run: uv run make doctest
65-
- name: "Running ruff, pylint and cpplint . . ."
66-
run: uv run make lint

0 commit comments

Comments
 (0)