-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (98 loc) · 3.18 KB
/
ci.yaml
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
POETRY_VERSION: 1.8.3
jobs:
build:
name: poetry-build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.9"]
defaults:
run:
shell: bash -l {0}
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for pushing data to the
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of rye
uses: eifinger/setup-rye@v3
- name: Install dependencies
run: |
rye sync --no-lock
- name: type check
run: |
rye run mypy src/ridgeplot
- name: format check
run: |
rye run pre-commit run --all-files --show-diff-on-failure
- name: Test with pytest
run: |
rye test -- -l -rPap -vvv -p no:warnings --cov
- uses: py-cov-action/python-coverage-comment-action@v3
id: coverage_comment
if: ${{ matrix.python-version }} == "3.9"
with:
GITHUB_TOKEN: ${{ github.token }}
ANNOTATE_MISSING_LINES: true
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v4
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt
publish:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install poetry
uses: Gr1N/setup-poetry@v8
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: publish to pypi
run: |
poetry self add poetry-dynamic-versioning
poetry publish --build --username __token__ --password ${{ secrets.PYPI_TOKEN }}
- name: push tag
run: |
gh release create $(poetry version --short)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: deploy doc
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [publish, build]
steps:
- uses: actions/checkout@v2
- name: setup
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: build and deploy doc
run: |
pip install mkdocs-material mkdocstrings-python mkdocs
mkdocs gh-deploy --force