-
Notifications
You must be signed in to change notification settings - Fork 76
89 lines (87 loc) · 2.66 KB
/
publish.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
name: Publish
on:
push:
tags:
- "*"
jobs:
tests:
name: "Publish on python ${{ matrix.python-version }}, ${{ matrix.os }}"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
# Should match the python versions in pyproject.toml and ci.yml
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [windows-latest, ubuntu-latest, macos-latest]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false --local
poetry install
- name: Static type and format checking
run: python scripts/check.py
- name: Test and generate coverage report
run: |
pytest --cov=scrcpy --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
directory: ./coverage/reports/
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: false
verbose: true
publish:
name: Publish package
needs: tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v5
with:
# Use the latest python version we support
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false --local
poetry install
- name: Build
run: poetry build
- name: Publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
docs:
name: Generate document
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v5
with:
# Just use the latest python version we support
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false --local
poetry install
- name: Build docs
run: cd docs && make html
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html