-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (170 loc) · 4.97 KB
/
main.yml
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: 项目CI/CD
on:
push:
branches:
- master
- develop
tags:
- "v*"
pull_request:
branches:
- master
- develop
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.10"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Git LFS
shell: pwsh
run: |
if ($env:RUNNER_OS -eq "Linux") {
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
} elseif ($env:RUNNER_OS -eq "macOS") {
brew install git-lfs
} elseif ($env:RUNNER_OS -eq "Windows") {
choco install git-lfs
}
git lfs install
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
pip install dynaconf
pip install tox
- name: Download models
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global credential.helper store
echo "https://USER:[email protected]" > ~/.git-credentials
git clone https://huggingface.co/liferecords/Telos.git docr/models
- name: Run tests
run: |
tox -e py
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox isort black pylint
- name: Run isort
run: isort . --check-only --diff
- name: Run black
run: black .
# - name: Run pylint
# run: pylint **/*.py --exit-zero --output-format=parseable --reports=y > pylint_report.txt
- name: Run linting
run: |
# tox -e isort
# tox -e pylint
# - name: Upload pylint report
# uses: actions/upload-artifact@v2
# with:
# name: pylint-report
# path: pylint_report.txt
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Apply automatic formatting changes"
file_pattern: "*.py"
build:
needs: [test, linting]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade poetry
- name: Build package
run: poetry build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
doc-deploy:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- name: 设置Python
uses: actions/setup-python@v2
with:
python-version: '3.10' # 根据您的Python版本调整
- name: 安装依赖
run: |
pip install poetry
poetry install
pip install mkdocs-material mkdocs
- name: 构建文档
run: mkdocs build
- name: 部署到GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
publish_dir: ./site # MkDocs默认输出目录
pypi-publish:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
create-release:
needs: build
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false