Skip to content

Commit 52ad667

Browse files
committed
fix(workflows): fix hashFiles pattern for macOS
1 parent a1795c3 commit 52ad667

8 files changed

Lines changed: 61 additions & 52 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@ jobs:
7272
update-environment: true
7373

7474
- name: Upgrade pip
75-
run: |
76-
python -m pip install --upgrade pip setuptools
75+
run: python -m pip install --upgrade pip setuptools
7776

7877
- name: Set __release__
7978
if: |
8079
startsWith(github.ref, 'refs/tags/') ||
8180
(github.event_name == 'workflow_dispatch' && github.event.inputs.task == 'build-and-publish')
82-
run: |
83-
python .github/workflows/set_release.py
81+
run: python .github/workflows/set_release.py
8482

8583
- name: Print version
8684
run: python setup.py --version
@@ -333,8 +331,7 @@ jobs:
333331
run: ls -lh dist/*
334332

335333
- name: Remove PyPI unsupported files
336-
run: |
337-
rm -f dist/*wasm*.whl
334+
run: rm -f dist/*wasm*.whl
338335

339336
- name: Upload artifacts
340337
uses: actions/upload-artifact@v5
@@ -367,13 +364,11 @@ jobs:
367364
update-environment: true
368365

369366
- name: Upgrade pip
370-
run: |
371-
python -m pip install --upgrade pip setuptools
367+
run: python -m pip install --upgrade pip setuptools
372368

373369
- name: Set __release__
374370
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
375-
run: |
376-
python .github/workflows/set_release.py
371+
run: python .github/workflows/set_release.py
377372

378373
- name: Print version
379374
run: python setup.py --version

.github/workflows/lint.yml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,15 @@ jobs:
5151
cache: pip
5252
cache-dependency-path: |
5353
pyproject.toml
54-
**/requirements.txt
54+
requirements*.txt
55+
*/requirements*.txt
5556
.pre-commit-config.yaml
5657
5758
- name: Upgrade pip
58-
run: |
59-
python -m pip install --upgrade pip setuptools
59+
run: python -m pip install --upgrade pip setuptools
6060

6161
- name: Install dependencies
62-
run: |
63-
python -m pip install wheel pybind11 -r docs/requirements.txt
62+
run: python -m pip install wheel pybind11 -r docs/requirements.txt
6463

6564
- name: Install nightly pybind11
6665
shell: bash
@@ -75,52 +74,40 @@ jobs:
7574
python -m pip install --force-reinstall 'pybind11 @ git+https://github.com/pybind/pybind11.git#egg=pybind11'
7675
7776
- name: Install OpTree
78-
run: |
79-
python -m pip install -v --no-build-isolation --editable '.[lint]'
77+
run: python -m pip install -v --no-build-isolation --editable '.[lint]'
8078

8179
- name: pre-commit
82-
run: |
83-
make pre-commit
80+
run: make pre-commit
8481

8582
- name: clang-format
86-
run: |
87-
make clang-format
83+
run: make clang-format
8884

8985
- name: clang-tidy
90-
run: |
91-
make clang-tidy CMAKE_CXX_STANDARD=17
86+
run: make clang-tidy CMAKE_CXX_STANDARD=17
9287

9388
- name: cpplint
94-
run: |
95-
make cpplint
89+
run: make cpplint
9690

9791
- name: python-format
98-
run: |
99-
make python-format
92+
run: make python-format
10093

10194
- name: ruff
102-
run: |
103-
make ruff
95+
run: make ruff
10496

10597
- name: pylint
106-
run: |
107-
make pylint
98+
run: make pylint
10899

109100
- name: mypy
110-
run: |
111-
make mypy
101+
run: make mypy
112102

113103
- name: doctest
114-
run: |
115-
make doctest
104+
run: make doctest
116105

117106
- name: addlicense
118-
run: |
119-
make addlicense
107+
run: make addlicense
120108

121109
- name: docstyle
122-
run: |
123-
make docstyle
110+
run: make docstyle
124111

125112
- name: spelling
126113
run: |

.github/workflows/tests-with-pydebug.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,8 @@ jobs:
220220
id: pip-cache
221221
uses: actions/cache@v4
222222
with:
223-
path: |
224-
${{ env.PIP_CACHE_DIR }}
225-
key: pip-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}${{ matrix.python-abiflags }}-${{ hashFiles('pyproject.toml', '**/requirements.txt') }}
223+
path: ${{ env.PIP_CACHE_DIR }}
224+
key: pip-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}${{ matrix.python-abiflags }}-${{ hashFiles('pyproject.toml', 'requirements*.txt', '*/requirements*.txt') }}$
226225

227226
- name: Set up Environment
228227
shell: bash
@@ -250,8 +249,10 @@ jobs:
250249
"${PYTHON_EXE}" -m venv venv # PATH is already updated in step setup-pyenv
251250
echo "::group::Python executables"
252251
if [[ "${{ runner.os }}" != 'Windows' ]]; then
252+
source venv/bin/activate
253253
ls -alh venv/bin
254254
else
255+
source venv/Scripts/activate
255256
ls -alh venv/Scripts
256257
fi
257258
echo "::endgroup::"
@@ -316,6 +317,12 @@ jobs:
316317
github.event_name == 'pull_request' &&
317318
contains(github.event.pull_request.labels.*.name, 'test-with-nightly-pybind11')
318319
run: |
320+
if [[ "${{ runner.os }}" != 'Windows' ]]; then
321+
source venv/bin/activate
322+
else
323+
source venv/Scripts/activate
324+
fi
325+
319326
${{ env.PYTHON }} .github/workflows/set_setup_requires.py
320327
echo "::group::pyproject.toml"
321328
cat pyproject.toml
@@ -324,16 +331,36 @@ jobs:
324331
325332
- name: Test buildable without Python frontend
326333
if: runner.os != 'Windows'
334+
shell: bash
327335
run: |
336+
if [[ "${{ runner.os }}" != 'Windows' ]]; then
337+
source venv/bin/activate
338+
else
339+
source venv/Scripts/activate
340+
fi
341+
328342
make cmake-build PYTHON="${{ env.PYTHON }}" && make clean
329343
330344
- name: Install OpTree
345+
shell: bash
331346
run: |
347+
if [[ "${{ runner.os }}" != 'Windows' ]]; then
348+
source venv/bin/activate
349+
else
350+
source venv/Scripts/activate
351+
fi
352+
332353
${{ env.PYTHON }} -m pip install -v --editable '.[test]'
333354
334355
- name: Test with pytest
335356
shell: bash
336357
run: |
358+
if [[ "${{ runner.os }}" != 'Windows' ]]; then
359+
source venv/bin/activate
360+
else
361+
source venv/Scripts/activate
362+
fi
363+
337364
set -x
338365
ulimit -c unlimited
339366
ulimit -a

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ jobs:
8585
cache: pip
8686
cache-dependency-path: |
8787
pyproject.toml
88-
**/requirements.txt
88+
requirements*.txt
89+
*/requirements*.txt
8990
9091
- name: Set up Environment
9192
shell: bash
@@ -237,8 +238,7 @@ jobs:
237238
fi
238239
239240
- name: Install OpTree (with system CMake)
240-
run: |
241-
${{ env.PYTHON }} -m pip install -v --editable '.[test]'
241+
run: ${{ env.PYTHON }} -m pip install -v --editable '.[test]'
242242

243243
- name: Check installable with CMake from PyPI (with venv'ed CMake)
244244
shell: bash

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ repos:
3030
args: [--ignore-case]
3131
files: ^docs/source/spelling_wordlist\.txt$
3232
- repo: https://github.com/pre-commit/mirrors-clang-format
33-
rev: v21.1.5
33+
rev: v21.1.6
3434
hooks:
3535
- id: clang-format
3636
- repo: https://github.com/cpplint/cpplint
3737
rev: 2.0.2
3838
hooks:
3939
- id: cpplint
4040
- repo: https://github.com/astral-sh/ruff-pre-commit
41-
rev: v0.14.4
41+
rev: v0.14.6
4242
hooks:
4343
- id: ruff-check
4444
args: [--fix, --exit-non-zero-on-fix]

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
XuehaiPan@pku.edu.cn.
63+
[XuehaiPan@pku.edu.cn](mailto:XuehaiPan@pku.edu.cn).
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ make uninstall
4545

4646
We use several tools to secure code quality, including:
4747

48-
- Python code style: `black`, `isort`, `pylint`, `flake8`, `ruff`
48+
- Python code style: `ruff`, `isort`, `pylint`
4949
- Type hint check: `mypy`
5050
- C++ code style: `cpplint`, `clang-format`, `clang-tidy`
5151
- License: `addlicense`
@@ -80,7 +80,7 @@ You will need to install [`docker`](https://www.docker.com) first.
8080
Then run the following command:
8181

8282
```bash
83-
pip3 install --upgrade cibuildwheel
83+
python3 -m pip install --upgrade cibuildwheel
8484
8585
python3 -m cibuildwheel --platform=linux --output-dir=wheelhouse --config-file=pyproject.toml
8686
```

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ pip3 install git+https://github.com/metaopt/optree.git#egg=optree
5353
Or, clone this repo and install manually:
5454

5555
```bash
56-
git clone --depth=1 https://github.com/metaopt/optree.git
57-
cd optree
56+
git clone --depth=1 https://github.com/metaopt/optree.git && cd optree
5857

5958
pip3 install .
6059
```
@@ -68,6 +67,7 @@ export CMAKE_CXX_STANDARD="20" # C++17 is tested on Linux/macOS (C++20 is requi
6867
export OPTREE_CXX_WERROR="OFF"
6968
export _GLIBCXX_USE_CXX11_ABI="1"
7069
export pybind11_DIR="/path/to/custom/pybind11"
70+
7171
pip3 install .
7272
```
7373

0 commit comments

Comments
 (0)