Debian Codegraph @

.github/workflows/ci.yml

raw
1 name: CI
2
3 on:
4 push:
5 branches:
6 - main
7 pull_request:
8
9 concurrency:
10 group: ${{ github.head_ref || github.run_id }}
11 cancel-in-progress: true
12
13 jobs:
14 lint:
15 runs-on: ubuntu-latest
16 steps:
17 - uses: actions/checkout@v3
18 - uses: actions/setup-python@v3
19 with:
20 python-version: "3.9"
21 - uses: pre-commit/[email protected]
22
23 # Make sure commit messages follow the conventional commits convention:
24 # https://www.conventionalcommits.org
25 commitlint:
26 name: Lint Commit Messages
27 runs-on: ubuntu-latest
28 steps:
29 - uses: actions/checkout@v3
30 with:
31 fetch-depth: 0
32 - uses: wagoid/commitlint-github-action@v5
33
34 test:
35 strategy:
36 fail-fast: false
37 matrix:
38 python-version:
39 - "3.9"
40 - "3.10"
41 - "3.11"
42 - "3.12"
43 os:
44 - ubuntu-latest
45 - macOS-latest
46 runs-on: ${{ matrix.os }}
47 steps:
48 - uses: actions/checkout@v3
49 - name: Set up Python
50 uses: actions/setup-python@v3
51 with:
52 python-version: ${{ matrix.python-version }}
53 - uses: snok/install-poetry@v1
54 - name: Install Dependencies
55 run: poetry install
56 - name: Test with Pytest
57 run: poetry run pytest --cov=./unifi_discovery --cov-report=xml --cov-report=term-missing tests/test_init.py
58 - name: Upload coverage to Codecov
59 uses: codecov/codecov-action@v3
60 with:
61 token: ${{ secrets.CODECOV_TOKEN }}
62
63 docs:
64 runs-on: ubuntu-latest
65 steps:
66 - uses: actions/checkout@v2
67 - name: Set up Python
68 uses: actions/setup-python@v2
69 with:
70 python-version: "3.9"
71 - uses: snok/install-poetry@v1
72 - name: Install Dependencies
73 run: poetry install -E docs
74 - name: Build docs
75 working-directory: docs
76 run: poetry run make html
77
78 release:
79 permissions:
80 id-token: write
81 contents: write
82
83 runs-on: ubuntu-latest
84 environment: release
85 if: github.ref == 'refs/heads/main'
86 needs:
87 - test
88 - lint
89 - commitlint
90
91 steps:
92 - uses: actions/checkout@v3
93 with:
94 fetch-depth: 0
95
96 # Run semantic release:
97 # - Update CHANGELOG.md
98 # - Update version in code
99 # - Create git tag
100 # - Create GitHub release
101 # - Publish to PyPI
102 - name: Python Semantic Release
103 uses: python-semantic-release/[email protected]
104 with:
105 github_token: ${{ secrets.GITHUB_TOKEN }}
106 pypi_token: ${{ secrets.PYPI_TOKEN }}