Skip to content

Commit 3a3df3f

Browse files
committed
add additional linters
1 parent 849105a commit 3a3df3f

4 files changed

Lines changed: 48 additions & 23 deletions

File tree

.github/workflows/build-with-clang.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ jobs:
6565
- name: Build mkl_umath
6666
run: |
6767
source ${{ env.ONEAPI_ROOT }}/setvars.sh
68-
echo $CMPLR_ROOT
69-
export CC=$CMPLR_ROOT/bin/icx
68+
echo "$CMPLR_ROOT"
69+
export CC="$CMPLR_ROOT/bin/icx"
7070
export CFLAGS="${CFLAGS} -fno-fast-math -O2"
7171
pip install . --no-build-isolation --no-deps --verbose
7272

.github/workflows/conda-package.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,22 @@ jobs:
4545
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
4646
4747
- name: Add conda to system path
48-
run: echo $CONDA/bin >> $GITHUB_PATH
48+
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
4949

5050
- name: Install conda-build
5151
run: conda install conda-build
5252

5353
- name: Build conda package
5454
run: |
55-
CHANNELS="-c https://software.repos.intel.com/python/conda -c conda-forge --override-channels"
56-
VERSIONS="--python ${{ matrix.python }}"
57-
TEST="--no-test"
58-
echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> $GITHUB_ENV
55+
CHANNELS=(-c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
56+
VERSIONS=(--python "${{ matrix.python }}")
57+
TEST=(--no-test)
58+
echo "CONDA_BLD=${CONDA}/conda-bld/linux-64" >> "$GITHUB_ENV"
5959
6060
conda build \
61-
$TEST \
62-
$VERSIONS \
63-
$CHANNELS \
61+
"${TEST[@]}" \
62+
"${VERSIONS[@]}" \
63+
"${CHANNELS[@]}" \
6464
conda-recipe
6565
6666
- name: Upload artifact
@@ -88,21 +88,21 @@ jobs:
8888
with:
8989
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
9090
- name: Add conda to system path
91-
run: echo $CONDA/bin >> $GITHUB_PATH
91+
run: echo "$CONDA/bin" >> "$GITHUB_PATH"
9292
- name: Install conda-build
9393
run: conda install conda-build
9494
- name: Create conda channel
9595
run: |
96-
mkdir -p $GITHUB_WORKSPACE/channel/linux-64
97-
mv ${PACKAGE_NAME}-*.conda $GITHUB_WORKSPACE/channel/linux-64
98-
conda index $GITHUB_WORKSPACE/channel
96+
mkdir -p "$GITHUB_WORKSPACE/channel/linux-64"
97+
mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64"
98+
conda index "$GITHUB_WORKSPACE/channel"
9999
# Test channel
100-
conda search $PACKAGE_NAME -c $GITHUB_WORKSPACE/channel --override-channels
100+
conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels
101101
102102
- name: Collect dependencies
103103
run: |
104-
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
105-
conda create -n test_mkl_umath $PACKAGE_NAME python=${{ matrix.python }} $CHANNELS --only-deps --dry-run > lockfile
104+
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
105+
conda create -n test_mkl_umath "$PACKAGE_NAME" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile
106106
- name: Display lockfile
107107
run: cat lockfile
108108

@@ -124,20 +124,20 @@ jobs:
124124
125125
- name: Install mkl_umath
126126
run: |
127-
CHANNELS="-c $GITHUB_WORKSPACE/channel ${{ env.CHANNELS }}"
128-
conda create -n test_mkl_umath python=${{ matrix.python }} $PACKAGE_NAME pytest $CHANNELS
127+
CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c "https://software.repos.intel.com/python/conda" -c "conda-forge" --override-channels)
128+
conda create -n test_mkl_umath "python=${{ matrix.python }}" "$PACKAGE_NAME" pytest "${CHANNELS[@]}"
129129
# Test installed packages
130130
conda list -n test_mkl_umath
131131
132132
- name: Smoke test
133133
run: |
134-
source $CONDA/etc/profile.d/conda.sh
134+
source "$CONDA/etc/profile.d/conda.sh"
135135
conda activate test_mkl_umath
136136
python -c "import mkl_umath, numpy as np; mkl_umath.use_in_numpy(); np.sin(np.linspace(0, 1, num=10**6));"
137137
138138
- name: Run tests
139139
run: |
140-
source $CONDA/etc/profile.d/conda.sh
140+
source "$CONDA/etc/profile.d/conda.sh"
141141
conda activate test_mkl_umath
142142
pytest -v --pyargs ${{ env.PACKAGE_NAME }}
143143
@@ -182,7 +182,7 @@ jobs:
182182
- name: Store conda paths as envs
183183
shell: bash -l {0}
184184
run: |
185-
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> $GITHUB_ENV
185+
echo "CONDA_BLD=$CONDA/conda-bld/win-64/" | tr "\\\\" '/' >> "$GITHUB_ENV"
186186
187187
- name: Install conda build
188188
run: |

.github/workflows/pre-commit.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: pre-commit
33
on:
44
pull_request:
55
push:
6-
branches: [master]
6+
branches: [main]
77

88
permissions: read-all
99

@@ -27,5 +27,12 @@ jobs:
2727
codespell
2828
pylint
2929
30+
- name: Set up clang-format
31+
run: |
32+
sudo apt-get install -y clang-format-18
33+
sudo unlink /usr/bin/clang-format
34+
sudo ln -s /usr/bin/clang-format-18 /usr/bin/clang-format
35+
clang-format --version
36+
3037
- name: Run pre-commit checks
3138
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v6.0.0
44
hooks:
5+
# Git
6+
- id: check-added-large-files
7+
- id: no-commit-to-branch
8+
name: "ensure no direct commit to master/maintenance branches"
9+
args: [--branch, "master", --pattern, "maintenance/.*"]
10+
- id: check-case-conflict
11+
- id: check-illegal-windows-names
12+
# Contents
513
- id: check-ast
614
- id: check-builtin-literals
715
- id: check-case-conflict
@@ -102,3 +110,13 @@ repos:
102110
rev: 3.0.0
103111
hooks:
104112
- id: shellcheck
113+
114+
- repo: https://github.com/gitleaks/gitleaks
115+
rev: v8.30.0
116+
hooks:
117+
- id: gitleaks
118+
119+
- repo: https://github.com/rhysd/actionlint
120+
rev: v1.7.11
121+
hooks:
122+
- id: actionlint

0 commit comments

Comments
 (0)