Skip to content

Commit 4ea389c

Browse files
committed
🔄 synced local '.github/workflows/' with remote 'workflows/python/'
1 parent 8098ebb commit 4ea389c

File tree

4 files changed

+110
-0
lines changed

4 files changed

+110
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# .github/workflows/pre-commit.yml
2+
name: Pre-commit Checks
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x'
17+
cache: 'pip'
18+
- uses: pre-commit/[email protected]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .github/workflows/python-linting.yml
2+
name: Lint
3+
4+
on:
5+
push:
6+
branches: [ main, master ]
7+
pull_request:
8+
branches: [ main, master ]
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.x'
18+
cache: 'pip'
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install ruff black
23+
- name: Run Black
24+
run: black . --check -l 120
25+
- name: Run Ruff
26+
run: ruff check .
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# .github/workflows/python-publish.yml
2+
name: Publish to PyPI
3+
4+
on:
5+
release:
6+
types: [ published ]
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.x'
17+
cache: 'pip'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install build twine
22+
- name: Build package
23+
run: python -m build
24+
- name: Publish to PyPI
25+
env:
26+
TWINE_USERNAME: __token__
27+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
28+
run: twine upload dist/*
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .github/workflows/python-testing.yml
2+
name: Python Tests
3+
4+
on:
5+
push:
6+
branches: [main, master]
7+
pull_request:
8+
branches: [main, master]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ['3.8', '3.9', '3.10', '3.11']
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: 'pip'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pytest pytest-cov pytest-mock pytest-emoji
28+
pip install -e .
29+
- name: Run tests
30+
run: |
31+
pytest --cov=./ --cov-report=xml --emoji
32+
- name: Upload coverage to Codecov
33+
uses: codecov/codecov-action@v3
34+
with:
35+
file: ./coverage.xml
36+
fail_ci_if_error: true
37+
38+

0 commit comments

Comments
 (0)