Skip to content

Commit 96fd021

Browse files
author
Diptorup Deb
committed
Add new github actions to run C++ and Python code style checks.
1 parent 42a8bbe commit 96fd021

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# This is a workflow to format C/C++ sources with clang-format
2+
3+
name: C++ Code Style
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
pull_request:
9+
push:
10+
branches: [master]
11+
12+
jobs:
13+
formatting-check:
14+
name: clang-format
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Run clang-format style check for C/C++ programs.
19+
uses: jidicula/[email protected]
20+
with:
21+
clang-format-version: '11'
22+
check-path: 'dpctl-capi'
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This is a workflow to format Python code with black formatter
2+
3+
name: Python Code Style
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
pull_request:
9+
push:
10+
branches: [master]
11+
12+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
13+
jobs:
14+
# The isort job sorts all imports in .py, .pyx, .pxd files
15+
isort:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-python@v2
20+
- uses: jamescurtin/isort-action@master
21+
22+
black:
23+
# The type of runner that the job will run on
24+
runs-on: ubuntu-latest
25+
26+
# Steps represent a sequence of tasks that will be executed as part of the job
27+
steps:
28+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
29+
- uses: actions/checkout@v2
30+
# Set up a Python environment for use in actions
31+
- uses: actions/setup-python@v2
32+
33+
# Run black code formatter
34+
- uses: psf/[email protected]
35+
with:
36+
args: ". --check"
37+
38+
flake8:
39+
runs-on: ubuntu-latest
40+
41+
strategy:
42+
matrix:
43+
python-version: [3.7]
44+
45+
steps:
46+
- uses: actions/checkout@v2
47+
- name: Set up Python ${{ matrix.python-version }}
48+
uses: actions/setup-python@v2
49+
with:
50+
python-version: ${{ matrix.python-version }}
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install flake8
55+
- name: Lint with flake8
56+
uses: py-actions/flake8@v1

0 commit comments

Comments
 (0)