-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (126 loc) · 3.66 KB
/
Copy pathcheck_and_deploy.yml
File metadata and controls
138 lines (126 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Python Lint, Format, Test, Deploy
on:
push:
branches:
- "**"
pull_request:
release:
types: [published]
jobs:
test:
name: Lint, Check formatting, Static Type-Check, Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy pytest pytest-cov pytest-markdown-summary
pip install -e .
- name: Install pyproject.toml
run: pip install .
- name: Ruff lint
run: ruff check --output-format=github --target-version=py314
- name: Ruff format
run: ruff format --diff --target-version=py314
- name: MyPy
run: mypy myapp
- name: Run tests
run: |
mkdir summary
pytest --cov=myapp --cov-report=markdown-append:summary/coverage.md --markdown-summary-file=summary/summary.md
echo -e "# Summary\n" >> $GITHUB_STEP_SUMMARY
cat summary/summary.md >> $GITHUB_STEP_SUMMARY
echo -e "\n# Coverage\n" >> $GITHUB_STEP_SUMMARY
cat summary/coverage.md >> $GITHUB_STEP_SUMMARY
# TODO: uncomment if you want to automate deployment to TestPyPI and PyPI
# # we may build and publish to TestPyPI. We accept local versions rather than
# build_for_testpypi:
# name: Build project for TestPyPI
# runs-on: ubuntu-latest
# env:
# # TODO: replace MYAPP with the escaped project.name from pyproject.toml (upper-case everything, replace '.', '-' with '_', see PEP 503)
# SETUPTOOLS_SCM_OVERRIDES_FOR_MYAPP: '{local_scheme = "no-local-version-strict"}'
#
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
#
# steps:
# - uses: actions/checkout@v7
# with:
# fetch-depth: 0
#
# - uses: hynek/build-and-inspect-python-package@v2
#
# publish-to-test-pypi:
# name: Publish to TestPyPI
# runs-on: ubuntu-latest
# needs: [build_for_testpypi, test]
#
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
#
# environment:
# name: testpypi
#
# # TODO: change <myapp> to the package name you assigned for your PyPI project
# url: https://test.pypi.org/p/<myapp>
#
# permissions:
# id-token: write
#
# steps:
# - name: Download dist
# uses: actions/download-artifact@v6
# with:
# name: Packages
# path: dist
#
# - name: Publish
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
#
# # we may build and publish to PyPI
# build_for_pypi:
# name: Build project for PyPI
# runs-on: ubuntu-latest
#
# if: github.event_name == 'release'
#
# steps:
# - uses: actions/checkout@v7
# with:
# fetch-depth: 0
#
# - uses: hynek/build-and-inspect-python-package@v2
#
# publish-to-pypi:
# name: Publish to PyPI
# runs-on: ubuntu-latest
# needs: [build_for_pypi, test]
#
# if: github.event_name == 'release'
#
# environment:
# name: pypi
#
# # TODO: change <myapp> to the package name you assigned for your PyPI project
# url: https://pypi.org/p/<myapp>
# permissions:
# id-token: write
#
# steps:
# - name: Download dist
# uses: actions/download-artifact@v6
# with:
# name: Packages
# path: dist
#
# - name: Publish
# uses: pypa/gh-action-pypi-publish@release/v1
#