Skip to content

Commit

Permalink
build(deps-dev): bump ruff to 0.6.4 & update CI (#87)
Browse files Browse the repository at this point in the history
* build(deps-dev): bump ruff to 0.6.4

* docs(makefile): update make commands

* ci(github): update CI orchestration

* style(ruff): fix lint

* style(pre-commit): update precommit config

* style(ci): fix precommit hooks
  • Loading branch information
frgfm authored Sep 10, 2024
1 parent 2dc4d3d commit 162a7f9
Show file tree
Hide file tree
Showing 24 changed files with 272 additions and 251 deletions.
9 changes: 4 additions & 5 deletions .github/collect_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,13 @@ def get_nvidia_smi():
def get_platform():
if sys.platform.startswith("linux"):
return "linux"
elif sys.platform.startswith("win32"):
if sys.platform.startswith("win32"):
return "win32"
elif sys.platform.startswith("cygwin"):
if sys.platform.startswith("cygwin"):
return "cygwin"
elif sys.platform.startswith("darwin"):
if sys.platform.startswith("darwin"):
return "darwin"
else:
return sys.platform
return sys.platform


def get_mac_version(run_lambda):
Expand Down
35 changes: 35 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
time: "06:00"
timezone: "Europe/Paris"
groups:
gh-actions:
patterns:
- "*"
reviewers:
- "frgfm"
assignees:
- "frgfm"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
time: "06:00"
timezone: "Europe/Paris"
reviewers:
- "frgfm"
assignees:
- "frgfm"
allow:
- dependency-name: "ruff"
- dependency-name: "mypy"
- dependency-name: "pre-commit"
47 changes: 33 additions & 14 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
'module: crawler':
- torchscan/crawler.py
- changed-files:
- any-glob-to-any-file: torchscan/crawler.py

'module: modules':
- torchscan/modules/*
- changed-files:
- any-glob-to-any-file: torchscan/modules/*

'module: process':
- torchscan/process/*
- changed-files:
- any-glob-to-any-file: torchscan/process/*

'module: utils':
- torchscan/utils.py
- changed-files:
- any-glob-to-any-file: torchscan/utils.py

'ext: docs':
- docs/*
- changed-files:
- any-glob-to-any-file: docs/*

'ext: scripts':
- scripts/*
- changed-files:
- any-glob-to-any-file: scripts/*

'ext: tests':
- tests/*
- changed-files:
- any-glob-to-any-file: tests/*

'topic: ci':
- .github/*

'topic: documentation':
- README.md
- CONTRIBUTING.md
- changed-files:
- any-glob-to-any-file: .github/*

'topic: docs':
- changed-files:
- any-glob-to-any-file:
- README.md
- CONTRIBUTING.md
- CODFE_OF_CONDUCT.md
- CITATION.cff
- LICENSE

'topic: build':
- setup.py
- pyproject.toml
- changed-files:
- any-glob-to-any-file:
- setup.py
- pyproject.toml

'topic: style':
- changed-files:
- any-glob-to-any-file: .pre-commit-config.yaml
6 changes: 3 additions & 3 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ changelog:
# NEW FEATURES
- title: New Features 🚀
labels:
- "type: new feature"
- "type: feat"
# BUG FIXES
- title: Bug Fixes 🐛
labels:
- "type: bug"
- "type: fix"
# IMPROVEMENTS
- title: Improvements
labels:
- "type: enhancement"
- "type: improvement"
# MISC
- title: Miscellaneous
labels:
Expand Down
4 changes: 1 addition & 3 deletions .github/verify_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ def parse_args():
)

parser.add_argument("pr", type=int, help="PR number")
args = parser.parse_args()

return args
return parser.parse_args()


if __name__ == "__main__":
Expand Down
44 changes: 20 additions & 24 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,51 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.8, 3.9, '3.10', 3.11]
python: [3.8, 3.9, '3.10', 3.11, 3.12]
exclude:
- os: macos-latest
python: 3.8
- os: macos-latest
python: 3.9
- os: macos-latest
python: '3.10'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e .
python -m pip install --upgrade uv
uv pip install --system -e .
- name: Import package
run: python -c "import torchscan; print(torchscan.__version__)"

pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine --upgrade
python -m pip install --upgrade uv
uv pip install --system setuptools wheel twine --upgrade
- run: |
python setup.py sdist bdist_wheel
twine check dist/*
conda:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.9"
python-version: "3.11"
- name: Install dependencies
shell: bash -el {0}
run: conda install -y conda-build conda-verify
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/doc-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
see-page-build-payload:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
architecture: x64
- name: check status
run: |
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,17 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"
python -m pip install --upgrade uv
uv pip install --system -e ".[docs]"
- name: Build documentation
run: cd docs && bash build.sh
Expand All @@ -35,12 +30,12 @@ jobs:
run: test -e docs/build/index.html || exit

- name: Install SSH Client 🔑
uses: webfactory/ssh-agent@v0.4.1
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}

- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
uses: JamesIves/github-pages-deploy-action@4
with:
BRANCH: gh-pages
FOLDER: 'docs/build'
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/pr-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ jobs:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install requests
run: pip install requests
- name: Process commit and find merger responsible for labeling
id: commit
run: echo "::set-output name=merger::$(python .github/verify_labels.py ${{ github.event.pull_request.number }})"
- name: Comment PR
uses: actions/github-script@0.3.0
uses: actions/github-script@7.0.1
if: ${{ steps.commit.outputs.merger != '' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
31 changes: 13 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@ jobs:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-pypi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine --upgrade
python -m pip install --upgrade uv
uv pip install --system setuptools wheel twine --upgrade
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand All @@ -38,27 +33,27 @@ jobs:
runs-on: ubuntu-latest
needs: pypi
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11
architecture: x64
- name: Install package
run: |
python -m pip install --upgrade pip
pip install torchscan
python -m pip install --upgrade uv
uv pip install --system torchscan
python -c "import torchscan; print(torchscan.__version__)"
conda:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Miniconda setup
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: 3.11
- name: Install dependencies
shell: bash -el {0}
run: conda install -y conda-build conda-verify anaconda-client
Expand All @@ -83,7 +78,7 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
python-version: 3.11
auto-activate-base: true
- name: Install package
shell: bash -el {0}
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"
python -m pip install --upgrade uv
uv pip install --system -e ".[docs]"
- name: Build documentation
run: cd docs && bash build.sh
Expand Down
Loading

0 comments on commit 162a7f9

Please sign in to comment.