Skip to content

Commit 1e646af

Browse files
authored
Add release.yml for publishing to pypi (#164)
1 parent 14e473d commit 1e646af

File tree

4 files changed

+69
-33
lines changed

4 files changed

+69
-33
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
---
12
name: Python package
23

3-
on: [push]
4+
"on": [push]
45

56
jobs:
67
test:
@@ -9,28 +10,28 @@ jobs:
910
matrix:
1011
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1112
steps:
12-
- uses: actions/checkout@v3
13-
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v4
15-
with:
16-
python-version: ${{ matrix.python-version }}
17-
- id: tox-env
18-
run: |
19-
VERSION=${{ matrix.python-version }}
20-
echo "environment=${VERSION//.}" >> $GITHUB_OUTPUT
21-
- name: Install LLVM and Clang
22-
uses: KyleMayes/install-llvm-action@v1
23-
with:
24-
version: "16.0"
25-
- name: Symlink libclang.so
26-
run: sudo ln -s ${{ env.LLVM_PATH }}/lib/libclang.so /usr/lib/x86_64-linux-gnu/libclang-16.so
27-
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install tox
31-
- name: Test with tox
32-
run: |
33-
tox -e py${{ steps.tox-env.outputs.environment }}
13+
- uses: actions/checkout@v3
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- id: tox-env
19+
run: |
20+
VERSION=${{ matrix.python-version }}
21+
echo "environment=${VERSION//.}" >> $GITHUB_OUTPUT
22+
- name: Install LLVM and Clang
23+
uses: KyleMayes/install-llvm-action@v1
24+
with:
25+
version: "16.0"
26+
- name: Symlink libclang.so
27+
run: sudo ln -s ${{ env.LLVM_PATH }}/lib/libclang.so /usr/lib/x86_64-linux-gnu/libclang-16.so
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install tox
32+
- name: Test with tox
33+
run: |
34+
tox -e py${{ steps.tox-env.outputs.environment }}
3435
3536
coverage:
3637
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Publish Python 🐍 distributions 📦 to PyPI
3+
4+
"on":
5+
push:
6+
tags:
7+
- "v*"
8+
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python 🐍 distributions 📦 to PyPI
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: release
15+
url: https://pypi.org/project/sphinx-c-autodoc
16+
permissions:
17+
id-token: write
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.11"
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build twine
28+
- name: Build a wheel and a source tarball
29+
run: python -m build
30+
- name: Check with twine
31+
run: twine check dist/*
32+
- name: Publish distribution 📦 to PyPI
33+
uses: pypa/[email protected]

.readthedocs.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# Read the Docs configuration file
23
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
34

@@ -11,17 +12,14 @@ sphinx:
1112
# changelog so do not fail on warning
1213
fail_on_warning: false
1314

14-
# Build documentation with MkDocs
15-
#mkdocs:
16-
# configuration: mkdocs.yml
17-
1815
# Optionally build your docs in additional formats such as PDF and ePub
1916
formats: all
2017

21-
# Optionally set the version of Python and requirements required to build your docs
18+
# Optionally set the version of Python and requirements required to build your
19+
# docs
2220
python:
2321
version: 3.7
2422
install:
2523
- method: pip
2624
path: .
27-
- requirements: docs/requirements.txt
25+
- requirements: docs/requirements.txt

README.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ Could be referenced in documentation as:
3636
3737
With the resulting documentation output of:
3838

39-
.. c:function:: int my_adding_function(int a, int b)
39+
.. Note this isn't using the c:function directive because that doesn't work on
40+
pypi
4041
42+
int my_adding_function(int a, int b)
4143
A simple function that adds.
4244

43-
:param a: The initial value
44-
:param b: The value to add to `a`
45-
:returns: The sum of `a` and `b`
45+
:Parameters:
46+
* **a** - The initial value
47+
* **b** - The value to add to `a`
48+
49+
:Returns: The sum of `a` and `b`
4650

4751
.. _autodoc: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
4852
.. _Sphinx: https://www.sphinx-doc.org/en/master/index.html

0 commit comments

Comments
 (0)