Skip to content

Commit 37da627

Browse files
committed
Enable testing and static analysis
1 parent 03d6f61 commit 37da627

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This workflow will upload a Python Package to PyPI when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
release-build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.x"
28+
29+
- name: Build release distributions
30+
run: |
31+
# NOTE: put your own distribution build steps here.
32+
python -m pip install build
33+
python -m build
34+
35+
- name: Upload distributions
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: release-dists
39+
path: dist/
40+
41+
pypi-publish:
42+
runs-on: ubuntu-latest
43+
needs:
44+
- release-build
45+
permissions:
46+
# IMPORTANT: this permission is mandatory for trusted publishing
47+
id-token: write
48+
49+
# Dedicated environments with protections for publishing are strongly recommended.
50+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/p/simple-repository-browser
54+
55+
steps:
56+
- name: Retrieve release distributions
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: release-dists
60+
path: dist/
61+
62+
- name: Publish release distributions to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
packages-dir: dist/

.github/workflows/python-test.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
test:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.11"]
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install pre-commit --editable .[test]
31+
- name: pre-commit run
32+
run: |
33+
pre-commit run -a
34+
- name: Test with pytest
35+
run: |
36+
python -m pytest .
37+
38+
static_analysis:
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
python-version: ["3.11"]
43+
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Set up Python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v3
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install --upgrade pip
55+
python -m pip install mypy --editable .[test]
56+
- name: mypy
57+
run: |
58+
python -m mypy -p simple_repository_browser

0 commit comments

Comments
 (0)