Debian Codegraph @

.github/workflows/ci.yaml

raw
1 ---
2 name: CI
3 on:
4 push:
5 pull_request:
6 schedule:
7 - cron: '30 0 * * 1'
8 jobs:
9 test:
10 name: Run unit tests
11 runs-on: ubuntu-latest
12 strategy:
13 matrix:
14 python: ['3.9', '3.10', '3.11', '3.12', '3.13']
15 steps:
16 - name: Checkout source code
17 uses: actions/checkout@v4
18 - name: Set up Python ${{ matrix.python }}
19 uses: actions/setup-python@v5
20 with:
21 python-version: ${{ matrix.python }}
22 - name: Install dependencies
23 run: python -m pip install tox
24 - name: Run unit tests (via tox)
25 # Run tox using the version of Python in `PATH`
26 run: tox -e py
27 lint:
28 name: Run linters
29 runs-on: ubuntu-latest
30 steps:
31 - name: Checkout source code
32 uses: actions/checkout@v4
33 - name: Set up Python
34 uses: actions/setup-python@v5
35 with:
36 python-version: '3.13'
37 - name: Install dependencies
38 run: python -m pip install tox
39 - name: Run linters (via tox)
40 # Run tox using the version of Python in `PATH`
41 run: tox -e lint
42 release:
43 name: Upload release artifacts
44 runs-on: ubuntu-latest
45 needs: test
46 if: github.event_name == 'push'
47 environment:
48 name: pypi
49 url: https://pypi.org/p/click-man
50 permissions:
51 id-token: write
52 steps:
53 - name: Checkout source code
54 uses: actions/checkout@v4
55 with:
56 fetch-depth: 0
57 - name: Set up Python
58 uses: actions/setup-python@v5
59 with:
60 python-version: '3.13'
61 - name: Install dependencies
62 run: python -m pip install build
63 - name: Build a binary wheel and a source tarball
64 run: python -m build --sdist --wheel --outdir dist/ .
65 - name: Publish distribution to PyPI
66 if: startsWith(github.ref, 'refs/tags')
67 uses: pypa/gh-action-pypi-publish@release/v1
68 - name: Create release on GitHub
69 id: create_release
70 if: startsWith(github.ref, 'refs/tags')
71 uses: actions/create-release@v1
72 env:
73 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74 with:
75 tag_name: ${{ github.ref }}
76 release_name: ${{ github.ref }}
77 draft: false
78 prerelease: false
79 - name: Add sdist to release
80 id: upload-release-asset
81 if: startsWith(github.ref, 'refs/tags')
82 uses: actions/upload-release-asset@v1
83 env:
84 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85 with:
86 upload_url: ${{ steps.create_release.outputs.upload_url }}
87 asset_path: ./dist/git-pw-${{ github.ref }}.tar.gz
88 asset_name: git-pw-${{ github.ref }}.tar.gz
89 asset_content_type: application/gzip