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