Skip to content

Commit c3b4592

Browse files
authored
[Infra] Add clang-format check in GA
Summary: Add clang-format check in GA, and format updates Test Plan: - Reviewed-by: - Issue: -
1 parent 64b44f4 commit c3b4592

File tree

5 files changed

+45
-25
lines changed

5 files changed

+45
-25
lines changed

.github/workflows/check.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,47 +38,46 @@ jobs:
3838
- name: Install dependencies
3939
run: |
4040
python -m pip install --upgrade pip
41-
python -m pip install nox flake8
42-
- name: Lint with flake8
43-
run: |
44-
# Run line only once
45-
# stop the build if there are Python syntax errors or undefined names
46-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
47-
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
48-
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
41+
python -m pip install nox
4942
- name: Test with pytest
5043
run: |
5144
nox -s tests_multiple_conda
5245
53-
test-imports:
46+
test-twine:
5447
runs-on: ubuntu-latest
5548

5649
steps:
5750
- uses: actions/checkout@v2
58-
- uses: s-weigand/setup-conda@v1
59-
- run: conda --version
51+
- name: Set up Python
52+
uses: actions/setup-python@v2
6053
- name: Install dependencies
6154
run: |
6255
python -m pip install --upgrade pip
63-
python -m pip install nox
64-
- name: Test imports
56+
python -m pip install nox twine
57+
- name: Build sdist to test
58+
run: |
59+
nox -s build_sdist
60+
- name: Test with twine
6561
run: |
66-
nox -s test_import_third_party
62+
twine check dist/*.tar.gz
6763
68-
test-twine:
64+
check-format:
65+
name: Formatting Check
6966
runs-on: ubuntu-latest
70-
7167
steps:
7268
- uses: actions/checkout@v2
7369
- name: Set up Python
7470
uses: actions/setup-python@v2
7571
- name: Install dependencies
7672
run: |
7773
python -m pip install --upgrade pip
78-
python -m pip install nox twine
79-
- name: Build sdist to test
80-
run: |
81-
nox -s build_sdist
82-
- name: Test with twine
74+
python -m pip install flake8
75+
- name: Lint with flake8
8376
run: |
84-
twine check dist/*.tar.gz
77+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
78+
- name: Run clang-format style check
79+
uses: jidicula/[email protected]
80+
with:
81+
clang-format-version: '13'
82+
check-path: 'src/_cds'
83+
exclude-regex: '(clinic|pythoncapi_compat)'

.github/workflows/performance.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@ on:
44
push:
55
branches: [ main ]
66

7-
87
jobs:
8+
test-import:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: s-weigand/setup-conda@v1
14+
- run: conda --version
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install --upgrade pip
18+
python -m pip install nox
19+
- name: Test import third-party packages
20+
run: |
21+
nox -s test_import_third_party
22+
923
perf-import:
1024
runs-on: ubuntu-latest
1125

@@ -17,6 +31,6 @@ jobs:
1731
run: |
1832
python -m pip install --upgrade pip
1933
python -m pip install nox pyperf
20-
- name: Run performance test
34+
- name: Perf importing third-party packages
2135
run: |
2236
sh scripts/perf_import.sh

src/_cds/hashtable.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#include "lookup_table.h"
2+
3+
#if PYCDS_HASHTABLE
14

25
#include "hashtable.h"
36

@@ -150,3 +153,5 @@ hashtable_destroy(hashtable_t *ht)
150153
free(ht->buckets);
151154
free(ht);
152155
}
156+
157+
#endif

src/_cds/lookup_table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
table *
77
PyCDS_Table_New()
88
{
9-
table* t = calloc(1, sizeof(table));
9+
table *t = calloc(1, sizeof(table));
1010
#if IS_HASHTABLE && CPYTHON_HASHTABLE
1111
t->pyHashtable = _Py_hashtable_new(_Py_hashtable_hash_ptr,
1212
_Py_hashtable_compare_direct);

src/_cds/lookup_table.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#include <Python.h>
1212
#if PY_VERSION_HEX >= 0x03090000
1313
#define CPYTHON_HASHTABLE 1
14+
#define PYCDS_HASHTABLE 0
1415
#else
16+
#define CPYTHON_HASHTABLE 0
1517
#define PYCDS_HASHTABLE 1
1618
#endif
1719
#endif

0 commit comments

Comments
 (0)