Skip to content

Commit

Permalink
CI: minify pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 18, 2024
1 parent 224eba0 commit b2d3042
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 38 deletions.
47 changes: 9 additions & 38 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,16 @@ on:
pull_request:
schedule: [{cron: '30 23 * * 6'}] # M H d m w (Sat at 23:30)
jobs:
check:
clang-format:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: dependencies
run: |
pip install -U pre-commit
sudo apt-get install -yqq clang-format
- uses: reviewdog/action-setup@v1
- if: github.event_name == 'push' || github.event_name == 'pull_request'
name: comment
run: |
if [[ $EVENT == pull_request ]]; then
REPORTER=github-pr-review
else
REPORTER=github-check
fi
pre-commit run -a todo | reviewdog -efm="%f:%l: %m" -name=TODO -tee -reporter=$REPORTER -filter-mode nofilter
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=$REPORTER -filter-mode nofilter
pre-commit run -a mypy | reviewdog -efm="%f:%l: %m" -name=mypy -tee -reporter=$REPORTER -filter-mode nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT: ${{ github.event_name }}
- run: pre-commit run -a --show-diff-on-failure
with: {python-version: '3.x'}
- run: sudo apt-get install -yqq clang-format
- uses: pre-commit/[email protected]
with: {extra_args: --run-all clang-format}
test:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: py${{ matrix.python }}
Expand All @@ -47,8 +23,7 @@ jobs:
python: [3.7, 3.11]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
with: {fetch-depth: 0}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
Expand All @@ -67,8 +42,7 @@ jobs:
python: [3.7, 3.11]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
with: {fetch-depth: 0}
- name: Run setup-python
run: setup-python -p${{ matrix.python }} 'cuda-version<12' 'cupy<13'
- name: pip install -U -e .[dev]
Expand All @@ -84,18 +58,15 @@ jobs:
needs: [check, test, cuda]
name: PyPI Deploy
environment: pypi
permissions:
contents: write
id-token: write
permissions: {contents: write, id-token: write}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || github.token }}
- uses: actions/setup-python@v5
with:
python-version: '3.x'
with: {python-version: '3.x'}
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ci: {skip: [clang-format]}
default_language_version:
python: python3
repos:
Expand Down

0 comments on commit b2d3042

Please sign in to comment.