forked from numworks/epsilon
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.35 KB
/
linter.yml
File metadata and controls
50 lines (42 loc) · 1.35 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
name: Lint Code Base
on:
pull_request:
paths:
- '**.cpp'
- '**.c'
- '**.h'
- '**.py'
- '**.js'
- '**.cjs'
- '**.mjs'
- '**.ts'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Lint Code Base
runs-on: ubuntu-latest
steps:
- name: Fetch target branch and PR branch
uses: actions/checkout@v4
with:
fetch-depth: 200
- name: Find most recent ancestor of PR and target branch
id: common_ancestor
run: echo "commit_sha=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4
- name: Setup
run: python3 -m venv .venv && .venv/bin/pip3 install black
- name: Get a recent clang-format version
uses: numworks/setup-llvm@latest
# These are for prettier
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Node.js dependencies
run: npm install
- name: Lint files changed by PR
run: make format BASE=${{ steps.common_ancestor.outputs.commit_sha }} CXXFORMATARGS="--dry-run --Werror" PYTHON=python3 PYFORMATARGS="--check" JSFORMATARGS="--check"